clocal, nonblock, other carrier related stuff
[unix-history] / usr / src / sys / kern / kern_subr.c
index 4ba4237..777084a 100644 (file)
@@ -1,9 +1,9 @@
 /*
 /*
- * Copyright (c) 1982 Regents of the University of California.
+ * 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.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)kern_subr.c 6.4 (Berkeley) %G%
+ *     @(#)kern_subr.c 7.1 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -102,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.
  */
@@ -112,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) {
@@ -143,4 +145,3 @@ again:
        uio->uio_offset++;
        return (c & 0377);
 }
        uio->uio_offset++;
        return (c & 0377);
 }
-#endif