error reporting
[unix-history] / usr / src / usr.bin / window / wwwrite.c
index fcdede1..1e44f48 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwwrite.c   3.7 83/08/23";
+static char *sccsid = "@(#)wwwrite.c   3.9 83/08/26";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -10,11 +10,8 @@ register char *p;
 int n;
 {
        char c;
 int n;
 {
        char c;
-       int oldn = n;
        char hascursor = 0;
 
        char hascursor = 0;
 
-       if (w == 0)
-               return -1;
        wwnwrite++;
        wwnwritec += n;
        if (hascursor = w->ww_hascursor)
        wwnwrite++;
        wwnwritec += n;
        if (hascursor = w->ww_hascursor)
@@ -32,16 +29,16 @@ int n;
                                register char *win;
                                char *touched;
 
                                register char *win;
                                char *touched;
 
-                               c |= w->ww_modes << WWC_MSHIFT;
                                if (w->ww_insert) {
                                        wwinschar(w, w->ww_scroll + w->ww_cur.r,
                                if (w->ww_insert) {
                                        wwinschar(w, w->ww_scroll + w->ww_cur.r,
-                                               w->ww_cur.c, c);
+                                               w->ww_cur.c,
+                                               c | w->ww_modes << WWC_MSHIFT);
                                        goto right;
                                }
                                i = w->ww_w.nc - w->ww_cur.c - 1;
                                bp = bq = &w->ww_buf[w->ww_scroll+w->ww_cur.r]
                                        [w->ww_cur.c];
                                        goto right;
                                }
                                i = w->ww_w.nc - w->ww_cur.c - 1;
                                bp = bq = &w->ww_buf[w->ww_scroll+w->ww_cur.r]
                                        [w->ww_cur.c];
-                               bp++->c_w = c;
+                               bp++->c_w = c | w->ww_modes << WWC_MSHIFT;
                                while (n > 0 && --i >= 0 && !ISCTRL(*p)) {
                                        n--;
                                        bp++->c_w = *p++ & 0x7f
                                while (n > 0 && --i >= 0 && !ISCTRL(*p)) {
                                        n--;
                                        bp++->c_w = *p++ & 0x7f
@@ -189,5 +186,5 @@ int n;
        }
        if (hascursor)
                wwcursor(w, 1);
        }
        if (hascursor)
                wwcursor(w, 1);
-       return oldn - n;
+       return 0;
 }
 }