X-Git-Url: https://git.xinqibao.xyz/st.git/blobdiff_plain/1f24bde82b19912c080fbb4a0b153a248cd6c6ea..3518dba2a5fb57f601b74528ddeb67f173e4024b:/x.c?ds=sidebyside

diff --git a/x.c b/x.c
index c484dfc..f660ca3 100644
--- a/x.c
+++ b/x.c
@@ -15,6 +15,7 @@
 #include <X11/Xft/Xft.h>
 #include <X11/XKBlib.h>
 
+static char *argv0;
 #include "arg.h"
 
 #define Glyph Glyph_
@@ -87,8 +88,10 @@ static void xdrawglyph(Glyph, int, int);
 static void xclear(int, int, int, int);
 static void xdrawcursor(void);
 static int xgeommasktogravity(int);
+static void xinit(void);
 static int xloadfont(Font *, FcPattern *);
 static void xunloadfont(Font *);
+static void xsetenv(void);
 
 static void expose(XEvent *);
 static void visibility(XEvent *);
@@ -109,6 +112,9 @@ static void selcopy(Time);
 static void getbuttoninfo(XEvent *);
 static void mousereport(XEvent *);
 
+static void run(void);
+static void usage(void);
+
 static void (*handler[LASTEvent])(XEvent *) = {
 	[KeyPress] = kpress,
 	[ClientMessage] = cmessage,
@@ -1487,12 +1493,6 @@ xbell(int vol)
 	XkbBell(xw.dpy, xw.win, vol, (Atom)NULL);
 }
 
-unsigned long
-xwinid(void)
-{
-	return xw.win;
-}
-
 void
 focus(XEvent *ev)
 {
@@ -1703,6 +1703,19 @@ run(void)
 	}
 }
 
+void
+usage(void)
+{
+	die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
+	    " [-n name] [-o file]\n"
+	    "          [-T title] [-t title] [-w windowid]"
+	    " [[-e] command [args ...]]\n"
+	    "       %s [-aiv] [-c class] [-f font] [-g geometry]"
+	    " [-n name] [-o file]\n"
+	    "          [-T title] [-t title] [-w windowid] -l line"
+	    " [stty_args ...]\n", argv0, argv0);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -1765,6 +1778,7 @@ run:
 	XSetLocaleModifiers("");
 	tnew(MAX(cols, 1), MAX(rows, 1));
 	xinit();
+	xsetenv();
 	selinit();
 	run();