clocal, nonblock, other carrier related stuff
[unix-history] / usr / src / sys / kern / kern_subr.c
index c42582b..777084a 100644 (file)
@@ -1,4 +1,10 @@
-/*     kern_subr.c     6.3     84/08/29        */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)kern_subr.c 7.1 (Berkeley) %G%
+ */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -96,7 +102,6 @@ again:
        return (0);
 }
 
        return (0);
 }
 
-#ifdef notdef
 /*
  * Get next character written in by user from uio.
  */
 /*
  * Get next character written in by user from uio.
  */
@@ -106,13 +111,16 @@ uwritec(uio)
        register struct iovec *iov;
        register int c;
 
        register struct iovec *iov;
        register int c;
 
+       if (uio->uio_resid <= 0)
+               return (-1);
 again:
 again:
-       if (uio->uio_iovcnt <= 0 || uio->uio_resid <= 0)
+       if (uio->uio_iovcnt <= 0)
                panic("uwritec");
        iov = uio->uio_iov;
        if (iov->iov_len == 0) {
                panic("uwritec");
        iov = uio->uio_iov;
        if (iov->iov_len == 0) {
-               uio->uio_iovcnt--;
                uio->uio_iov++;
                uio->uio_iov++;
+               if (--uio->uio_iovcnt == 0)
+                       return (-1);
                goto again;
        }
        switch (uio->uio_segflg) {
                goto again;
        }
        switch (uio->uio_segflg) {
@@ -137,4 +145,3 @@ again:
        uio->uio_offset++;
        return (c & 0377);
 }
        uio->uio_offset++;
        return (c & 0377);
 }
-#endif