diff options
| author | Namhyung Kim <namhyung@kernel.org> | 2015-10-25 00:49:27 +0900 | 
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-10-27 09:28:44 -0300 | 
| commit | c71183697250b356be6c7c1abc2e9a74073e1dca (patch) | |
| tree | 704044c1c38f9f0da738712b807fb01f201d3e59 /tools/perf/util/parse-options.c | |
| parent | 01b19455c08cc37d1c3ef174524278e84c92fec1 (diff) | |
perf tools: Introduce usage_with_options_msg()
Now usage_with_options() setup a pager before printing message so normal
printf() or pr_err() will not be shown.  The usage_with_options_msg()
can be used to print some help message before usage strings.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1445701767-12731-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-options.c')
| -rw-r--r-- | tools/perf/util/parse-options.c | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c index eeeed98eb26d..230e771407a3 100644 --- a/tools/perf/util/parse-options.c +++ b/tools/perf/util/parse-options.c @@ -760,6 +760,21 @@ void usage_with_options(const char * const *usagestr,  	exit(129);  } +void usage_with_options_msg(const char * const *usagestr, +			    const struct option *opts, const char *fmt, ...) +{ +	va_list ap; + +	exit_browser(false); + +	va_start(ap, fmt); +	strbuf_addv(&error_buf, fmt, ap); +	va_end(ap); + +	usage_with_options_internal(usagestr, opts, 0, NULL); +	exit(129); +} +  int parse_options_usage(const char * const *usagestr,  			const struct option *opts,  			const char *optstr, bool short_opt) | 
