summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmart <smart@cvs.openbsd.org>2001-06-25 22:14:08 +0000
committersmart <smart@cvs.openbsd.org>2001-06-25 22:14:08 +0000
commit1e2c769d979d4156b149f430469fc283c4dfa84c (patch)
tree35e5af79bfd8eb851a5e49c82f69a5dedd8fe5c4
parentc66ed44ff2c97f180e268d33d13acf035ad6242e (diff)
Fix up usage() and alphabetize options.
-rw-r--r--sbin/pfctl/pfctl.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 9e51a53c6aa..8951e0c3eec 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.10 2001/06/25 17:59:19 smart Exp $ */
+/* $OpenBSD: pfctl.c,v 1.11 2001/06/25 22:14:07 smart Exp $ */
/*
* Copyright (c) 2001, Daniel Hartmeier
@@ -82,8 +82,8 @@ usage()
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-d] [-c set] [-r file]", __progname);
- fprintf(stderr, " [-n file] [-s set] [-l if] [-e]\n");
+ fprintf(stderr, "usage: %s [-de] [-c set] [-l interface]", __progname);
+ fprintf(stderr, " [-n file] [-r file] [-s set]\n");
exit(1);
}
@@ -123,10 +123,10 @@ pfctl_enable(int dev)
{
if (ioctl(dev, DIOCSTART)) {
print_error("DIOCSTART");
- return 1;
+ return (1);
}
printf("pf enabled\n");
- return 0;
+ return (0);
}
int
@@ -134,10 +134,10 @@ pfctl_disable(int dev)
{
if (ioctl(dev, DIOCSTOP)) {
print_error("DIOCSTOP");
- return 1;
+ return (1);
}
printf("pf disabled\n");
- return 0;
+ return (0);
}
int
@@ -411,31 +411,32 @@ main(int argc, char *argv[])
int dev;
int ch;
- while (!error && (ch = getopt(argc, argv, "dc:r:n:s:l:e")) != -1) {
+ while ((ch = getopt(argc, argv, "c:del:n:r:s:")) != -1) {
switch (ch) {
+ case 'c':
+ clearopt = optarg;
+ break;
case 'd':
dflag++;
break;
- case 'c':
- clearopt = optarg;
+ case 'e':
+ eflag++;
break;
- case 'r':
- rulesopt = optarg;
+ case 'l':
+ logopt = optarg;
break;
case 'n':
natopt = optarg;
break;
+ case 'r':
+ rulesopt = optarg;
+ break;
case 's':
showopt = optarg;
break;
- case 'l':
- logopt = optarg;
- break;
- case 'e':
- eflag++;
- break;
default:
usage();
+ /* NOTREACHED */
}
}