MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / runargs

Function runargs

lua/lua.c:292–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290
291
292static int runargs (lua_State *L, char **argv, int n) {
293 int i;
294 for (i = 1; i < n; i++) {
295 if (argv[i] == NULL) continue;
296 lua_assert(argv[i][0] == '-');
297 switch (argv[i][1]) { /* option */
298 case 'e': {
299 const char *chunk = argv[i] + 2;
300 if (*chunk == '\0') chunk = argv[++i];
301 lua_assert(chunk != NULL);
302 if (dostring(L, chunk, "=(command line)") != 0)
303 return 1;
304 break;
305 }
306 case 'l': {
307 const char *filename = argv[i] + 2;
308 if (*filename == '\0') filename = argv[++i];
309 lua_assert(filename != NULL);
310 if (dolibrary(L, filename))
311 return 1; /* stop if file fails */
312 break;
313 }
314 default: break;
315 }
316 }
317 return 0;
318}
319
320
321static int handle_luainit (lua_State *L) {

Callers 1

pmainFunction · 0.85

Calls 2

dostringFunction · 0.85
dolibraryFunction · 0.85

Tested by

no test coverage detected