MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / collectargs

Function collectargs

other_src/lua/src/lua.cpp:261–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259
260
261static int collectargs (char **argv, int *pi, int *pv, int *pe) {
262 int i;
263 for (i = 1; argv[i] != NULL; i++) {
264 if (argv[i][0] != '-') /* not an option? */
265 return i;
266 switch (argv[i][1]) { /* option */
267 case '-':
268 notail(argv[i]);
269 return (argv[i+1] != NULL ? i+1 : 0);
270 case '\0':
271 return i;
272 case 'i':
273 notail(argv[i]);
274 *pi = 1; /* go through */
275 case 'v':
276 notail(argv[i]);
277 *pv = 1;
278 break;
279 case 'e':
280 *pe = 1; /* go through */
281 case 'l':
282 if (argv[i][2] == '\0') {
283 i++;
284 if (argv[i] == NULL) return -1;
285 }
286 break;
287 default: return -1; /* invalid option */
288 }
289 }
290 return 0;
291}
292
293
294static int runargs (lua_State *L, char **argv, int n) {

Callers 1

pmainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected