Re: [PATCH 1/2] perf tools: Add 'perf-config' command

From: Namhyung Kim
Date: Sat Apr 18 2015 - 23:36:25 EST


On Sat, Apr 18, 2015 at 07:14:06PM +0900, Taewoong Song wrote:
> > On Apr 13, 2015, at 3:16 PM, Namhyung Kim <namhyung@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/