Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH] feature_to_c.sh: Print help when passing no arguments
Date: Mon, 29 Feb 2016 18:30:00 -0000	[thread overview]
Message-ID: <1456770606-2944-1-git-send-email-simon.marchi@ericsson.com> (raw)

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/features/feature_to_c.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh
index 901eb0d..439611a 100755
--- a/gdb/features/feature_to_c.sh
+++ b/gdb/features/feature_to_c.sh
@@ -19,14 +19,14 @@
 # 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
-- 
2.5.1


             reply	other threads:[~2016-02-29 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 18:30 Simon Marchi [this message]
2016-03-04 11:35 ` Yao Qi
2016-03-04 15:06   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456770606-2944-1-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox