** reads the first character of file 'f' and skips an optional BOM mark ** in its beginning plus its first line if it starts with '#'. Returns ** true if it skipped the first line. In any case, '*cp' has the ** first "valid" character of the file (after the optional BOM and ** a first-line comment). */
| 3417 | ** a first-line comment). |
| 3418 | */ |
| 3419 | static int compat53_skipcomment(compat53_LoadF* lf, int* cp) { |
| 3420 | int c = *cp = compat53_skipBOM(lf); |
| 3421 | if (c == '#') { /* first line is a comment (Unix exec. file)? */ |
| 3422 | do { /* skip first line */ |
| 3423 | c = getc(lf->f); |
| 3424 | } while (c != EOF && c != '\n'); |
| 3425 | *cp = getc(lf->f); /* skip end-of-line, if present */ |
| 3426 | return 1; /* there was a comment */ |
| 3427 | } |
| 3428 | else |
| 3429 | return 0; /* no comment */ |
| 3430 | } |
| 3431 | |
| 3432 | COMPAT53_API int luaL_loadfilex(lua_State* L, const char* filename, const char* mode) { |
| 3433 | compat53_LoadF lf; |
no test coverage detected