about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-06-11 20:08:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-06-11 20:08:01 +0000
commit64d431d98b022d186aa088a295d723b2ec727b84 (patch)
treeafbefc353e804ea6728d2b0b3eb823f005e80fcd /Src/utils.c
parent48fe7377795684992cb569328e730a5954aecd74 (diff)
downloadzsh-64d431d98b022d186aa088a295d723b2ec727b84.tar.gz
zsh-64d431d98b022d186aa088a295d723b2ec727b84.tar.xz
zsh-64d431d98b022d186aa088a295d723b2ec727b84.zip
28025: (D) parameter flag
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.                                 */