about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-11-05 00:09:56 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-11-05 00:09:56 +0000
commit542b84358933e363773afe2105c9fa5ee494e18b (patch)
treee0d47552102f9345daf0ebe6a03ae6487a78c0c3 /Src
parent372555ff201bad639c4b50411293cfd872e31728 (diff)
downloadzsh-542b84358933e363773afe2105c9fa5ee494e18b.tar.gz
zsh-542b84358933e363773afe2105c9fa5ee494e18b.tar.xz
zsh-542b84358933e363773afe2105c9fa5ee494e18b.zip
Reverse the merging of 21296 onto 4.2 branch; the builtin.c piece had a merge conflict, and my resolution of it caused test failure in C03.
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c13
-rw-r--r--Src/jobs.c54
-rw-r--r--Src/zsh.h3
3 files changed, 25 insertions, 45 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 2adecbe21..145cb8cad 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5012,7 +5012,7 @@ bin_trap(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    s = getpermtext(sigfuncs[sig], NULL);
 		    printf("trap -- ");
 		    quotedzputs(s, stdout);
-		    printf(" %s\n", name);
+		    printf(" %s\n", sigs[sig]);
 		    zsfree(s);
 		}
 	    }
@@ -5052,23 +5052,12 @@ bin_trap(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
     /* set traps */
     for (; *argv; argv++) {
 	Eprog t;
-	int flags;
 
 	sig = getsignum(*argv);
 	if (sig == -1) {
 	    zwarnnam(name, "undefined signal: %s", *argv, 0);
 	    break;
 	}
-	if (!strcmp(sigs[sig], *argv))
-	    flags = 0;
-	else {
-	    /*
-	     * Record that the signal is used under an assumed name.
-	     * If we ever have more than one alias per signal this
-	     * will need improving.
-	     */
-	    flags = ZSIG_ALIAS;
-	}
 	t = dupeprog(prog, 0);
 	if (settrap(sig, t))
 	    freeeprog(t);
diff --git a/Src/jobs.c b/Src/jobs.c
index 94033cb31..b979bb8d6 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1841,6 +1841,18 @@ bin_fg(char *name, char **argv, Options ops, int func)
     return retval;
 }
 
+#if defined(SIGCHLD) && defined(SIGCLD)
+#if SIGCHLD == SIGCLD
+#define ALT_SIGS 1
+#endif
+#endif
+#if defined(SIGPOLL) && defined(SIGIO)
+#if SIGPOLL == SIGIO
+#define ALT_SIGS 1
+#endif
+#endif
+
+#ifdef ALT_SIGS
 const struct {
     const char *name;
     int num;
@@ -1855,15 +1867,9 @@ const struct {
     { "IO", SIGIO },
 #endif
 #endif
-#if !defined(SIGERR)
-    /*
-     * If SIGERR is not defined by the operating system, use it
-     * as an alias for SIGZERR.
-     */
-    { "ERR", SIGZERR },
-#endif
     { NULL, 0 }
 };
+#endif
 
 /* kill: send a signal to a process.  The process(es) may be specified *
  * by job specifier (see above) or pid.  A signal, defaulting to       *
@@ -1895,6 +1901,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 			    for (sig = 1; sig <= SIGCOUNT; sig++)
 				if (!cstrpcmp(sigs + sig, &signame))
 				    break;
+#ifdef ALT_SIGS
 			    if (sig > SIGCOUNT) {
 				int i;
 
@@ -1905,6 +1912,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 					break;
 				    }
 			    }
+#endif
 			    if (sig > SIGCOUNT) {
 				zwarnnam(nam, "unknown signal: SIG%s",
 					 signame, 0);
@@ -1967,6 +1975,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 			break;
 		if (*signame == '0' && !signame[1])
 		    sig = 0;
+#ifdef ALT_SIGS
 		if (sig > SIGCOUNT) {
 		    int i;
 
@@ -1977,6 +1986,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 			    break;
 			}
 		}
+#endif
 		if (sig > SIGCOUNT) {
 		    zwarnnam(nam, "unknown signal: SIG%s", signame, 0);
 		    zwarnnam(nam, "type kill -l for a List of signals", NULL, 0);
@@ -2054,40 +2064,18 @@ getsignum(char *s)
 	if (!strcmp(s, sigs[i]))
 	    return i;
 
+#ifdef ALT_SIGS
     for (i = 0; alt_sigs[i].name; i++)
     {
 	if (!strcmp(s, alt_sigs[i].name))
 	    return alt_sigs[i].num;
     }
+#endif
 
     /* no matching signal */
     return -1;
 }
 
-/* Get the name for a signal. */
-
-/**/
-mod_export const char *
-getsigname(int sig)
-{
-    if (sigtrapped[sig] & ZSIG_ALIAS)
-    {
-	int i;
-	for (i = 0; alt_sigs[i].name; i++)
-	    if (sig == alt_sigs[i].num)
-		return alt_sigs[i].name;
-    }
-    else
-	return sigs[sig];
-
-    /* shouldn't reach here */
-#ifdef DEBUG
-    dputs("Bad alias flag for signal");
-#endif
-    return "";
-}
-
-
 /* Get the function node for a trap, taking care about alternative names */
 /**/
 HashNode
@@ -2096,7 +2084,9 @@ gettrapnode(int sig, int ignoredisable)
     char fname[20];
     HashNode hn;
     HashNode (*getptr)(HashTable ht, char *name);
+#ifdef ALT_SIGS
     int i;
+#endif
     if (ignoredisable)
 	getptr = shfunctab->getnode2;
     else
@@ -2106,6 +2096,7 @@ gettrapnode(int sig, int ignoredisable)
     if ((hn = getptr(shfunctab, fname)))
 	return hn;
 
+#ifdef ALT_SIGS
     for (i = 0; alt_sigs[i].name; i++) {
 	if (alt_sigs[i].num == sig) {
 	    sprintf(fname, "TRAP%s", alt_sigs[i].name);
@@ -2113,6 +2104,7 @@ gettrapnode(int sig, int ignoredisable)
 		return hn;
 	}
     }
+#endif
 
     return NULL;
 }
diff --git a/Src/zsh.h b/Src/zsh.h
index 4fc476083..f4646fb93 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1866,8 +1866,7 @@ struct heap {
 /* Mask to get the above flags */
 #define ZSIG_MASK	(ZSIG_TRAPPED|ZSIG_IGNORED|ZSIG_FUNC)
 /* No. of bits to shift local level when storing in sigtrapped */
-#define ZSIG_ALIAS	(1<<3)  /* Trap is stored under an alias */
-#define ZSIG_SHIFT	4
+#define ZSIG_SHIFT	3
 
 /**********************************/
 /* Flags to third argument of zle */