From 6d63b55d6f7b3e4ea0b4f28becc1fb4f308a1093 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 23 Mar 2012 17:42:39 +0100 Subject: [PATCH] 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 --- src/conf.c | 9 +++++++-- src/conf.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/conf.c b/src/conf.c index 0476cdb..b84f592 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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); diff --git a/src/conf.h b/src/conf.h index d2b36da..8d221b5 100644 --- a/src/conf.h +++ b/src/conf.h @@ -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;