From 6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Mon, 19 Jun 2017 20:52:50 +0200 Subject: misc: never use usage(stderr) Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier --- sys-utils/lsmem.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sys-utils/lsmem.c') diff --git a/sys-utils/lsmem.c b/sys-utils/lsmem.c index 891be36f7..4efd29632 100644 --- a/sys-utils/lsmem.c +++ b/sys-utils/lsmem.c @@ -363,8 +363,9 @@ static void read_basic_info(struct lsmem *lsmem) lsmem->have_nodes = 1; } -static void __attribute__((__noreturn__)) lsmem_usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; unsigned int i; fputs(USAGE_HEADER, out); @@ -449,7 +450,7 @@ int main(int argc, char **argv) lsmem->bytes = 1; break; case 'h': - lsmem_usage(stdout); + usage(); break; case 'J': lsmem->json = 1; @@ -493,8 +494,10 @@ int main(int argc, char **argv) } } - if (argc != optind) - lsmem_usage(stderr); + if (argc != optind) { + warnx(_("bad usage")); + errtryhelp(EXIT_FAILURE); + } if (lsmem->want_table + lsmem->want_summary == 0) errx(EXIT_FAILURE, _("options --{raw,json,pairs} and --summary=only are mutually exclusive")); -- cgit v1.2.3-55-g7522