| 272 | |
| 273 | |
| 274 | static const char *checkoption (lua_State *L, const char *conv, |
| 275 | ptrdiff_t convlen, char *buff) { |
| 276 | const char *option = LUA_STRFTIMEOPTIONS; |
| 277 | int oplen = 1; /* length of options being checked */ |
| 278 | for (; *option != '\0' && oplen <= convlen; option += oplen) { |
| 279 | if (*option == '|') /* next block? */ |
| 280 | oplen++; /* will check options with next length (+1) */ |
| 281 | else if (memcmp(conv, option, oplen) == 0) { /* match? */ |
| 282 | memcpy(buff, conv, oplen); /* copy valid option to buffer */ |
| 283 | buff[oplen] = '\0'; |
| 284 | return conv + oplen; /* return next item */ |
| 285 | } |
| 286 | } |
| 287 | luaL_argerror(L, 1, |
| 288 | lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); |
| 289 | return conv; /* to avoid warnings */ |
| 290 | } |
| 291 | |
| 292 | |
| 293 | static time_t l_checktime (lua_State *L, int arg) { |
no test coverage detected