| 167 | } |
| 168 | |
| 169 | static int pmain(lua_State* L) |
| 170 | { |
| 171 | int argc=(int)lua_tointeger(L,1); |
| 172 | char** argv=(char**)lua_touserdata(L,2); |
| 173 | const Proto* f; |
| 174 | int i; |
| 175 | tmname=G(L)->tmname; |
| 176 | if (!lua_checkstack(L,argc)) fatal("too many input files"); |
| 177 | for (i=0; i<argc; i++) |
| 178 | { |
| 179 | const char* filename=IS("-") ? NULL : argv[i]; |
| 180 | if (luaL_loadfile(L,filename)!=LUA_OK) fatal(lua_tostring(L,-1)); |
| 181 | } |
| 182 | f=combine(L,argc); |
| 183 | if (listing) luaU_print(f,listing>1); |
| 184 | if (dumping) |
| 185 | { |
| 186 | FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); |
| 187 | if (D==NULL) cannot("open"); |
| 188 | lua_lock(L); |
| 189 | luaU_dump(L,f,writer,D,stripping); |
| 190 | lua_unlock(L); |
| 191 | if (ferror(D)) cannot("write"); |
| 192 | if (fclose(D)) cannot("close"); |
| 193 | } |
| 194 | return 0; |
| 195 | } |
| 196 | |
| 197 | int main(int argc, char* argv[]) |
| 198 | { |
nothing calls this directly
no test coverage detected