lkml.org 
[lkml]   [2015]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] perf tools: Add 'perf-config' command
On Sat, Apr 18, 2015 at 07:14:06PM +0900, Taewoong Song wrote:
> > On Apr 13, 2015, at 3:16 PM, Namhyung Kim <namhyung@kernel.org> 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 <file> use given config file
> --blob <blob-id> 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


\
 
 \ /
  Last update: 2015-04-19 06:01    [W:0.094 / U:9.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site