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 = index(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)
343 av += optind;
351 if (ac > 1 && isdigit(*av[0])) {
352 char *p = av[0];
354 av[0] = av[1];
355 av[1] = p;
364 if (!strncmp(*av, "nat", strlen(*av)))
366 else if (!strncmp(*av, "pipe", strlen(*av)))
368 else if (_substrcmp(*av, "queue") == 0)
370 else if (_substrcmp(*av, "flowset") == 0)
372 else if (_substrcmp(*av, "sched") == 0)
374 else if (!strncmp(*av, "set", strlen(*av))) {
375 if (ac > 1 && isdigit(av[1][0])) {
376 co.use_set = strtonum(av[1], 0, resvd_set_number,
380 "invalid set number %s\n", av[1]);
381 ac -= 2; av += 2; co.use_set++;
387 av++;
396 if ((co.do_pipe || co.do_nat) && ac > 1 && isdigit(*av[0])) {
397 char *p = av[0];
399 av[0] = av[1];
400 av[1] = p;
404 if (_substrcmp(*av, "add") == 0)
405 ipfw_add(av);
406 else if (co.do_nat && _substrcmp(*av, "show") == 0)
407 ipfw_show_nat(ac, av);
408 else if (co.do_pipe && _substrcmp(*av, "config") == 0)
409 ipfw_config_pipe(ac, av);
410 else if (co.do_nat && _substrcmp(*av, "config") == 0)
411 ipfw_config_nat(ac, av);
412 else if (_substrcmp(*av, "set") == 0)
413 ipfw_sets_handler(av);
414 else if (_substrcmp(*av, "table") == 0)
415 ipfw_table_handler(ac, av);
416 else if (_substrcmp(*av, "enable") == 0)
417 ipfw_sysctl_handler(av, 1);
418 else if (_substrcmp(*av, "disable") == 0)
419 ipfw_sysctl_handler(av, 0);
425 if (_substrcmp(*av, "delete") == 0)
426 ipfw_delete(av);
427 else if (_substrcmp(*av, "flush") == 0)
429 else if (_substrcmp(*av, "zero") == 0)
430 ipfw_zero(ac, av, 0 /* IP_FW_ZERO */);
431 else if (_substrcmp(*av, "resetlog") == 0)
432 ipfw_zero(ac, av, 1 /* IP_FW_RESETLOG */);
433 else if (_substrcmp(*av, "print") == 0 ||
434 _substrcmp(*av, "list") == 0)
435 ipfw_list(ac, av, do_acct);
436 else if (_substrcmp(*av, "show") == 0)
437 ipfw_list(ac, av, 1 /* show counters */);
439 errx(EX_USAGE, "bad command `%s'", *av);
449 ipfw_readfile(int ac, char *av[])
453 char *progname = av[0]; /* original program name */
455 const char *filename = av[ac-1]; /* file to read */
460 while ((c = getopt(ac, av, "cfNnp:qS")) != -1) {
486 * - advance av by optind-1 to skip arguments
490 * - set the last entry in av[] to NULL so
497 av[ac-1] = NULL;
498 av += optind - 1;
519 errx(EX_USAGE, "extraneous filename arguments %s", av[ac-1]);
545 execvp(cmd, av);
589 main(int ac, char *av[])
610 if (ac > 1 && av[ac - 1][0] == '/') {
611 if (access(av[ac - 1], R_OK) == 0)
612 ipfw_readfile(ac, av);
614 err(EX_USAGE, "pathname: %s", av[ac - 1]);
616 if (ipfw_main(ac, av)) {