Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Auto-detect vt number; fallback to .xirc if no WM provided |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
189ff1e73a25bdb2f73a43f792b645b8 |
User & Date: | jmcclure 2018-01-04 03:03:07 |
Context
2018-01-04
| ||
03:15 | Added links to current files check-in: 8a7c808dd8 user: jmcclure tags: trunk | |
03:03 | Auto-detect vt number; fallback to .xirc if no WM provided check-in: 189ff1e73a user: jmcclure tags: trunk | |
2018-01-03
| ||
21:15 | Added info check-in: 00626f0bb2 user: jmcclure tags: trunk | |
Changes
Changes to xi.c.
1 2 3 | /* xi.c * ---- * Minimalist Xinit replacement | | | 1 2 3 4 5 6 7 8 9 10 11 | /* xi.c * ---- * Minimalist Xinit replacement * USAGE: xi /path/to/wm * ---- * * Copyright (c) 2017 Jesse McClure <code@jessemcclure.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. |
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <unistd.h> #include <sys/wait.h> #include <linux/limits.h> static volatile int xrunning = 0; void handler(int sig) { if (sig == SIGUSR1) xrunning = 1; if (sig == SIGCHLD || sig == SIGTERM) xrunning = 0; } | > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <linux/limits.h> #include <linux/vt.h> static volatile int xrunning = 0; void handler(int sig) { if (sig == SIGUSR1) xrunning = 1; if (sig == SIGCHLD || sig == SIGTERM) xrunning = 0; } |
︙ | ︙ | |||
54 55 56 57 58 59 60 | setenv("XAUTHORITY", xauth, 1); setenv("DISPLAY", dpy, 1); execlp(wm, wm, NULL); _exit(4); } int main(int argc, const char **argv) { | | > | | | < < | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | setenv("XAUTHORITY", xauth, 1); setenv("DISPLAY", dpy, 1); execlp(wm, wm, NULL); _exit(4); } int main(int argc, const char **argv) { struct vt_stat vtstat; if (ioctl(0, VT_GETSTATE, &vtstat)) { perror("get_vt"); return 1; } char dpy[] = { ':', '0' + vtstat.v_active, 0 }; char tty[] = { 'v', 't', '0' + vtstat.v_active, 0 }; struct sigaction sa = { 0, 0, 0, 0, 0 }; sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGUSR1, &sa, NULL); sigaction(SIGCHLD, &sa, NULL); sigaction(SIGTERM, &sa, NULL); int xpid = server(dpy, tty); while (!xrunning) pause(); int cpid = client(dpy, (argc > 1 ? argv[1] : ".xirc" )); while (xrunning) pause(); kill(cpid, SIGTERM); waitpid(cpid, NULL, 0); kill(xpid, SIGTERM); waitpid(xpid, NULL, 0); return 0; } |