about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-06 11:05:38 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-06 11:05:38 +0000
commit929c56748420b581088cd75443d21d7c06ac44d6 (patch)
treebd68094f0d44922a9b125ea4211c45267506e478 /Src
parentfb37f90888121c0fcf173539c3316e78379ff832 (diff)
downloadzsh-929c56748420b581088cd75443d21d7c06ac44d6.tar.gz
zsh-929c56748420b581088cd75443d21d7c06ac44d6.tar.xz
zsh-929c56748420b581088cd75443d21d7c06ac44d6.zip
zsh-3.1.6-pws-3 zsh-3.1.6-pws-3
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/mapfile.c3
-rw-r--r--Src/Modules/parameter.c13
-rw-r--r--Src/Zle/zle_thingy.c8
-rw-r--r--Src/Zle/zle_tricky.c4
-rw-r--r--Src/subst.c122
5 files changed, 26 insertions, 124 deletions
diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c
index cd9c0120d..431c488e6 100644
--- a/Src/Modules/mapfile.c
+++ b/Src/Modules/mapfile.c
@@ -83,8 +83,7 @@ createmapfilehash()
     Param pm;
     HashTable ht;
 
-    if ((pm = (Param) gethashnode2(paramtab, mapfile_nam)))
-	unsetparam_pm(pm, 0, 1);
+    unsetparam(mapfile_nam);
     mapfile_pm = NULL;
 
     if (!(pm = createparam(mapfile_nam,
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 14f05d41d..bd0d68c67 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -620,28 +620,23 @@ boot_parameter(Module m)
      * As an example for autoloaded parameters, this is probably a bad
      * example, because we the zsh core doesn't support creation of
      * special hashes, yet. */
-    Param pm;
 
-    if ((pm = (Param) gethashnode2(paramtab, PAR_NAM)))
-	unsetparam_pm(pm, 0, 1);
+    unsetparam(PAR_NAM);
     if (!(parpm = createspecialhash(PAR_NAM, getpmparameter,
 				    scanpmparameters)))
 	return 1;
     parpm->flags |= PM_READONLY;
-    if ((pm = (Param) gethashnode2(paramtab, CMD_NAM)))
-	unsetparam_pm(pm, 0, 1);
+    unsetparam(CMD_NAM);
     if (!(cmdpm = createspecialhash(CMD_NAM, getpmcommand,
 				    scanpmcommands)))
 	return 1;
     cmdpm->sets.hfn = setpmcommands;
-    if ((pm = (Param) gethashnode2(paramtab, FUN_NAM)))
-	unsetparam_pm(pm, 0, 1);
+    unsetparam(FUN_NAM);
     if (!(funpm = createspecialhash(FUN_NAM, getpmfunction,
 				    scanpmfunctions)))
 	return 1;
     funpm->sets.hfn = setpmfunctions;
-    if ((pm = (Param) gethashnode2(paramtab, OPT_NAM)))
-	unsetparam_pm(pm, 0, 1);
+    unsetparam(OPT_NAM);
     if (!(optpm = createspecialhash(OPT_NAM, getpmoption,
 				    scanpmoptions)))
 	return 1;
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 4f1bb03f2..f753b4769 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -399,10 +399,6 @@ bin_zle_refresh(char *name, char **args, char *ops, char func)
     char *s = statusline;
     int sl = statusll, ocl = clearlist;
 
-    if (!zleactive) {
-	zerrnam(name, "can only be called from widget function", NULL, 0);
-	return 1;
-    }
     statusline = NULL;
     statusll = 0;
     if (*args) {
@@ -439,10 +435,6 @@ bin_zle_unget(char *name, char **args, char *ops, char func)
 {
     char *p = *args;
 
-    if (!zleactive) {
-	zerrnam(name, "can only be called from widget function", NULL, 0);
-	return 1;
-    }
     while (*p)
 	ungetkey((int) *p++);
     return 0;
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 672b049f7..652ef24c1 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -874,8 +874,6 @@ docomplete(int lst)
     metafy_line();
 
     ocs = cs;
-    origline = dupstring((char *) line);
-    origcs = cs;
     if (!isfirstln && chline != NULL) {
 	/* If we are completing in a multi-line buffer (which was not  *
 	 * taken from the history), we have to prepend the stuff saved *
@@ -899,6 +897,8 @@ docomplete(int lst)
     autoq = '\0';
     /* Get the word to complete. */
     noerrs = 1;
+    origline = dupstring((char *) line);
+    origcs = cs;
     s = get_comp_string();
     DPUTS(wb < 0 || cs < wb || cs > we,
 	  "BUG: 0 <= wb <= cs <= we is not true!");
diff --git a/Src/subst.c b/Src/subst.c
index 0ced984cb..a86f1dc93 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -725,8 +725,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
     char *sep = NULL, *spsep = NULL;
     char *premul = NULL, *postmul = NULL, *preone = NULL, *postone = NULL;
     char *replstr = NULL;	/* replacement string for /orig/repl */
-    char *thenstr, *elsestr;    /* then and else for ${..^..^..^..} */
-    int negpat = 0;
     zlong prenum = 0, postnum = 0;
     int copied = 0;
     int arrasg = 0;
@@ -1229,8 +1227,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		    *s == '%' ||
 		    *s == '#' || *s == Pound ||
 		    *s == '?' || *s == Quest ||
-		    *s == '/' ||
-		    *s == '^' || *s == Hat)) {
+		    *s == '/')) {
 
 	if (!flnum)
 	    flnum++;
@@ -1285,47 +1282,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	    untokenize(replstr);
 	    *ptr = '\0';
 	}
-	if (s[-1] == '^' || s[-1] == Hat) {
-	    char *ptr = s;
 
-	    if (*s == s[-1]) {
-		s++;
-		negpat = 1;
-	    }
-	    for (ptr = s; *ptr && *ptr != '^' && *ptr != Hat; ptr++)
-		if (*ptr == '\\' && (ptr[1] == '^' || ptr[1] == Hat))
-		    chuck(ptr);
-	    if (!*ptr || !ptr[1]) {
-		zerr("missing `then' string", NULL, 0);
-		return NULL;
-	    }
-	    *ptr++ = '\0';
-	    thenstr = ptr;
-	    for (; *ptr && *ptr != '^' && *ptr != Hat; ptr++)
-		if (*ptr == '\\' && (ptr[1] == '^' || ptr[1] == Hat))
-		    chuck(ptr);
-	    if (*ptr) {
-		elsestr = ptr + 1;
-		if (elsestr[0] == '\\' && elsestr[1] == '.')
-		    elsestr++;
-		if (elsestr[0] == '.' && !elsestr[1])
-		    elsestr = (char *) 1;
-		else {
-		    singsub(&elsestr);
-		    untokenize(elsestr);
-		}
-		*ptr = '\0';
-	    } else
-		elsestr = NULL;
-	    if (thenstr[0] == '\\' && thenstr[1] == '.')
-		thenstr++;
-	    if (thenstr[0] == '.' && !thenstr[1])
-		thenstr = (char *) 1;
-	    else {
-		singsub(&thenstr);
-		untokenize(thenstr);
-	    }
-	}
 	if (colf)
 	    flags |= SUB_ALL;
 	/*
@@ -1439,8 +1396,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	case '#':
 	case Pound:
 	case '/':
-	case '^':
-	case Hat:
 	    if (qt) {
 		int one = noerrs, oef = errflag, haserr;
 
@@ -1462,66 +1417,27 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		char t = s[-1];
 
 		singsub(&s);
-		if (t == '^' || t == Hat) {
-		    if (!vunset && isarr) {
-			char **ap, **pp;
-			Patprog pprg;
-
-			if (!(pprg = patcompile(s, PAT_STATIC, NULL))) {
-			    zerr("bad pattern: %s", s, 0);
-			    return NULL;
-			}
-			if (!copied)
-			    aval = arrdup(aval), copied = 1;
-			for (ap = pp = aval; *ap; ap++) {
-			    if ((!!pattry(pprg, *ap)) ^ negpat)
-				*pp++ = dupstring(thenstr == ((char *) 1) ?
-						  *ap : thenstr);
-			    else if (elsestr)
-				*pp++ = dupstring(elsestr == ((char *) 1) ?
-						  *ap : elsestr);
-			}
-			*pp = NULL;
-		    } else {
-			Patprog pprg;
-
-			if (vunset)
-			    val = dupstring("");
-			if ((pprg = patcompile(s, PAT_STATIC, NULL)) &&
-			    ((!!pattry(pprg, val)) ^ negpat))
-			    val = dupstring(thenstr == ((char *) 1) ?
-					    val : thenstr);
-			else if (elsestr)
-			    val = dupstring(elsestr == ((char *) 1) ?
-					    val : elsestr);
-			else {
-			    vunset = 1;
-			    val = dupstring("");
-			}
-			copied = 1;
-		    }
-		} else {
-		    if (t == '/' && (flags & SUB_SUBSTR)) {
-			if (*s == '#' || *s == '%') {
-			    flags &= ~SUB_SUBSTR;
-			    if (*s == '%')
-				flags |= SUB_END;
-			    s++;
-			} else if (*s == '\\') {
-			    s++;
-			}
-		    }
-		    if (!vunset && isarr) {
-			getmatcharr(&aval, s, flags, flnum, replstr);
-			copied = 1;
-		    } else {
-			if (vunset)
-			    val = dupstring("");
-			getmatch(&val, s, flags, flnum, replstr);
-			copied = 1;
+		if (t == '/' && (flags & SUB_SUBSTR)) {
+		    if (*s == '#' || *s == '%') {
+			flags &= ~SUB_SUBSTR;
+			if (*s == '%')
+			    flags |= SUB_END;
+			s++;
+		    } else if (*s == '\\') {
+			s++;
 		    }
 		}
 	    }
+
+	    if (!vunset && isarr) {
+		getmatcharr(&aval, s, flags, flnum, replstr);
+		copied = 1;
+	    } else {
+		if (vunset)
+		    val = dupstring("");
+		getmatch(&val, s, flags, flnum, replstr);
+		copied = 1;
+	    }
 	    break;
 	}
     } else {			/* no ${...=...} or anything, but possible modifiers. */