Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1247528
| From | Yunlong Song <yunlong.song@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 3/3] perf help: Change the usage's stdout to stderr for consistency |
| Date | 2015-10-15 09:40 +0200 |
| Message-ID | <qjLiO-85x-11@gated-at.bofh.it> (permalink) |
| References | <qjkLE-2wS-7@gated-at.bofh.it> <qjLiO-85x-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The builtins use stderr everywhere to show the usage info when the opts
or cmds are incorrectly used, for consistency, change perf's stdout to
stderr to show its usage info when it is incorrectly (including no
command) used.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
tools/perf/builtin-help.c | 9 +++++----
tools/perf/perf.c | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 09b0368..8cee457 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -287,10 +287,11 @@ void list_common_cmds_help(void)
longest = strlen(common_cmds[i].name);
}
- puts(" The most commonly used perf commands are:");
+ fputs(" The most commonly used perf commands are:\n", stderr);
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
- printf(" %-*s ", longest, common_cmds[i].name);
- puts(common_cmds[i].help);
+ fprintf(stderr, " %-*s ", longest, common_cmds[i].name);
+ fputs(common_cmds[i].help, stderr);
+ fputc('\n', stderr);
}
}
@@ -472,7 +473,7 @@ int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argv[0]) {
usage_with_options_return(perf_usage, perf_options);
list_common_cmds_help();
- printf("\n %s\n\n", perf_more_info_string);
+ fprintf(stderr, "\n %s\n\n", perf_more_info_string);
return 0;
}
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 3bcaa10d..54ef361 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -584,7 +584,7 @@ int main(int argc, const char **argv)
/* The user didn't specify a command; give them help */
usage_with_options_return(perf_usage, perf_options);
list_common_cmds_help();
- printf("\n %s\n\n", perf_more_info_string);
+ fprintf(stderr, "\n %s\n\n", perf_more_info_string);
goto out;
}
cmd = argv[0];
--
1.8.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-13 17:00 +0200
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Ramkumar Ramachandra <artagnon@gmail.com> - 2015-10-13 17:30 +0200
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Yunlong Song <yunlong.song@huawei.com> - 2015-10-14 04:30 +0200
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-14 05:20 +0200
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Namhyung Kim <namhyung@kernel.org> - 2015-10-14 05:50 +0200
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Yunlong Song <yunlong.song@huawei.com> - 2015-10-14 15:40 +0200
Re: [PATCH 1/1] perf:Adding --list-opts to usage string Yunlong Song <yunlong.song@huawei.com> - 2015-10-15 09:20 +0200
[PATCH] perf help: Add options description to 'perf -h' Yunlong Song <yunlong.song@huawei.com> - 2015-10-14 15:50 +0200
[PATCH v2 2/3] perf help: Change 'usage' to 'Usage' for consistency Yunlong Song <yunlong.song@huawei.com> - 2015-10-15 09:40 +0200
[PATCH v2 1/3] perf help: Add options description to 'perf -h' Yunlong Song <yunlong.song@huawei.com> - 2015-10-15 09:40 +0200
[PATCH v2 3/3] perf help: Change the usage's stdout to stderr for consistency Yunlong Song <yunlong.song@huawei.com> - 2015-10-15 09:40 +0200
[PATCH v2 0/3] perf help: Make perf's help consistent with other builtins Yunlong Song <yunlong.song@huawei.com> - 2015-10-15 09:40 +0200
csiph-web