conf: add --switchvt

--switchvt enables kmscon to automatically switch to the new VT that was
opened by kmscon. If this is the current VT, then this has obviously no
effect.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-03-23 17:42:39 +01:00
parent c8b247785c
commit 6d63b55d6f
2 changed files with 9 additions and 2 deletions

View File

@ -50,18 +50,20 @@ static void print_help()
"General Options:\n"
"\t-h, --help Print this help and exit\n"
"\t-v, --verbose Print verbose messages\n"
"\t --debug Enable debug mode\n",
"\t --debug Enable debug mode\n"
"\t-s, --switchvt Automatically switch to VT\n",
"kmscon");
}
int conf_parse_argv(int argc, char **argv)
{
int show_help = 0;
char short_options[] = ":hv";
char short_options[] = ":hvs";
struct option long_options[] = {
{ "help", no_argument, NULL, 'h' },
{ "verbose", no_argument, NULL, 'v' },
{ "debug", no_argument, &conf_global.debug, 1 },
{ "switchvt", no_argument, NULL, 's' },
{ NULL, 0, NULL, 0 },
};
int idx;
@ -85,6 +87,9 @@ int conf_parse_argv(int argc, char **argv)
case 'v':
conf_global.verbose = 1;
break;
case 's':
conf_global.switchvt = 1;
break;
case ':':
fprintf(stderr, "Missing argument for option -%c\n",
optopt);

View File

@ -49,6 +49,8 @@ struct conf_obj {
int debug;
/* enable verbose info messages */
int verbose;
/* enter new VT directly */
int switchvt;
};
extern struct conf_obj conf_global;