summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-12 13:05:54 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-12 13:05:54 +0200
commitabc2efa5cc903071602bf78440dde3e6c8ebe776 (patch)
tree4695482c1a1cca23db2aab4285840d19ffe549a4
parent88f2e0d88c7571a0362cb864ce8b88242865aa39 (diff)
downloadtterm-master.tar.gz
Speed up xterm startHEADmaster
-rw-r--r--Makefile6
-rw-r--r--tterm.c7
-rw-r--r--u.c11
3 files changed, 19 insertions, 5 deletions
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 <X11/Xlib.h>
/* 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 <err.h>
+#include <unistd.h>
+
+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");
+}