zcmp: consistently indicate failure with exit status of 2
authorJim Meyering <meyering@redhat.com>
Sun, 7 Feb 2010 11:04:22 +0000 (12:04 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 7 Feb 2010 11:04:22 +0000 (12:04 +0100)
* zcmp.in: Exit with status of 2 (not 1), when writing
--help or --version output fails, to be more like cmp.

zcmp.in

diff --git a/zcmp.in b/zcmp.in
index d3fb95674990af0a74996345597af9439d3d14de..c3476cf6dc1cc1978d47573d0656ee349cf79382 100644 (file)
--- a/zcmp.in
+++ b/zcmp.in
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Compare the uncompressed contents of compressed files, byte by byte.
 
-# Copyright (C) 2007 Free Software Foundation
+# Copyright (C) 2007-2010 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
@@ -42,9 +42,10 @@ If a FILE is '-' or missing, read standard input.
 
 Report bugs to <bug-gzip@gnu.org>."
 
+st=0
 case $1 in
---help)    exec echo "$usage";;
---version) exec echo "$version";;
+--help)    echo "$usage" || st=2; exit $st;;
+--version) echo "$version" || st=2; exit $st;;
 esac
 
 exec zdiff --__cmp "$@"