From 56f6cf324ed881f237c3f1aa763da1f0d9a63b3f Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Fri, 23 Jul 2010 13:41:44 +0300 Subject: [PATCH] main.c: Add new command line options for parsing by process name Signed-off-by: Timo Kokkonen --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index f7fc6c2..75db469 100644 --- a/main.c +++ b/main.c @@ -25,11 +25,12 @@ void read_args(int argc, char *argv[], struct parse_opts *opts) int optind = 0, c; static struct option long_options[] = { { .val = 'p', .name = "pid", .has_arg = 1, }, + { .val = 'P', .name = "process", .has_arg = 1, }, { .val = 'm', .name = "map", .has_arg = 1, }, { .val = OPT_WITH_THREADS, .name = "with-threads" }, { .val = 'h', .name = "help", }, }; - char short_options[] = "p:m:h"; + char short_options[] = "p:P:m:h"; opts->parse_mask = 0; while (1) { @@ -45,6 +46,9 @@ void read_args(int argc, char *argv[], struct parse_opts *opts) opts->pid = atoi(optarg); opts->parse_mask |= PARSE_PID; break; + case 'P': + opts->parse_mask |= PARSE_PROCESS_NAME; + opts->name = optarg; case 'm': opts->parse_mask |= PARSE_MAP_NAME; opts->name = optarg; -- 2.44.0