lkml.org 
[lkml]   [2015]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/3] perf help: Change the usage's stdout to stderr for consistency
Date
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


\
 
 \ /
  Last update: 2015-10-15 10:01    [W:0.162 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site