maint: detect usage(1) and other suspicious exits
authorEric Blake <ebb9@byu.net>
Thu, 29 Oct 2009 13:29:26 +0000 (07:29 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 29 Oct 2009 13:29:26 +0000 (07:29 -0600)
* top/maint.mk (sc_prohibit_magic_number_exit): New rule.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
top/maint.mk

index b2073ee7b14832740ef2327c471020d36e73cd61..b0c83b8a8bc4ace44834832f4a52dd3c7996123f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-29  Eric Blake  <ebb9@byu.net>
+
+       maint: detect usage(1) and other suspicious exits
+       * top/maint.mk (sc_prohibit_magic_number_exit): New rule.
+
 2009-10-29  Jim Meyering  <meyering@redhat.com>
 
        timespec: long-to-int truncation could make timespec_cmp malfunction
index 68bd8f9153719b21b912d7f6e3121d598f37f067..996344a93d8349dc4c9d22e0990d953cb4062029 100644 (file)
@@ -156,6 +156,12 @@ sc_prohibit_strcmp:
          { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
                1>&2; exit 1; } || :
 
+# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+sc_prohibit_magic_number_exit:
+       @re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'           \
+       msg='use EXIT_* values rather than magic number'                \
+         $(_prohibit_regexp)
+
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use `0' instead.
 sc_error_exit_success: