pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: use proper exit ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/30034551d82a
branches:  trunk
changeset: 383086:30034551d82a
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Aug 11 18:55:35 2022 +0000

description:
lintpkgsrc: use proper exit status when showing usage

diffstat:

 pkgtools/lintpkgsrc/files/lintpkgsrc.pl |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r e1adcca23968 -r 30034551d82a pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Thu Aug 11 16:40:17 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Thu Aug 11 18:55:35 2022 +0000
@@ -1,6 +1,6 @@
 #!@PERL5@
 
-# $NetBSD: lintpkgsrc.pl,v 1.75 2022/08/11 07:20:52 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.76 2022/08/11 18:55:35 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -1259,7 +1259,7 @@
 
 # Remember to update manual page when modifying option list
 #
-sub usage_and_exit() {
+sub usage_and_exit($status) {
        print "Usage: lintpkgsrc [opts] [makefiles]
 opts:
   -h : This help.       [see lintpkgsrc(1) for more information]
@@ -1288,7 +1288,7 @@
   -D      : Debug makefile and glob parsing
   -L      : List each Makefile when scanned
 ";
-       exit;
+       exit $status;
 }
 
 # Could speed up by building a cache of package names to paths, then processing
@@ -1608,7 +1608,7 @@
            !getopts('BDE:I:K:LM:OP:RSVdg:himopruyz', \%opt)
                || $opt{h}
                || !grep(/[BDEORSdgimopruyz]/, keys %opt)) {
-               usage_and_exit();
+               usage_and_exit($opt{h} ? 0 : 1);
        }
        $| = 1;
 



Home | Main Index | Thread Index | Old Index