From abc2efa5cc903071602bf78440dde3e6c8ebe776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 12 Jul 2021 13:05:54 +0200 Subject: Speed up xterm start --- Makefile | 6 +++--- tterm.c | 7 +++++-- u.c | 11 +++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 u.c diff --git a/Makefile b/Makefile index 9adada0..dd8a5b6 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ CFLAGS != pkg-config --cflags x11 LDFLAGS != pkg-config --libs x11 -CFLAGS += -O2 +CFLAGS += -O2 -Wall -pedantic -tterm: tterm.c +all: tterm u install: - install tterm /usr/local/bin + install tterm u /usr/local/bin diff --git a/tterm.c b/tterm.c index 6652aab..d752cd7 100644 --- a/tterm.c +++ b/tterm.c @@ -10,7 +10,7 @@ #include /* configuration */ -#define ARGV "xterm", "xterm", "-e", "/usr/local/bin/ksh", "-w", fifo +#define ARGV "xterm", "xterm", "-e", "u", "/usr/local/bin/ksh", "-w", fifo #define MAX_CMD 1000 #define MAX_LOOK 1000 @@ -66,7 +66,7 @@ cwdcpy(char *path) } int -main(int argc, char *argv[]) +main() { char *cwd, *cmd, *line, *fifo; FILE *fifofp; @@ -96,6 +96,9 @@ main(int argc, char *argv[]) pidatom = XInternAtom(display, "_NET_WM_PID", 0); if (pidatom == None) die("no _NET_WM_PID atom found\n"); + /* use ISO8859-1 encoding to speed up xterm start */ + setenv("LC_ALL", "en_US.ISO8859-1", 1); + /* start terminal */ if ((child = vfork()) == 0) { execlp(ARGV, NULL); diff --git a/u.c b/u.c new file mode 100644 index 0000000..ef69a37 --- /dev/null +++ b/u.c @@ -0,0 +1,11 @@ +#include +#include + +int +main(int argc, char *argv[]) +{ + /* Enable UTF-8 encoding in xterm. */ + write(0, "\033%G", 3); + execvp(argv[1], argv+1); + err(1, "execvp"); +} -- cgit v1.2.3