** 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). */
| 688 | ** a first-line comment). |
| 689 | */ |
| 690 | static int skipcomment (LoadF *lf, int *cp) { |
| 691 | int c = *cp = skipBOM(lf); |
| 692 | if (c == '#') { /* first line is a comment (Unix exec. file)? */ |
| 693 | do { /* skip first line */ |
| 694 | c = getc(lf->f); |
| 695 | } while (c != EOF && c != '\n'); |
| 696 | *cp = getc(lf->f); /* skip end-of-line, if present */ |
| 697 | return 1; /* there was a comment */ |
| 698 | } |
| 699 | else return 0; /* no comment */ |
| 700 | } |
| 701 | |
| 702 | |
| 703 | LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, |
no test coverage detected