** 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). */
| 2899 | ** a first-line comment). |
| 2900 | */ |
| 2901 | static int compat53_skipcomment(compat53_LoadF *lf, int *cp) { |
| 2902 | int c = *cp = compat53_skipBOM(lf); |
| 2903 | if (c == '#') { /* first line is a comment (Unix exec. file)? */ |
| 2904 | do { /* skip first line */ |
| 2905 | c = getc(lf->f); |
| 2906 | } while (c != EOF && c != '\n'); |
| 2907 | *cp = getc(lf->f); /* skip end-of-line, if present */ |
| 2908 | return 1; /* there was a comment */ |
| 2909 | } |
| 2910 | else return 0; /* no comment */ |
| 2911 | } |
| 2912 | |
| 2913 | COMPAT53_API int luaL_loadfilex(lua_State *L, const char *filename, const char *mode) { |
| 2914 | compat53_LoadF lf; |
no test coverage detected