summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-04-18 22:01:42 -0400
committerJune McEnroe <june@causal.agency>2019-04-18 22:01:42 -0400
commit002a5c249926f86ceebfb6ab57eeaa4aef9243d0 (patch)
tree3f2275629a709e6205110082c80e392895de2582 /bin
parentClean up catsh config (diff)
downloadsrc-002a5c249926f86ceebfb6ab57eeaa4aef9243d0.tar.gz
src-002a5c249926f86ceebfb6ab57eeaa4aef9243d0.zip
Factor out XDG_CONFIG_HOME and XDG_DATA_HOME
Diffstat (limited to '')
-rw-r--r--bin/catsh/var.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/bin/catsh/var.c b/bin/catsh/var.c
index 4e486e64..f11ff8b7 100644
--- a/bin/catsh/var.c
+++ b/bin/catsh/var.c
@@ -107,18 +107,15 @@ struct var vdisvfork;
 struct localvar *localvars;
 int forcelocal;
 
+#define XDG_CONFIG_HOME "${XDG_CONFIG_HOME:-${HOME}/.config}"
+#define XDG_DATA_HOME "${XDG_DATA_HOME:-${HOME}/.local/share}"
+
 static const struct varinit varinit[] = {
-	{
-		&venv, 0,
-		"ENV=${XDG_CONFIG_HOME:-${HOME}/.config}/catsh/env.sh",
-		NULL,
-	},
+	{ &venv, 0, "ENV=" XDG_CONFIG_HOME "/catsh/env.sh",
+	  NULL },
 #ifndef NO_HISTORY
-	{
-		&vhistfile, 0,
-		"HISTFILE=${XDG_DATA_HOME:-${HOME}/.local/share}/catsh/history",
-		sethistfile,
-	},
+	{ &vhistfile, 0, "HISTFILE=" XDG_DATA_HOME "/catsh/history",
+	  sethistfile },
 	{ &vhistsize,	VUNSET,				"HISTSIZE=",
 	  sethistsize },
 #endif