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

Function collectargs

lua/lua.c:259–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

pmainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected