about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-10-05 10:39:41 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-10-05 10:39:41 +0000
commit46141be5f917a47b99c4c3be62c9231ae9afca70 (patch)
tree2fb5fc3aa156905062ff689272fc012ae3335db3 /Src/utils.c
parent684da738b06f27d2736d6f60429f26206dc2ffbc (diff)
downloadzsh-46141be5f917a47b99c4c3be62c9231ae9afca70.tar.gz
zsh-46141be5f917a47b99c4c3be62c9231ae9afca70.tar.xz
zsh-46141be5f917a47b99c4c3be62c9231ae9afca70.zip
20412, tweaked: Make test builtin more POSIX compatible
20435: Make pattern.c not alter strings.
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/utils.c b/Src/utils.c
index ba31a1315..522c8f9c9 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -96,6 +96,10 @@ zwarn(const char *fmt, const char *str, int num)
 mod_export void
 zwarnnam(const char *cmd, const char *fmt, const char *str, int num)
 {
+    if (!cmd) {
+	zwarn(fmt, str, num);
+	return;
+    }
     if (errflag || noerrs)
 	return;
     trashzle();
@@ -103,10 +107,8 @@ zwarnnam(const char *cmd, const char *fmt, const char *str, int num)
 	nicezputs(scriptname ? scriptname : argzero, stderr);
 	fputc((unsigned char)':', stderr);
     }
-    if (cmd) {
-	nicezputs(cmd, stderr);
-	fputc((unsigned char)':', stderr);
-    }
+    nicezputs(cmd, stderr);
+    fputc((unsigned char)':', stderr);
     zerrmsg(fmt, str, num);
 }