All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] configure: Exit with code 0 with --help
@ 2014-04-18  6:25 Fam Zheng
  2014-04-18  6:32 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2014-04-18  6:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, mjt

There are two paths to show help and exit, one is with "-h" or "--help",
one is with invalid options.

Only "exit 1" with the latter case.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 configure | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 69b9f56..b195efe 100755
--- a/configure
+++ b/configure
@@ -1087,7 +1087,10 @@ for opt do
   ;;
   --enable-quorum) quorum="yes"
   ;;
-  *) echo "ERROR: unknown option $opt"; show_help="yes"
+  *)
+      echo "ERROR: unknown option $opt"
+      show_help="yes"
+      exit_code=1
   ;;
   esac
 done
@@ -1353,7 +1356,7 @@ Advanced options (experts only):
 
 NOTE: The object files are built at the place where configure is launched
 EOF
-exit 1
+exit $exit_code
 fi
 
 # Now we have handled --enable-tcg-interpreter and know we're not just
-- 
1.9.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-trivial] [PATCH] configure: Exit with code 0 with --help
  2014-04-18  6:25 [Qemu-trivial] [PATCH] configure: Exit with code 0 with --help Fam Zheng
@ 2014-04-18  6:32 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2014-04-18  6:32 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-trivial, qemu-devel

18.04.2014 10:25, Fam Zheng wrote:
> There are two paths to show help and exit, one is with "-h" or "--help",
> one is with invalid options.
> 
> Only "exit 1" with the latter case.

I'd rather put `exit 1' right in invalid option case, instead of jumping
to help.  Because help output is huge, and it is often difficult to see
the error message.   At max, at the error case, the script can output
something like, `for a list of valid options, run $0 --help'.

Here and for qemu-img case.

Do you not agree?

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-18  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-18  6:25 [Qemu-trivial] [PATCH] configure: Exit with code 0 with --help Fam Zheng
2014-04-18  6:32 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.