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.s...@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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/