* [PATCH] feature_to_c.sh: Print help when passing no arguments
@ 2016-02-29 18:30 Simon Marchi
2016-03-04 11:35 ` Yao Qi
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2016-02-29 18:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] feature_to_c.sh: Print help when passing no arguments
2016-02-29 18:30 [PATCH] feature_to_c.sh: Print help when passing no arguments Simon Marchi
@ 2016-03-04 11:35 ` Yao Qi
2016-03-04 15:06 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2016-03-04 11:35 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
Simon Marchi <simon.marchi@ericsson.com> writes:
> gdb/ChangeLog:
>
> * features/feature_to_c.sh: Print the help when passing no
> argument.
Looks good to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] feature_to_c.sh: Print help when passing no arguments
2016-03-04 11:35 ` Yao Qi
@ 2016-03-04 15:06 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2016-03-04 15:06 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 16-03-04 06:35 AM, Yao Qi wrote:
> Simon Marchi <simon.marchi@ericsson.com> writes:
>
>> gdb/ChangeLog:
>>
>> * features/feature_to_c.sh: Print the help when passing no
>> argument.
>
> Looks good to me.
>
Pushed, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-04 15:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-29 18:30 [PATCH] feature_to_c.sh: Print help when passing no arguments Simon Marchi
2016-03-04 11:35 ` Yao Qi
2016-03-04 15:06 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).