Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/options.c
- +++ b/options.c
- @@ -25,6 +25,7 @@
- /* builtin defaults */
- int tty = 1;
- +int fallback = 1;
- char session[256] = "/usr/bin/mutter --sm-disable";
- char username[256] = "meego";
- char dpinum[256] = "120";
- @@ -36,6 +37,7 @@ int x_session_only = 0;
- static struct option opts[] = {
- { "user", 1, NULL, 'u' },
- { "tty", 1, NULL, 't' },
- + { "fallback", 1, NULL, 'f' },
- { "session", 1, NULL, 's' },
- { "xsession", 0, NULL, 'x' },
- { "help", 0, NULL, 'h' },
- @@ -49,6 +51,7 @@ void usage(const char *name)
- printf("Usage: %s [OPTION...] [-- [session cmd] [session args]]\n", name);
- printf(" -u, --user Start session as specific username\n");
- printf(" -t, --tty Start session on alternative tty number\n");
- + printf(" -f, --fallback Revert to alternative tty number on session end\n");
- printf(" -s, --session Start a non-default session\n");
- printf(" -x, --xsession Start X apps inside an existing X session\n");
- printf(" -v, --verbose Display lots of output to the console\n");
- @@ -129,6 +132,8 @@ void get_options(int argc, char **argv)
- strncpy(username, val, 256);
- if (!strcmp(key, "tty"))
- tty = atoi(val);
- + if (!strcmp(key, "fallback"))
- + fallback = atoi(val);
- if (!strcmp(key, "session"))
- strncpy(session, val, 256);
- if (!strcmp(key, "dpi"))
- @@ -153,6 +158,9 @@ void get_options(int argc, char **argv)
- case 't':
- tty = atoi(optarg);
- break;
- + case 'f':
- + fallback = atoi(optarg);
- + break;
- case 's':
- strncpy(session, optarg, 256);
- break;
- @@ -188,7 +196,7 @@ void get_options(int argc, char **argv)
- open_log(!x_session_only ? LOGFILE : NULL);
- lprintf("uxlaunch v%s started%s.", VERSION, x_session_only ? " for x session only" : "" );
- - lprintf("user \"%s\", tty #%d, session \"%s\"", username, tty, session);
- + lprintf("user \"%s\", tty #%d, fallback #%d, session \"%s\"", username, tty, fallback, session);
- pass = getpwnam(username);
- if (!pass) {
- diff -rupN a/uxlaunch.c b/uxlaunch.c
- --- a/uxlaunch.c
- +++ b/uxlaunch.c
- @@ -98,7 +98,7 @@ int main(int argc, char **argv)
- setup_efs();
- - set_tty();
- + set_tty(tty);
- start_oom_task();
- diff -rupN a/uxlaunch.h b/uxlaunch.h
- --- a/uxlaunch.h
- +++ b/uxlaunch.h
- @@ -18,6 +18,7 @@ extern Xauth x_auth;
- extern char user_xauth_path[];
- extern int tty;
- +extern int fallback;
- extern char session[];
- extern char username[];
- extern char dpinum[];
- @@ -35,7 +36,7 @@ extern void setup_pam_session(void);
- extern void close_pam_session(void);
- extern void switch_to_user(void);
- extern void setup_user_environment(void);
- -extern void set_tty(void);
- +extern void set_tty(int);
- extern void setup_xauth(void);
- extern void start_X_server(void);
- extern void wait_for_X_signal(void);
- diff -rupN a/xserver.c b/xserver.c
- --- a/xserver.c
- +++ b/xserver.c
- @@ -56,7 +56,7 @@ static volatile int exiting = 0;
- * TIOCLINUX will tell us which console is currently showing
- * for this purpose.
- */
- -void set_tty(void)
- +void set_tty(int newtty)
- {
- int fd;
- struct vt_stat v;
- @@ -76,13 +76,13 @@ void set_tty(void)
- return;
- }
- - if (v.v_active != tty) {
- - if (ioctl(fd, VT_ACTIVATE, tty))
- + if (v.v_active != newtty) {
- + if (ioctl(fd, VT_ACTIVATE, newtty))
- lprintf("VT_ACTIVATE failed");
- }
- close(fd);
- - snprintf(displaydev, PATH_MAX, "/dev/tty%d", tty);
- + snprintf(displaydev, PATH_MAX, "/dev/tty%d", newtty);
- lprintf("Using %s as display device", displaydev);
- }
- @@ -409,6 +409,8 @@ void wait_for_X_exit(void)
- void set_text_mode(void)
- {
- + set_tty(fallback);
- +
- int fd;
- lprintf("Setting console mode to KD_TEXT");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement