[hackers] [st][PATCH 17/23] Move config.h include from st.c to x.c

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

---
 config.def.h | 12 ++++++------
 st.c         | 18 ------------------
 st.h         | 11 +++++++++++
 x.c          | 11 +++++++++++
 4 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/config.def.h b/config.def.h
index 18cb31c..26c4e51 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -16,12 +16,12 @@ int borderpx = 2;
  * 4: value of shell in /etc/passwd
  * 5: value of shell in config.h
  */
-static char shell[] = "/bin/sh";
-static char *utmp = NULL;
-static char stty_args[] = "stty raw pass8 nl -echo -iexten -cstopb 38400";
+char *shell = "/bin/sh";
+char *utmp = NULL;
+char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
 
 /* identification sequence returned in DA and DECID */
-static char vtiden[] = "\033[?6c";
+char *vtiden = "\033[?6c";
 
 /* Kerning / character bounding-box multipliers */
 float cwscale = 1.0;
_AT_@ -32,7 +32,7 @@ float chscale = 1.0;
  *
  * More advanced example: " `'\"()[]{}"
  */
-static char worddelimiters[] = " ";
+char *worddelimiters = " ";
 
 /* selection timeouts (in milliseconds) */
 unsigned int doubleclicktimeout = 300;
_AT_@ -80,7 +80,7 @@ char termname[] = "st-256color";
  *
  *	stty tabs
  */
-static unsigned int tabspaces = 8;
+unsigned int tabspaces = 8;
 
 /* Terminal colors (16 first used in escape sequence) */
 const char *colorname[] = {
diff --git a/st.c b/st.c
index 00214d3..ef2d0e4 100644
--- a/st.c
+++ b/st.c
_AT_@ -107,16 +107,6 @@ typedef struct {
 	int narg;              /* nb of args */
 } STREscape;
 
-/* function definitions used in config.h */
-static void numlock(const Arg *);
-static void printsel(const Arg *);
-static void printscreen(const Arg *) ;
-static void toggleprinter(const Arg *);
-static void sendbreak(const Arg *);
-
-/* config.h for applying patches and the configuration. */
-#include "config.h"
-
 static void execsh(void);
 static void stty(void);
 static void sigchld(int);
_AT_@ -200,14 +190,6 @@ static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
 static Rune utfmin[UTF_SIZ + 1] = {       0,    0,  0x80,  0x800,  0x10000};
 static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
 
-/* config.h array lengths */
-size_t colornamelen = LEN(colorname);
-size_t mshortcutslen = LEN(mshortcuts);
-size_t shortcutslen = LEN(shortcuts);
-size_t mappedkeyslen = LEN(mappedkeys);
-size_t keylen = LEN(key);
-size_t selmaskslen = LEN(selmasks);
-
 ssize_t
 xwrite(int fd, const char *s, size_t len)
 {
diff --git a/st.h b/st.h
index 5bd8a01..8cdacfe 100644
--- a/st.h
+++ b/st.h
_AT_@ -201,6 +201,11 @@ void ttysend(char *, size_t);
 void ttywrite(const char *, size_t);
 
 void resettitle(void);
+void numlock(const Arg *);
+void printsel(const Arg *);
+void printscreen(const Arg *);
+void toggleprinter(const Arg *);
+void sendbreak(const Arg *);
 
 void selclear(void);
 
_AT_@ -236,6 +241,11 @@ extern float cwscale;
 extern float chscale;
 extern unsigned int doubleclicktimeout;
 extern unsigned int tripleclicktimeout;
+extern char *shell;
+extern char *utmp;
+extern char *stty_args;
+extern char *vtiden;
+extern char *worddelimiters;
 extern int allowaltscreen;
 extern unsigned int xfps;
 extern unsigned int actionfps;
_AT_@ -245,6 +255,7 @@ extern unsigned int blinktimeout;
 extern char termname[];
 extern const char *colorname[];
 extern size_t colornamelen;
+extern unsigned int tabspaces;
 extern unsigned int defaultfg;
 extern unsigned int defaultbg;
 extern unsigned int defaultcs;
diff --git a/x.c b/x.c
index c8660e3..4bac345 100644
--- a/x.c
+++ b/x.c
_AT_@ -28,6 +28,9 @@ static char *argv0;
 /* constants */
 #define ISO14755CMD		"dmenu -w %lu -p codepoint: </dev/null"
 
+/* config.h for applying patches and the configuration. */
+#include "config.h"
+
 /* macros */
 #define NUMMAXLEN(x)		((int)(sizeof(x) * 2.56 + 0.5) + 1)
 #define TRUERED(x)		(((x) & 0xff0000) >> 8)
_AT_@ -189,6 +192,14 @@ static double defaultfontsize = 0;
 
 static int oldbutton = 3; /* button event on startup: 3 = release */
 
+/* config.h array lengths */
+size_t colornamelen = LEN(colorname);
+size_t mshortcutslen = LEN(mshortcuts);
+size_t shortcutslen = LEN(shortcuts);
+size_t mappedkeyslen = LEN(mappedkeys);
+size_t keylen = LEN(key);
+size_t selmaskslen = LEN(selmasks);
+
 int
 x2col(int x)
 {
-- 
2.14.1
Received on Sun Sep 24 2017 - 23:11:39 CEST

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