Index: contrib/ipfilter/tools/ippool.c =================================================================== --- contrib/ipfilter/tools/ippool.c (revision 316573) +++ contrib/ipfilter/tools/ippool.c (working copy) @@ -262,7 +262,7 @@ char *argv[]; { int type, role, c, err; - char *poolname; + char *poolname, *typearg = NULL; iphtable_t iph; ip_pool_t pool; @@ -274,7 +274,9 @@ bzero((char *)&iph, sizeof(iph)); bzero((char *)&pool, sizeof(pool)); - while ((c = getopt(argc, argv, "dm:no:RSv")) != -1) + optreset = optind = 1; + + while ((c = getopt(argc, argv, "dm:no:RSvt:")) != -1) switch (c) { case 'd' : @@ -303,8 +305,18 @@ case 'v' : opts |= OPT_VERBOSE; break; + case 't' : + type = gettype(optarg, &iph.iph_type); + typearg = optarg; + break; + default : + usage(argv[0]); + break; /* keep compiler happy */ } + if (argc - optind > 0) + usage(argv[0]); + if (opts & OPT_DEBUG) fprintf(stderr, "poolcommand: opts = %#x\n", opts); @@ -313,9 +325,11 @@ return -1; } - type = gettype(argv[optind], &iph.iph_type); if (type == IPLT_NONE) { - fprintf(stderr, "unknown type '%s'\n", argv[optind]); + if (typearg == NULL) + usage(argv[0]); + else + fprintf(stderr, "unknown type '%s'\n", typearg); return -1; }