From: David Ahern <dsahern@kernel.org>
To: Stephen Hemminger <stephen@networkplumber.org>, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next 3/7] misc: put help to stdout and usage to stderr
Date: Tue, 11 Aug 2026 08:23:17 -0600 [thread overview]
Message-ID: <8c0e9e58-df43-4c4f-a3c3-3f58264ff09a@kernel.org> (raw)
In-Reply-To: <20260807154306.111200-4-stephen@networkplumber.org>
On 8/7/26 9:42 AM, Stephen Hemminger wrote:
> diff --git a/misc/rtacct.c b/misc/rtacct.c
> index cd84b7f0..0e2c03af 100644
> --- a/misc/rtacct.c
> +++ b/misc/rtacct.c
> @@ -412,14 +412,13 @@ static int verify_forging(int fd)
> return -1;
> }
>
> -static void usage(void) __attribute__((noreturn));
> +static void usage(bool help) __attribute__((noreturn));
>
> -static void usage(void)
> +static void usage(bool help)
> {
> - fprintf(stderr,
> -"Usage: rtacct [ -h?vVzrnasd:t: ] [ ListOfRealms ]\n"
> - );
> - exit(-1);
> + fprintf(help ? stdout : stderr,
> + "Usage: rtacct [ -h?vVzrnasd:t: ] [ ListOfRealms ]\n");
> + exit(help ? 0 : 1);
> }
>
> int main(int argc, char *argv[])
> @@ -469,7 +468,7 @@ int main(int argc, char *argv[])
> case 'h':
> case '?':
> default:
> - usage();
> + usage(ch == 'h');
> }
> }
>
rtacct.c:415:19: error: unknown type name ‘bool’
415 | static void usage(bool help) __attribute__((noreturn));
| ^~~~
rtacct.c:29:1: note: ‘bool’ is defined in header ‘<stdbool.h>’; did you
forget to ‘#include <stdbool.h>’?
28 | #include "version.h"
+++ |+#include <stdbool.h>
29 |
rtacct.c:417:19: error: unknown type name ‘bool’
417 | static void usage(bool help)
| ^~~~
rtacct.c:417:19: note: ‘bool’ is defined in header ‘<stdbool.h>’; did
you forget to ‘#include <stdbool.h>’?
rtacct.c: In function ‘main’:
rtacct.c:471:25: warning: implicit declaration of function ‘usage’
[-Wimplicit-function-declaration]
471 | usage(ch == 'h');
| ^~~~~
make[1]: *** [Makefile:25: rtacct] Error 1
make: *** [Makefile:72: all] Error 2
next prev parent reply other threads:[~2026-08-11 14:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 15:42 [PATCH iproute2-next 0/7] cleanup help and exit codes Stephen Hemminger
2026-08-07 15:42 ` [PATCH iproute2-next 1/7] ip: follow Linux convention for help vs usage Stephen Hemminger
2026-08-07 15:42 ` [PATCH iproute2-next 2/7] ip/routel: follow help vs usage convention Stephen Hemminger
2026-08-07 15:42 ` [PATCH iproute2-next 3/7] misc: put help to stdout and usage to stderr Stephen Hemminger
2026-08-11 14:23 ` David Ahern [this message]
2026-08-07 15:42 ` [PATCH iproute2-next 4/7] netshaper: " Stephen Hemminger
2026-08-07 15:42 ` [PATCH iproute2-next 5/7] bridge: " Stephen Hemminger
2026-08-07 15:42 ` [PATCH iproute2-next 6/7] genl: " Stephen Hemminger
2026-08-07 15:42 ` [PATCH iproute2-next 7/7] tc: " Stephen Hemminger
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=8c0e9e58-df43-4c4f-a3c3-3f58264ff09a@kernel.org \
--to=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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