fix ctrl macro for ANSI C
[unix-history] / usr / src / usr.bin / window / wwgets.c
index 122095c..0a55de7 100644 (file)
@@ -1,7 +1,13 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwgets.c    3.5 84/04/08";
+static char sccsid[] = "@(#)wwgets.c   3.10 %G%";
 #endif
 
 #endif
 
+/*
+ * Copyright (c) 1983 Regents of the University of California,
+ * All rights reserved.  Redistribution permitted subject to
+ * the terms of the Berkeley Software License Agreement.
+ */
+
 #include "ww.h"
 #include "char.h"
 
 #include "ww.h"
 #include "char.h"
 
@@ -12,7 +18,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)
@@ -20,8 +28,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
-                               wwputc(ctrl(g), w);
                } 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);
@@ -35,12 +41,13 @@ register struct ww *w;
                        break;
                } else {
                        if (p >= buf + n - 1)
                        break;
                } else {
                        if (p >= buf + n - 1)
-                               wwputc(ctrl(g), w);
+                               wwputc(ctrl('g'), w);
                        else
                                wwputs(unctrl(*p++ = c), w);
                }
        }
        *p = 0;
                        else
                                wwputs(unctrl(*p++ = c), w);
                }
        }
        *p = 0;
+       w->ww_unctrl = uc;
 }
 
 static
 }
 
 static
@@ -50,5 +57,5 @@ struct ww *w;
        register i;
 
        for (i = strlen(unctrl(c)); --i >= 0;)
        register i;
 
        for (i = strlen(unctrl(c)); --i >= 0;)
-               wwwrite(w, "\b \b", 3);
+               (void) wwwrite(w, "\b \b", 3);
 }
 }