From: dgoulet@efficios.com (David Goulet)
Subject: [lttng-dev] [PATCH] help, list-commands, list-options yield normal exits
Date: Fri, 27 Jan 2012 10:56:02 -0500 [thread overview]
Message-ID: <4F22C912.6000701@efficios.com> (raw)
In-Reply-To: <3CA1A65C03C1A34C81BBC6272782E69680886D@valcartierex01.valcartier.drdc-rddc.gc.ca>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12-01-25 02:29 PM, Thibault, Daniel wrote:
> lttng-tools lttng.c check_sessiond(): Improve error messages
> check_args_no_sessiond(): Add "--list-commands" to the "no daemon" options
> parse_args(): --help, --list-commands and --list-options yield normal exits, not errors
> main(): punctuation in comment
> ------------------------------
> From f6b2ceac855df3312c09cbc14b0ff75fb33b19c8 Wed, 25 Jan 2012 14:22:53 -0500
> From: Daniel U. Thibault <daniel.thibault@drdc-rddc.gc.ca>
> Date: Wed, 25 Jan 2012 14:22:42 -0500
> Subject: [PATCH] help, list-commands, list-options yield normal exits
>
> diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
> index 36723be..4ffabee 100644
> --- a/src/bin/lttng/lttng.c
> +++ b/src/bin/lttng/lttng.c
> @@ -367,7 +367,7 @@
> if (opt_sessiond_path != NULL) {
> ret = access(opt_sessiond_path, F_OK | X_OK);
> if (ret < 0) {
> - ERR("No such file: %s", opt_sessiond_path);
> + ERR("No such file or access denied: %s", opt_sessiond_path);
Fixed
> goto end;
> }
> pathname = opt_sessiond_path;
> @@ -389,7 +389,7 @@
> ret = spawn_sessiond(pathname);
> free(alloc_pathname);
> if (ret < 0) {
> - ERR("Problem occurs when starting %s", pathname);
> + ERR("Problem occurred when starting %s", pathname);
Fixed
> goto end;
> }
> }
> @@ -411,7 +411,8 @@
> for (i = 0; i < argc; i++) {
> if ((strncmp(argv[i], "-h", sizeof("-h")) == 0) ||
> strncmp(argv[i], "--h", sizeof("--h")) == 0 ||
> - strncmp(argv[i], "--list-options", sizeof("--list-options")) == 0) {
> + strncmp(argv[i], "--list-options", sizeof("--list-options")) == 0 ||
> + strncmp(argv[i], "--list-commands", sizeof("--list-commands")) == 0) {
Yes! Fixed
> return 1;
> }
> }
> @@ -437,8 +438,8 @@
> while ((opt = getopt_long(argc, argv, "+hnvqg:", long_options, NULL)) != -1) {
> switch (opt) {
> case 'h':
> - usage(stderr);
> - goto error;
> + usage(stdout);
> + goto success;
I agree for the stdout since the user requested the --help. For the sake of code
"normalization", I used "goto end;" instead of success.
David
> case 'v':
> opt_verbose += 1;
> break;
> @@ -457,11 +458,11 @@
> case OPT_DUMP_OPTIONS:
> list_options(stdout);
> ret = 0;
> - goto error;
> + goto success;
> case OPT_DUMP_COMMANDS:
> list_commands(stdout);
> ret = 0;
> - goto error;
> + goto success;
> default:
> usage(stderr);
> goto error;
> @@ -498,7 +499,7 @@
> }
> goto error;
> }
> -
> +success:
> return 0;
>
> error:
> @@ -515,7 +516,7 @@
>
> progname = argv[0] ? argv[0] : "lttng";
>
> - /* For Mathieu Desnoyers aka Dr Tracing */
> + /* For Mathieu Desnoyers a.k.a. Dr. Tracing */
> if (strncmp(progname, "drtrace", 7) == 0 ||
> strncmp("compudj", getenv("USER"), 7) == 0) {
> MSG("%c[%d;%dmWelcome back Dr Tracing!%c[%dm\n", 27,1,33,27,0);
> ------------------------------
>
> Daniel U. Thibault
> R & D pour la d?fense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
> Syst?me de syst?mes (SdS) / System of Systems (SoS)
> Solutions informatiques et exp?rimentations (SIE) / Computing Solutions and Experimentations (CSE)
> 2459 Boul. Pie XI Nord
> Qu?bec, QC G3J 1X5
> CANADA
> Vox : (418) 844-4000 x4245
> Fax : (418) 844-4538
> NAC: 918V QSDJ
> Gouvernement du Canada / Government of Canada
> <http://www.valcartier.drdc-rddc.gc.ca/>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQEcBAEBAgAGBQJPIskSAAoJEELoaioR9I02tSAH/2WrStpd2yNhm/Ixkqrhvz81
W/DgyRbPa2lXT36Ygzd6Og8ZFXN1g/m6+GlcW3RmwGQVkwBK3cUFupn8k7xQ02PV
kVR9MK0zBEJkwS2W94XSWDS8M1MwF96N/KRxwiurQy5CpPu3jut80sPW09xKeLG0
F4eDOeNS6sgiPfOBDapMUBJimLbNCAU4rA4bVtX5jjRNMfLHJVWeKamCtFQkgsdX
175YfbA8O9rs8KGPJPjcKtF+49sFeWI7xtn15PYB8zs2mKUvdTVMFG5UQ2SoALS8
rt4hj7dcEpAXLjfsMQIxOLNCbCD7SUXwDNNeUEd2cmKWMCpQXzR19PXDL7zkA2s=
=akOr
-----END PGP SIGNATURE-----
parent reply other threads:[~2012-01-27 15:56 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <3CA1A65C03C1A34C81BBC6272782E69680886D@valcartierex01.valcartier.drdc-rddc.gc.ca>]
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=4F22C912.6000701@efficios.com \
--to=dgoulet@efficios.com \
/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