summary refs log tree commit diff
path: root/bin/catsh
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
commite930ec711fbb7029447efb960de2aa721fd9d51a (patch)
treea83a5c86ddb988a955cb815e3ba8401956c3f094 /bin/catsh
parentClean up catsh config (diff)
downloadsrc-e930ec711fbb7029447efb960de2aa721fd9d51a.tar.gz
src-e930ec711fbb7029447efb960de2aa721fd9d51a.zip
Factor out XDG_CONFIG_HOME and XDG_DATA_HOME
Diffstat (limited to 'bin/catsh')
-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