aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2011-06-29 06:45:44 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2011-06-29 06:45:44 +0000
commit0dba401da6c203eba3a237e3033713b710b5044d (patch)
tree0239db3438270727802b487b65afb5c5e6d83a10 /sbin
parent2b9be05588b0ff4b5de2ea6f88b7589fa489ca20 (diff)
downloadsrc-0dba401da6c203eba3a237e3033713b710b5044d.tar.gz
src-0dba401da6c203eba3a237e3033713b710b5044d.zip
Improve error reporting. Use corresponding error message when file to be
preprocessed is missing. Also suggest to use absolute pathname if -p option is specified. PR: bin/156653 MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=223661
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipfw/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c
index 109b62b7de43..433ce7d6b5cc 100644
--- a/sbin/ipfw/main.c
+++ b/sbin/ipfw/main.c
@@ -262,7 +262,7 @@ ipfw_main(int oldac, char **oldav)
save_av = av;
optind = optreset = 1; /* restart getopt() */
- while ((ch = getopt(ac, av, "abcdefhinNqs:STtv")) != -1)
+ while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1)
switch (ch) {
case 'a':
do_acct = 1;
@@ -306,6 +306,10 @@ ipfw_main(int oldac, char **oldav)
co.do_resolv = 1;
break;
+ case 'p':
+ errx(EX_USAGE, "An absolute pathname must be used "
+ "with -p option.");
+
case 'q':
co.do_quiet = 1;
break;
@@ -603,9 +607,12 @@ main(int ac, char *av[])
* as a file to be preprocessed.
*/
- if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0)
- ipfw_readfile(ac, av);
- else {
+ if (ac > 1 && av[ac - 1][0] == '/') {
+ if (access(av[ac - 1], R_OK) == 0)
+ ipfw_readfile(ac, av);
+ else
+ err(EX_USAGE, "pathname: %s", av[ac - 1]);
+ } else {
if (ipfw_main(ac, av)) {
errx(EX_USAGE,
"usage: ipfw [options]\n"