lkml.org 
[lkml]   [2014]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5] perf tools: Add support for exclusive option
Em Thu, Oct 23, 2014 at 02:05:08PM +0900, Masami Hiramatsu escreveu:
> (2014/10/23 0:15), Namhyung Kim wrote:
> > Some options cannot be used at the same time. To handle such options
> > add a new PARSE_OPT_EXCLUSIVE flag and show error message if more than
> > one of them is used.
>
> Looks useful for me :)
>
> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>
> I just have a comment below;
>
> > @@ -360,19 +378,21 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
> > }
> >
> > if (arg[1] != '-') {
> > - ctx->opt = arg + 1;
> > + ctx->opt = ++arg;
> > if (internal_help && *ctx->opt == 'h')
> > return usage_with_options_internal(usagestr, options, 0);
> > switch (parse_short_opt(ctx, options)) {
> > case -1:
> > - return parse_options_usage(usagestr, options, arg + 1, 1);
> > + return parse_options_usage(usagestr, options, arg, 1);
> > case -2:
> > goto unknown;
> > + case -3:
> > + goto exclusive;
>
> BTW, it may be a time to define return error codes.

Yeah, this thing looks unnecessarily complicated :-\


\
 
 \ /
  Last update: 2014-10-23 23:01    [W:0.068 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site