summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2003-03-28 20:21:00 +0000
committerWayne Davison <wayned@users.sourceforge.net>2003-03-28 20:21:00 +0000
commitca8ad2e2628627bbf5f1bccf1ddf8c79143c94d8 (patch)
treed1cdde5bf12561e551a2b0303b6fa3eec6eb5e37
parent1e57c42f470bdd2ab6179ec44dae96fd3377a1dd (diff)
downloadzsh-ca8ad2e2628627bbf5f1bccf1ddf8c79143c94d8.tar.gz
zsh-ca8ad2e2628627bbf5f1bccf1ddf8c79143c94d8.tar.xz
zsh-ca8ad2e2628627bbf5f1bccf1ddf8c79143c94d8.zip
Prevent "print -m" from crashing (complains about missing pattern).
-rw-r--r--Src/builtin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 4750e8d8b..7013e89af 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3111,7 +3111,11 @@ bin_print(char *name, char **args, Options ops, int func)
     if (OPT_ISSET(ops,'m')) {
 	Patprog pprog;
 	char **t, **p;
-	
+
+	if (!*args) {
+	    zwarnnam(name, "no pattern specified", NULL, 0);
+	    return 1;
+	}
 	tokenize(*args);
 	if (!(pprog = patcompile(*args, PAT_STATIC, NULL))) {
 	    untokenize(*args);