Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

shout vs. stderr



-----BEGIN PGP SIGNED MESSAGE-----

This patch changes some uses of stderr to shout.  There are several
other uses of stderr, but I'm not sure that any of them should be using
the terminal directly.

 -zefram

      *** Src/hist.c	1996/12/24 06:12:14	1.18
      --- Src/hist.c	1997/01/07 21:19:04
      ***************
      *** 684,692 ****
        
        	ptr = ztrdup(chline);
        	if ((flag & (HISTFLAG_DONE | HISTFLAG_RECALL)) == HISTFLAG_DONE) {
      ! 	    zputs(ptr, stderr);
      ! 	    fputc('\n', stderr);
      ! 	    fflush(stderr);
        	}
        	if (flag & HISTFLAG_RECALL) {
        	    PERMALLOC {
      --- 684,692 ----
        
        	ptr = ztrdup(chline);
        	if ((flag & (HISTFLAG_DONE | HISTFLAG_RECALL)) == HISTFLAG_DONE) {
      ! 	    zputs(ptr, shout);
      ! 	    fputc('\n', shout);
      ! 	    fflush(shout);
        	}
        	if (flag & HISTFLAG_RECALL) {
        	    PERMALLOC {
      *** Src/main.c	1996/12/31 17:08:45	1.5
      --- Src/main.c	1997/01/07 21:26:11
      ***************
      *** 80,86 ****
        	if (!(isset(IGNOREEOF) && interact)) {
        #if 0
        	    if (interact)
      ! 		fputs(islogin ? "logout\n" : "exit\n", stderr);
        #endif
        	    zexit(lastval, 0);
        	    continue;
      --- 80,86 ----
        	if (!(isset(IGNOREEOF) && interact)) {
        #if 0
        	    if (interact)
      ! 		fputs(islogin ? "logout\n" : "exit\n", shout);
        #endif
        	    zexit(lastval, 0);
        	    continue;
      *** Src/utils.c	1997/01/07 21:16:09	1.54
      --- Src/utils.c	1997/01/07 21:16:39
      ***************
      *** 690,697 ****
        	    if (st.st_size && st.st_atime <= st.st_mtime &&
        		st.st_mtime > lastmailcheck)
        		if (!u) {
      ! 		    fprintf(stderr, "You have new mail.\n");
      ! 		    fflush(stderr);
        		} else {
        		    char *usav = underscore;
        
      --- 690,697 ----
        	    if (st.st_size && st.st_atime <= st.st_mtime &&
        		st.st_mtime > lastmailcheck)
        		if (!u) {
      ! 		    fprintf(shout, "You have new mail.\n");
      ! 		    fflush(shout);
        		} else {
        		    char *usav = underscore;
        
      ***************
      *** 700,716 ****
        			u = dupstring(u);
        			if (! parsestr(u)) {
        			    singsub(&u);
      ! 			    zputs(u, stderr);
      ! 			    fputc('\n', stderr);
      ! 			    fflush(stderr);
        			}
        			underscore = usav;
        		    } LASTALLOC;
        		}
        	    if (isset(MAILWARNING) && st.st_atime > st.st_mtime &&
        		st.st_atime > lastmailcheck && st.st_size) {
      ! 		fprintf(stderr, "The mail in %s has been read.\n", unmeta(*s));
      ! 		fflush(stderr);
        	    }
        	}
        	*v = c;
      --- 700,716 ----
        			u = dupstring(u);
        			if (! parsestr(u)) {
        			    singsub(&u);
      ! 			    zputs(u, shout);
      ! 			    fputc('\n', shout);
      ! 			    fflush(shout);
        			}
        			underscore = usav;
        		    } LASTALLOC;
        		}
        	    if (isset(MAILWARNING) && st.st_atime > st.st_mtime &&
        		st.st_atime > lastmailcheck && st.st_size) {
      ! 		fprintf(shout, "The mail in %s has been read.\n", unmeta(*s));
      ! 		fflush(shout);
        	    }
        	}
        	*v = c;
      ***************
      *** 1128,1140 ****
        	    break;
        	}
        	if (strchr(valid_chars, c)) {
      ! 	    write(2, "\n", 1);
        	    break;
        	}
        	feep();
        	if (icntrl(c))
      ! 	    write(2, "\b \b", 3);
      ! 	write(2, "\b \b", 3);
            }
            if (isem) {
        	if (c != '\n')
      --- 1128,1140 ----
        	    break;
        	}
        	if (strchr(valid_chars, c)) {
      ! 	    write(SHTTY, "\n", 1);
        	    break;
        	}
        	feep();
        	if (icntrl(c))
      ! 	    write(SHTTY, "\b \b", 3);
      ! 	write(SHTTY, "\b \b", 3);
            }
            if (isem) {
        	if (c != '\n')
      ***************
      *** 1142,1148 ****
            } else {
        	settyinfo(&shttyinfo);
        	if (c != '\n' && !valid_chars)
      ! 	    write(2, "\n", 1);
            }
            return (int)c;
        }
      --- 1142,1148 ----
            } else {
        	settyinfo(&shttyinfo);
        	if (c != '\n' && !valid_chars)
      ! 	    write(SHTTY, "\n", 1);
            }
            return (int)c;
        }
      ***************
      *** 1277,1285 ****
        	    rstring = best;
        	    Rstring = guess;
        	    pptbuf = putprompt(sprompt, &pptlen, NULL, 1);
      ! 	    fwrite(pptbuf, pptlen, 1, stderr);
        	    free(pptbuf);
      ! 	    fflush(stderr);
        	    feep();
        	    x = getquery("nyae ");
        	} else
      --- 1277,1285 ----
        	    rstring = best;
        	    Rstring = guess;
        	    pptbuf = putprompt(sprompt, &pptlen, NULL, 1);
      ! 	    fwrite(pptbuf, pptlen, 1, shout);
        	    free(pptbuf);
      ! 	    fflush(shout);
        	    feep();
        	    x = getquery("nyae ");
        	} else
      ***************
      *** 2222,2228 ****
        feep(void)
        {
            if (isset(BEEP))
      ! 	write(2, "\07", 1);
        }
        
        /**/
      --- 2222,2228 ----
        feep(void)
        {
            if (isset(BEEP))
      ! 	write(SHTTY, "\07", 1);
        }
        
        /**/

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMtLAuHD/+HJTpU/hAQFm4QP/aBxnC9cJfhMVT/DQNDpHi8NcLV9Iw7wC
jRXrQiFUVJHY19twob4v5d0dVwVJcL7IDRTxMauyuiNQXp86QaAV6M6sZXxw/rvF
KlVtzAbo1jcr7W0IDaBEfXlSMUtDK4g0hNBwbDShLUmyhqA59d67FTOCFI+tT9Ch
V/OAu093iS4=
=fY8P
-----END PGP SIGNATURE-----



Messages sorted by: Reverse Date, Date, Thread, Author