diff options
author | Krisztian Litkey <krisztian.litkey@nokia.com> | 2010-06-21 18:39:32 +0300 |
---|---|---|
committer | Krisztian Litkey <krisztian.litkey@nokia.com> | 2010-06-21 18:39:32 +0300 |
commit | 6df9bf0d08af2e87dc6d0eceeb2bccb4cac8964a (patch) | |
tree | 74b96ae01e2a17078fa6b5bdb91d55e7e74464a9 | |
parent | 646638a1d8d5e7eccbb4b8488d8857231d34cbaf (diff) |
Allow non-hardcoded classes if the -u option is given.
-rw-r--r-- | client/client.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/client/client.c b/client/client.c index fb93e1d..33ddbf1 100644 --- a/client/client.c +++ b/client/client.c @@ -30,6 +30,7 @@ typedef struct { resmsg_rset_t rset; int verbose; DBusBusType bustype; + int allow_unknown; } conf_t; typedef struct { @@ -665,7 +666,7 @@ static void print_message(char *fmt, ...) static void usage(int exit_code) { - printf("usage: %s [-h] [-t] [-v] [-d bus-type] [-f mode-values]" + printf("usage: %s [-h] [-t] [-v] [-u] [-d bus-type] [-f mode-values]" "[-o optional-resources] [-s shared-resources -m shared-mask] " "class all-resources\n", exe_name); @@ -673,6 +674,7 @@ static void usage(int exit_code) printf("\t h\tprint this help message and exit\n"); printf("\t t\ttrace messages\n"); printf("\t v\tverbose printouts\n"); + printf("\t u\tallow 'unknown' (ie. other than listed below) classes"); printf("\t d\tbus-type. Either 'system' or 'session'\n"); printf("\t f\tmode values. See 'modes' below for the " "\n\t\tsyntax of <mode-values>\n"); @@ -723,19 +725,20 @@ static void parse_options(int argc, char **argv) config.trace = FALSE; config.id = 1; - while ((option = getopt(argc, argv, "htvd:f:s:o:m:")) != -1) { + while ((option = getopt(argc, argv, "htvud:f:s:o:m:")) != -1) { switch (option) { - case 'h': usage(0); break; - case 't': config.trace = TRUE; break; - case 'v': config.verbose = TRUE; break; - case 'd': config.bustype = parse_bustype(optarg, 1); break; - case 'f': config.mode = parse_mode_values(optarg, 1); break; - case 'o': config.rset.opt = parse_resource_list(optarg, 1); break; - case 's': config.rset.share = parse_resource_list(optarg, 1); break; - case 'm': config.rset.mask = parse_resource_list(optarg, 1); break; - default: usage(EINVAL); break; + case 'h': usage(0); break; + case 't': config.trace = TRUE; break; + case 'v': config.verbose = TRUE; break; + case 'd': config.bustype = parse_bustype(optarg, 1); break; + case 'f': config.mode = parse_mode_values(optarg, 1); break; + case 'o': config.rset.opt = parse_resource_list(optarg, 1); break; + case 's': config.rset.share = parse_resource_list(optarg, 1); break; + case 'm': config.rset.mask = parse_resource_list(optarg, 1); break; + case 'u': config.allow_unknown = TRUE; break; + default: usage(EINVAL); break; } } @@ -770,7 +773,8 @@ static char *parse_class_string(char *str) strcmp(str, "game" ) && strcmp(str, "player" ) && strcmp(str, "event" ) && - strcmp(str, "background") ) + strcmp(str, "background") && + !config.allow_unknown ) { print_error("invalid class '%s'", str); } |