From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753282AbbDSDf4 (ORCPT ); Sat, 18 Apr 2015 23:35:56 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:35887 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751984AbbDSDfy (ORCPT ); Sat, 18 Apr 2015 23:35:54 -0400 Date: Sun, 19 Apr 2015 12:34:48 +0900 From: Namhyung Kim To: Taewoong Song Cc: Arnaldo Carvalho de Melo , "linux-kernel@vger.kernel.org" , jolsa@redhat.com Subject: Re: [PATCH 1/2] perf tools: Add 'perf-config' command Message-ID: <20150419033448.GB10169@danjae.kornet> References: <1428849889-14145-1-git-send-email-treeze.taeung@gmail.com> <20150413061626.GF23913@sejong> <70EA4387-5059-4026-8819-039474865EEE@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <70EA4387-5059-4026-8819-039474865EEE@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 18, 2015 at 07:14:06PM +0900, Taewoong Song wrote: > > On Apr 13, 2015, at 3:16 PM, Namhyung Kim wrote: > > On Sun, Apr 12, 2015 at 11:44:48PM +0900, Taeung Song wrote: > >> +static void check_argc(int argc, int limit) > >> +{ > >> + if (argc >= limit && argc <= limit) > >> + return; > >> + error("wrong number of arguments"); > >> + usage_with_options(config_usage, config_options); > >> +} > > > > I don't know why this is needed. The -a option won't need this and we > > can support to get/set any number of config items IMHO. > > > > I also think we can support to get/set any number of config items. > But I think that ‘—list’ or ‘—all’ can need to be checked to validate argument. > If work ‘git —list’ with other argument, error message can be printed like this. > > :> git config --list 134 > error: wrong number of arguments > usage: git config [options] > > Config file location > --global use global config file > --system use system config file > --local use repository config file > -f, --file use given config file > --blob read config from given blob object > > …(omitted)… > > If don’t checking number of argument, we allow users to work a optio > ‘-a’ or ‘-l’ with other arguments which can be weor meaningless. > Did I misunderstand what you say? > Or is there other way to avoid this problem ? Then just check 'argc != 0' for -l or -a cases. The get/set won't need it IMHO. Thanks, Namhyung