From e930ec711fbb7029447efb960de2aa721fd9d51a Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 18 Apr 2019 22:01:42 -0400 Subject: Factor out XDG_CONFIG_HOME and XDG_DATA_HOME --- bin/catsh/var.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'bin/catsh') 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 -- cgit 1.4.1