feature_to_c.sh: Print help when passing no arguments
authorSimon Marchi <simon.marchi@ericsson.com>
Fri, 4 Mar 2016 15:03:06 +0000 (10:03 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 4 Mar 2016 15:03:06 +0000 (10:03 -0500)
I found that odd that passing no arguments to feature_to_c.sh produces
this:

$ ./feature_to_c.sh
./feature_to_c.sh: 23: shift: can't shift that many

but passing one argument shows the help:

$ ./feature_to_c.sh hello
Usage: ./feature_to_c.sh OUTPUTFILE INPUTFILE...

This patch changes the script to show the help in both cases.

gdb/ChangeLog:

* features/feature_to_c.sh: Print the help when passing no
argument.

gdb/ChangeLog
gdb/features/feature_to_c.sh

index b94fcb1401621fca6195cf8424ae03cb3fc90bd5..45c4c1d52e9a30dcd1909fa394d32022a28ca23c 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-04  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * features/feature_to_c.sh: Print the help when passing no
+       argument.
+
 2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>
 
        * MAINTAINERS (Write After Approval): Add Bernhard Heckel.
index 901eb0dce53f2751794a744a1d28a7ca63dcf82f..439611a552b43c8b0e36b589c8101a78e69ccd5d 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-output=$1
-shift
-
-if test -z "$output" || test -z "$1"; then
+if test -z "$1" || test -z "$2"; then
   echo "Usage: $0 OUTPUTFILE INPUTFILE..."
   exit 1
 fi
 
+output=$1
+shift
+
 if test -e "$output"; then
   echo "Output file \"$output\" already exists; refusing to overwrite."
   exit 1