Commit c3a762b8 authored by Pietro Fezzardi's avatar Pietro Fezzardi Committed by Alessandro Rubini

cmdline: added "-C <config>" option

This option sets configuration options from command line,
as specified in CONFIG_ITEM.
CONFIG_ITEM must be a valid configuration string, so you'll likely
need to quote it on the command line.

The semicolon can be used as a separator, to stick several
configuration items in the same argument.  This option can also be
used more than once on the same command line, to set different
parameters. If used twice to set the same parameter, the last value
overrides previous values -- and later config files, specified with
"-f" may override -C values.
parent 22e1ca8d
......@@ -73,10 +73,16 @@ int ppsi_main(int argc, char **argv)
return 0;
}
/* We can't parse a config file (no system calls, /me is lazy) */
/* We can't parse a config file or string (no system calls, /me is lazy) */
int pp_config_file(struct pp_globals *ppg, int force, char *fname)
{
pp_printf("No support for config file: can't read \"%s\"\n",
fname);
return -1;
}
int pp_config_string(struct pp_globals *ppg, char *s)
{
pp_printf("No support for config options: can't parse \"%s\"\n", s);
return -1;
}
......@@ -23,6 +23,8 @@ static struct cmd_line_opt cmd_line_list[] = {
//{"-d", "display stats"},
//{"-D", "display stats in .csv format"},
//{"-R", "record data about sync packets in a file"},
{"-C CONFIG_ITEM", "set configuration options as stated in CONFIG_ITEM\n\t"
"CONFIG_ITEM must be a valid config string, enclosed by \" \""},
{"-f FILE", "read configuration file"},
{"-V", "run in verbose mode"},
{"-d STRING", "diagnostic level (see diag-macros.h)"},
......@@ -115,6 +117,9 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
a = argv[++i];
pp_global_flags = pp_diag_parse(a);
break;
case 'C':
pp_config_string(ppg, argv[++i]);
break;
case 'f':
pp_config_file(ppg, 1, argv[++i]);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment