Lines Matching refs:av

90  * The pointers (av[]) and data are in a single chunk of memory.
91 * av[0] points to the original program name, all other entries
99 char **av, **save_av;
102 int av_size; /* compute the av size */
103 char *av_p; /* used to build the av list */
156 av = safe_calloc(av_size, 1);
160 * and copy arguments from arg[] to av[]. For each one,
163 av_p = (char *)&av[ac+1];
169 av[ac] = av_p;
194 av = safe_calloc(av_size, 1);
198 * and copy arguments from arg[] to av[]
200 av_p = (char *)&av[oldac+1];
208 av[ac] = av_p;
225 av[0] = oldav[0];
226 av[ac] = NULL;
233 if ( ac >= 2 && !strcmp(av[1], "sysctl")) {
243 s = strchr(av[2], '=');
245 s = !strcmp(av[2], "-a") ? NULL : av[2];
255 sysctlbyname(av[2], NULL, NULL, &i, sizeof(int));
262 save_av = av;
265 while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1)
344 av += optind;
352 if (ac > 1 && isdigit(*av[0])) {
353 char *p = av[0];
355 av[0] = av[1];
356 av[1] = p;
365 if (!strncmp(*av, "nat", strlen(*av)))
367 else if (!strncmp(*av, "pipe", strlen(*av)))
369 else if (_substrcmp(*av, "queue") == 0)
371 else if (_substrcmp(*av, "flowset") == 0)
373 else if (_substrcmp(*av, "sched") == 0)
375 else if (!strncmp(*av, "set", strlen(*av))) {
376 if (ac > 1 && isdigit(av[1][0])) {
377 co.use_set = strtonum(av[1], 0, resvd_set_number,
381 "invalid set number %s\n", av[1]);
382 ac -= 2; av += 2; co.use_set++;
388 av++;
397 if ((co.do_pipe || co.do_nat) && ac > 1 && isdigit(*av[0])) {
398 char *p = av[0];
400 av[0] = av[1];
401 av[1] = p;
405 if (_substrcmp(*av, "add") == 0)
406 ipfw_add(av);
407 else if (co.do_nat && _substrcmp(*av, "show") == 0)
408 ipfw_show_nat(ac, av);
409 else if (co.do_pipe && _substrcmp(*av, "config") == 0)
410 ipfw_config_pipe(ac, av);
411 else if (co.do_nat && _substrcmp(*av, "config") == 0)
412 ipfw_config_nat(ac, av);
413 else if (_substrcmp(*av, "set") == 0)
414 ipfw_sets_handler(av);
415 else if (_substrcmp(*av, "table") == 0)
416 ipfw_table_handler(ac, av);
417 else if (_substrcmp(*av, "enable") == 0)
418 ipfw_sysctl_handler(av, 1);
419 else if (_substrcmp(*av, "disable") == 0)
420 ipfw_sysctl_handler(av, 0);
426 if (_substrcmp(*av, "delete") == 0)
427 ipfw_delete(av);
428 else if (_substrcmp(*av, "flush") == 0)
430 else if (_substrcmp(*av, "zero") == 0)
431 ipfw_zero(ac, av, 0 /* IP_FW_ZERO */);
432 else if (_substrcmp(*av, "resetlog") == 0)
433 ipfw_zero(ac, av, 1 /* IP_FW_RESETLOG */);
434 else if (_substrcmp(*av, "print") == 0 ||
435 _substrcmp(*av, "list") == 0)
436 ipfw_list(ac, av, do_acct);
437 else if (_substrcmp(*av, "show") == 0)
438 ipfw_list(ac, av, 1 /* show counters */);
440 errx(EX_USAGE, "bad command `%s'", *av);
450 ipfw_readfile(int ac, char *av[])
454 char *progname = av[0]; /* original program name */
456 const char *filename = av[ac-1]; /* file to read */
461 while ((c = getopt(ac, av, "cfNnp:qS")) != -1) {
487 * - advance av by optind-1 to skip arguments
491 * - set the last entry in av[] to NULL so
498 av[ac-1] = NULL;
499 av += optind - 1;
520 errx(EX_USAGE, "extraneous filename arguments %s", av[ac-1]);
546 execvp(cmd, av);
590 main(int ac, char *av[])
611 if (ac > 1 && av[ac - 1][0] == '/') {
612 if (access(av[ac - 1], R_OK) == 0)
613 ipfw_readfile(ac, av);
615 err(EX_USAGE, "pathname: %s", av[ac - 1]);
617 if (ipfw_main(ac, av)) {