summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 184b2f354..379f9f738 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -766,6 +766,23 @@ fprintdir(char *s, FILE *f)
     }
 }
 
+/*
+ * Substitute a directory using a name.
+ * If there is none, return the original argument.
+ */
+
+/**/
+char *
+substnamedir(char *s)
+{
+    Nameddir d = finddir(s);
+
+    if (!d)
+	return s;
+    return zhtricat("~", d->node.nam, s + strlen(d->dir));
+}
+
+
 /* Returns the current username.  It caches the username *
  * and uid to try to avoid requerying the password files *
  * or NIS/NIS+ database.                                 */