Detect and report write failure of --help/--version.
authorJim Meyering <jim@meyering.net>
Fri, 12 May 2000 22:38:58 +0000 (22:38 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 12 May 2000 22:38:58 +0000 (22:38 +0000)
src/groups.sh
src/nohup.sh

index af54e0e..b5160d8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # groups -- print the groups a user is in
-# Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1991, 1997, 2000 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,13 +31,14 @@ Same as id -Gn.  If no USERNAME, use current process.
 
 Report bugs to <sh-utils-bugs@gnu.org>."
 
+fail=0
 case $# in
   1 )
     case "z${1}" in
       z--help )
-        echo "$usage"; exit 0 ;;
+        echo "$usage" || fail=1; exit $fail;;
       z--version )
-        echo "groups (@GNU_PACKAGE@) @VERSION@"; exit 0 ;;
+        echo "groups (@GNU_PACKAGE@) @VERSION@" || fail=1; exit $fail;;
       * ) ;;
     esac
     ;;
@@ -48,7 +49,6 @@ if [ $# -eq 0 ]; then
   id -Gn
   fail=$?
 else
-  fail=0
   for name in "$@"; do
     groups=`id -Gn -- $name`
     status=$?
index a7526c4..7c183db 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # nohup -- run a command immume to hangups, with output to a non-tty
-# Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1991, 1997, 1999, 2000 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -37,13 +37,14 @@ if [ $# -eq 0 ]; then
   exit 1
 fi
 
+fail=0
 case $# in
   1 )
     case "z${1}" in
       z--help )
-        echo "$usage"; echo "$usage_help"; exit 0 ;;
+        echo "$usage" || fail=1; echo "$usage_help" || fail=1; exit $fail;;
       z--version )
-        echo "nohup (@GNU_PACKAGE@) @VERSION@"; exit 0 ;;
+        echo "nohup (@GNU_PACKAGE@) @VERSION@" || fail=1; exit $fail;;
       * ) ;;
     esac
     ;;