/* Get a conversion specification and copy it to 'form'. Return the address of its last character.  */
static const char* getformat(lua_State *L, const char *strfrmt, char *form)
/* Get a conversion specification and copy it to 'form'. Return the address of its last character.  */
static const char* getformat(lua_State *L, const char *strfrmt, char *form)
{
  size_t len = strspn(strfrmt, L_FMTFLAGSF "123456789.");
  len++;
  if (len >= MAX_FORMAT - 10)
    luaL_error(L, "invalid format (too long)");
  *(form++) = '%';
  memcpy(form, strfrmt, len * sizeof(char));
  *(form + len) = '\0';
  return strfrmt + len - 1;
}