From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754766AbbJOHfl (ORCPT ); Thu, 15 Oct 2015 03:35:41 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:6794 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbbJOHfi (ORCPT ); Thu, 15 Oct 2015 03:35:38 -0400 From: Yunlong Song To: , , , CC: , , , , , , , Subject: [PATCH v2 3/3] perf help: Change the usage's stdout to stderr for consistency Date: Thu, 15 Oct 2015 15:39:52 +0800 Message-ID: <1444894792-2338-4-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1444894792-2338-1-git-send-email-yunlong.song@huawei.com> References: <20151014031043.GA3775@kernel.org> <1444894792-2338-1-git-send-email-yunlong.song@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.110.52.30] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.561F5724.0029,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6659b232c7e7e62c70f199803435e233 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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