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