Lines 262-268
Link Here
|
262 |
char *argv[]; |
262 |
char *argv[]; |
263 |
{ |
263 |
{ |
264 |
int type, role, c, err; |
264 |
int type, role, c, err; |
265 |
char *poolname; |
265 |
char *poolname, *typearg = NULL; |
266 |
iphtable_t iph; |
266 |
iphtable_t iph; |
267 |
ip_pool_t pool; |
267 |
ip_pool_t pool; |
268 |
|
268 |
|
Lines 274-280
Link Here
|
274 |
bzero((char *)&iph, sizeof(iph)); |
274 |
bzero((char *)&iph, sizeof(iph)); |
275 |
bzero((char *)&pool, sizeof(pool)); |
275 |
bzero((char *)&pool, sizeof(pool)); |
276 |
|
276 |
|
277 |
while ((c = getopt(argc, argv, "dm:no:RSv")) != -1) |
277 |
optreset = optind = 1; |
|
|
278 |
|
279 |
while ((c = getopt(argc, argv, "dm:no:RSvt:")) != -1) |
278 |
switch (c) |
280 |
switch (c) |
279 |
{ |
281 |
{ |
280 |
case 'd' : |
282 |
case 'd' : |
Lines 303-310
Link Here
|
303 |
case 'v' : |
305 |
case 'v' : |
304 |
opts |= OPT_VERBOSE; |
306 |
opts |= OPT_VERBOSE; |
305 |
break; |
307 |
break; |
|
|
308 |
case 't' : |
309 |
type = gettype(optarg, &iph.iph_type); |
310 |
typearg = optarg; |
311 |
break; |
312 |
default : |
313 |
usage(argv[0]); |
314 |
break; /* keep compiler happy */ |
306 |
} |
315 |
} |
307 |
|
316 |
|
|
|
317 |
if (argc - optind > 0) |
318 |
usage(argv[0]); |
319 |
|
308 |
if (opts & OPT_DEBUG) |
320 |
if (opts & OPT_DEBUG) |
309 |
fprintf(stderr, "poolcommand: opts = %#x\n", opts); |
321 |
fprintf(stderr, "poolcommand: opts = %#x\n", opts); |
310 |
|
322 |
|
Lines 313-321
Link Here
|
313 |
return -1; |
325 |
return -1; |
314 |
} |
326 |
} |
315 |
|
327 |
|
316 |
type = gettype(argv[optind], &iph.iph_type); |
|
|
317 |
if (type == IPLT_NONE) { |
328 |
if (type == IPLT_NONE) { |
318 |
fprintf(stderr, "unknown type '%s'\n", argv[optind]); |
329 |
if (typearg == NULL) |
|
|
330 |
usage(argv[0]); |
331 |
else |
332 |
fprintf(stderr, "unknown type '%s'\n", typearg); |
319 |
return -1; |
333 |
return -1; |
320 |
} |
334 |
} |
321 |
|
335 |
|