void read_header(FILE* ff) { char* ftype = lgetline(ff); if (!streq(ftype, "P2\n") && !streq(ftype, "P3\n")) carp("That's not an ASCII PGM or PPM"); int ch; while ((ch = fgetc(ff)) == '#') { char* _junk = lgetline(ff); _junk = _junk; } ungetc(ch, ff); }
static void traceexec (lua_State *L, const Instruction *pc) { lu_byte mask = L->hookmask; const Instruction *oldpc = L->savedpc; L->savedpc = pc; if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { resethookcount(L); luaD_callhook(L, LUA_HOOKCOUNT, -1); } if (mask & LUA_MASKLINE) { Proto *p = ci_func(L->ci)->l.p; int npc = pcRel(pc, p); int newline = lgetline(p, npc); /* call linehook when enter a new function, when jump back (loop), or when enter a new line */ if (npc == 0 || pc <= oldpc || newline != lgetline(p, pcRel(oldpc, p))) luaD_callhook(L, LUA_HOOKLINE, newline); } }
int main(void) { char line[MAXLINE]; int len; while ((len = lgetline(line, MAXLINE)) > 0) if (len > FLAG) printf("%s\n", line); return 0; }