From patchwork Thu Feb 13 03:16:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 3642211 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 539189F390 for ; Thu, 13 Feb 2014 03:20:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6C8120149 for ; Thu, 13 Feb 2014 03:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 547DE20154 for ; Thu, 13 Feb 2014 03:20:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753164AbaBMDUP (ORCPT ); Wed, 12 Feb 2014 22:20:15 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:37785 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753141AbaBMDUM (ORCPT ); Wed, 12 Feb 2014 22:20:12 -0500 X-IronPort-AV: E=Sophos;i="4.95,836,1384272000"; d="scan'208";a="9517895" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 13 Feb 2014 11:16:17 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s1D3K49c002790 for ; Thu, 13 Feb 2014 11:20:05 +0800 Received: from localhost.localdomain ([10.167.226.111]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2014021311180578-1798838 ; Thu, 13 Feb 2014 11:18:05 +0800 From: Gui Hecheng To: linux-btrfs@vger.kernel.org Cc: Gui Hecheng Subject: [PATCH 1/4] btrfs-progs: use usage() to replace the warning msg on no-arg usage Date: Thu, 13 Feb 2014 11:16:35 +0800 Message-Id: <1392261398-6197-1-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/02/13 11:18:05, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/02/13 11:18:06, Serialize complete at 2014/02/13 11:18:06 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To be consistent with the other cmds, replace the warning msg with usage() when send/receive are used without any args. Signed-off-by: Gui Hecheng --- cmds-receive.c | 6 ++---- cmds-send.c | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmds-receive.c b/cmds-receive.c index cce37a7..72d9cc8 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -951,10 +951,8 @@ int cmd_receive(int argc, char **argv) } } - if (optind + 1 != argc) { - fprintf(stderr, "ERROR: receive needs path to subvolume\n"); - return 1; - } + if (optind + 1 != argc) + usage(cmd_receive_usage); tomnt = argv[optind]; diff --git a/cmds-send.c b/cmds-send.c index fc9a01e..e44770f 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -571,11 +571,8 @@ int cmd_send(int argc, char **argv) } } - if (optind == argc) { - fprintf(stderr, "ERROR: send needs path to snapshot\n"); - ret = 1; - goto out; - } + if (optind == argc) + usage(cmd_send_usage); if (outname != NULL) { send.dump_fd = creat(outname, 0600);