File tcsh-6.15.00-history.dif of Package tcsh

--- sh.c
+++ sh.c	2007-10-15 12:03:11.216084278 +0200
@@ -1770,7 +1770,7 @@ static Char   *jobargv[2] = {STRjobs, 0}
  * and finally go through the normal error mechanism, which
  * gets a chance to make the shell go away.
  */
-int just_signaled;		/* bugfix by Michael Bloom (mg@ttidca.TTI.COM) */
+int just_signaled = 0;		/* bugfix by Michael Bloom (mg@ttidca.TTI.COM) */
 
 void
 pintr(void)
--- sh.err.c
+++ sh.err.c	2007-10-15 11:53:17.760845847 +0200
@@ -51,6 +51,7 @@ char   *seterr = NULL;	/* Holds last err
 #define ERR_NAME	0x10000000
 #define ERR_SILENT	0x20000000
 #define ERR_OLD		0x40000000
+#define ERR_INTERRUPT	0x80000000
 
 #define ERR_SYNTAX	0
 #define ERR_NOTALLOWED	1
@@ -600,7 +601,8 @@ stderror(unsigned int id, ...)
 	 * else to FSHOUT/FSHDIAG. See flush in sh.print.c.
 	 */
 	flush();/*FIXRESET*/
-	haderr = 1;			/* Now to diagnostic output */
+	if (!(flags & ERR_INTERRUPT))
+	    haderr = 1;			/* Now to diagnostic output */
 
 	if (!(flags & ERR_SILENT)) {
 	    if (flags & ERR_NAME)
@@ -643,5 +645,6 @@ stderror(unsigned int id, ...)
     if (tpgrp > 0)
 	(void) tcsetpgrp(FSHTTY, tpgrp);
 #endif
-    reset();			/* Unwind */
+    if (!(flags & ERR_INTERRUPT))
+	reset();		/* Unwind */
 }
--- sh.h
+++ sh.h	2007-10-12 00:00:00.000000000 +0200
@@ -548,6 +548,7 @@ EXTERN int    neednote IZERO;	/* Need to
 EXTERN int    noexec IZERO;	/* Don't execute, just syntax check */
 EXTERN int    pjobs IZERO;	/* want to print jobs if interrupted */
 EXTERN int    setintr IZERO;	/* Set interrupts on/off -> Wait intr... */
+EXTERN int    handle_intr IZERO;/* Set interrupts on/off -> Wait intr... */
 EXTERN int    havhash IZERO;	/* path hashing is available */
 EXTERN int    editing IZERO;	/* doing filename expansion and line editing */
 EXTERN int    noediting IZERO;	/* initial $term defaulted to noedit */
--- sh.hist.c
+++ sh.hist.c	2007-10-12 00:00:00.000000000 +0200
@@ -425,9 +425,9 @@ rechist(Char *fname, int ref)
 	if (shist->vec[1] && eq(shist->vec[1], STRmerge))
 	    loadhist(fname, 1);
     fp = xcreat(short2str(fname), 0600);
+    cleanup_until(fname);
     if (fp == -1) {
 	didfds = oldidfds;
-	cleanup_until(fname);
 	return;
     }
     ftmp = SHOUT;
@@ -437,7 +437,6 @@ rechist(Char *fname, int ref)
     xclose(fp);
     SHOUT = ftmp;
     didfds = oldidfds;
-    cleanup_until(fname);
 }
 
 
--- sh.print.c
+++ sh.print.c	2007-10-15 12:09:15.994329114 +0200
@@ -222,7 +222,8 @@ drainoline(void)
 void
 flush(void)
 {
-    int unit;
+    int unit, oldexitset = exitset;
+    unsigned int errid = ERR_SILENT;
     static int interrupted = 0;
 
     /* int lmode; */
@@ -231,10 +232,14 @@ flush(void)
 	return;
     if (GettingInput && !Tty_raw_mode && linp < &linbuf[sizeof linbuf - 10])
 	return;
+    if (handle_intr) {
+	errid |= ERR_INTERRUPT;
+	exitset = 1;
+    }
     if (interrupted) {
 	interrupted = 0;
 	linp = linbuf;		/* avoid recursion as stderror calls flush */
-	stderror(ERR_SILENT);
+	stderror(errid);
     }
     interrupted = 1;
     if (haderr)
@@ -286,13 +291,14 @@ flush(void)
 	case EDQUOT:
 #endif
 	/* Nothing to do, but die */
-	    xexit(1);
-	    break;
+	    if (handle_intr == 0)
+		xexit(1);
 	default:
-	    stderror(ERR_SILENT);
+	    stderror(errid);
 	    break;
 	}
 
+    exitset = oldexitset;
     linp = linbuf;
     interrupted = 0;
 }
--- tc.sig.c
+++ tc.sig.c	2007-10-12 00:00:00.000000000 +0200
@@ -60,25 +60,34 @@ int alrmcatch_disabled; /* = 0; */
 int phup_disabled; /* = 0; */
 int pchild_disabled; /* = 0; */
 int pintr_disabled; /* = 0; */
+int handle_intr = 0;
 
 void
 handle_pending_signals(void)
 {
     if (!phup_disabled && phup_pending) {
 	phup_pending = 0;
+	handle_intr++;
 	phup();
+	handle_intr--;
     }
     if (!pintr_disabled && pintr_pending) {
 	pintr_pending = 0;
+	handle_intr++;
 	pintr();
+	handle_intr--;
     }
     if (!pchild_disabled && pchild_pending) {
 	pchild_pending = 0;
+	handle_intr++;
 	pchild();
+	handle_intr--;
     }
     if (!alrmcatch_disabled && alrmcatch_pending) {
 	alrmcatch_pending = 0;
+	handle_intr++;
 	alrmcatch();
+	handle_intr--;
     }
 }
 
openSUSE Build Service is sponsored by