| 164 | } |
| 165 | |
| 166 | static int pmain(lua_State* L) |
| 167 | { |
| 168 | int argc = (int)lua_tointeger(L, 1); |
| 169 | char** argv = (char**)lua_touserdata(L, 2); |
| 170 | const Proto* f; |
| 171 | int i; |
| 172 | if (!lua_checkstack(L, argc)) fatal("too many input files"); |
| 173 | for (i = 0; i < argc; i++) |
| 174 | { |
| 175 | const char* filename = IS("-") ? nullptr : argv[i]; |
| 176 | if (luaL_loadfile(L, filename) != LUA_OK) fatal(lua_tostring(L, -1)); |
| 177 | } |
| 178 | f = combine(L, argc); |
| 179 | if (listing) luaU_print(f, listing > 1); |
| 180 | if (dumping) |
| 181 | { |
| 182 | FILE* D = (output == nullptr) ? stdout : fopen(output, "wb"); |
| 183 | if (!D) |
| 184 | { |
| 185 | cannot("open"); |
| 186 | return 0; |
| 187 | } |
| 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 main2(int argc, char* argv[]) |
| 198 | { |
nothing calls this directly
no test coverage detected