[hackers] [st][PATCH 01/23] move usage and argv0 into x.c

From: Devin J. Pohly <djpohly_AT_gmail.com>
Date: Sun, 24 Sep 2017 16:11:23 -0500

xinit is now internal to x.c
---
 st.c  | 15 ---------------
 st.h  |  2 --
 win.h |  2 --
 x.c   | 21 +++++++++++++++++++--
 4 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/st.c b/st.c
index 7c7ddff..f1227ea 100644
--- a/st.c
+++ b/st.c
_AT_@ -28,8 +28,6 @@
 #include <X11/cursorfont.h>
 #include <X11/Xft/Xft.h>
 
-char *argv0;
-
 #define Glyph Glyph_
 #define Font Font_
 
_AT_@ -2691,16 +2689,3 @@ cresize(int width, int height)
 	tresize(col, row);
 	xresize(col, row);
 }
-
-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);
-}
diff --git a/st.h b/st.h
index 44d4938..28a751d 100644
--- a/st.h
+++ b/st.h
_AT_@ -214,8 +214,6 @@ size_t utf8encode(Rune, char *);
 void *xmalloc(size_t);
 char *xstrdup(char *);
 
-void usage(void);
-
 /* Globals */
 extern TermWindow win;
 extern Term term;
diff --git a/win.h b/win.h
index 428111c..7b614eb 100644
--- a/win.h
+++ b/win.h
_AT_@ -9,13 +9,11 @@ typedef XftGlyphFontSpec GlyphFontSpec;
 
 void draw(void);
 void drawregion(int, int, int, int);
-void run(void);
 
 void xbell(int);
 void xclipcopy(void);
 void xclippaste(void);
 void xhints(void);
-void xinit(void);
 void xloadcols(void);
 int xsetcolorname(int, const char *);
 void xloadfonts(char *, double);
diff --git a/x.c b/x.c
index 191e5dc..d68261c 100644
--- a/x.c
+++ b/x.c
_AT_@ -15,11 +15,12 @@
 #include <X11/Xft/Xft.h>
 #include <X11/XKBlib.h>
 
-#include "arg.h"
-
 #define Glyph Glyph_
 #define Font Font_
 
+static char *argv0;
+
+#include "arg.h"
 #include "win.h"
 #include "st.h"
 
_AT_@ -89,6 +90,7 @@ static void xdrawcursor(void);
 static int xgeommasktogravity(int);
 static int xloadfont(Font *, FcPattern *);
 static void xunloadfont(Font *);
+static void xinit(void);
 
 static void expose(XEvent *);
 static void visibility(XEvent *);
_AT_@ -108,6 +110,8 @@ static void selrequest(XEvent *);
 static void selcopy(Time);
 static void getbuttoninfo(XEvent *);
 static void mousereport(XEvent *);
+static void usage(void);
+static void run(void);
 
 static void (*handler[LASTEvent])(XEvent *) = {
 	[KeyPress] = kpress,
_AT_@ -1701,6 +1705,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[])
 {
-- 
2.14.1
Received on Sun Sep 24 2017 - 23:11:23 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:24:26 CEST