lint
[unix-history] / usr / src / usr.bin / window / wwgets.c
index d7ada1a..ab1a925 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwgets.c    3.3 84/01/16";
+static char *sccsid = "@(#)wwgets.c    3.7 84/04/09";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
+#include "char.h"
 
 wwgets(buf, n, w)
 char *buf;
 
 wwgets(buf, n, w)
 char *buf;
@@ -11,7 +12,9 @@ register struct ww *w;
 {
        register char *p = buf;
        register char c;
 {
        register char *p = buf;
        register char c;
+       char uc = w->ww_unctrl;
 
 
+       w->ww_unctrl = 0;
        for (;;) {
                wwcurtowin(w);
                while ((c = wwgetc()) < 0)
        for (;;) {
                wwcurtowin(w);
                while ((c = wwgetc()) < 0)
@@ -19,8 +22,6 @@ register struct ww *w;
                if (c == wwoldtty.ww_sgttyb.sg_erase) {
                        if (p > buf)
                                rub(*--p, w);
                if (c == wwoldtty.ww_sgttyb.sg_erase) {
                        if (p > buf)
                                rub(*--p, w);
-                       else
-                               wwbell();
                } else if (c == wwoldtty.ww_sgttyb.sg_kill) {
                        while (p > buf)
                                rub(*--p, w);
                } else if (c == wwoldtty.ww_sgttyb.sg_kill) {
                        while (p > buf)
                                rub(*--p, w);
@@ -34,12 +35,13 @@ register struct ww *w;
                        break;
                } else {
                        if (p >= buf + n - 1)
                        break;
                } else {
                        if (p >= buf + n - 1)
-                               wwbell();
+                               wwputc(ctrl(g), w);
                        else
                        else
-                               (void) wwputs(unctrl(*p++ = c), w);
+                               wwputs(unctrl(*p++ = c), w);
                }
        }
        *p = 0;
                }
        }
        *p = 0;
+       w->ww_unctrl = uc;
 }
 
 static
 }
 
 static
@@ -49,5 +51,5 @@ struct ww *w;
        register i;
 
        for (i = strlen(unctrl(c)); --i >= 0;)
        register i;
 
        for (i = strlen(unctrl(c)); --i >= 0;)
-               (void) wwputs("\b \b", w);
+               (void) wwwrite(w, "\b \b", 3);
 }
 }