From owner-svn-src-stable@FreeBSD.ORG Wed Jul 13 04:27:47 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6776106564A; Wed, 13 Jul 2011 04:27:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A58008FC08; Wed, 13 Jul 2011 04:27:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6D4RlAU068864; Wed, 13 Jul 2011 04:27:47 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6D4RlbS068862; Wed, 13 Jul 2011 04:27:47 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201107130427.p6D4RlbS068862@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 13 Jul 2011 04:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223972 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2011 04:27:47 -0000 Author: ae Date: Wed Jul 13 04:27:47 2011 New Revision: 223972 URL: http://svn.freebsd.org/changeset/base/223972 Log: MFC r223661: 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 Modified: stable/8/sbin/ipfw/main.c Directory Properties: stable/8/sbin/ipfw/ (props changed) Modified: stable/8/sbin/ipfw/main.c ============================================================================== --- stable/8/sbin/ipfw/main.c Wed Jul 13 00:48:36 2011 (r223971) +++ stable/8/sbin/ipfw/main.c Wed Jul 13 04:27:47 2011 (r223972) @@ -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"