Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!husc6!hao!ames!ptsfa!ihnp4!inuxc!iuvax!bsu-cs!dhesi
From: dhesi@bsu-cs.UUCP (Rahul Dhesi)
Newsgroups: comp.unix.questions
Subject: write (fildes, buf, nbytes) -- is "nbytes" int or unsigned?
Message-ID: <868@bsu-cs.UUCP>
Date: Wed, 22-Jul-87 21:19:03 EDT
Article-I.D.: bsu-cs.868
Posted: Wed Jul 22 21:19:03 1987
Date-Received: Sat, 25-Jul-87 11:03:22 EDT
Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi)
Organization: CS Dept, Ball St U, Muncie, Indiana
Lines: 20
Summary: It's things like this that make people not use lint more

My System V Release 2 documentation as supplied with Microport System
V/AT says:

     int write (fildes, buf, nbytes)
     int fildes;
     char *buf;
     unsigned nbytes;

This is incorrect:  since write() normally returns the number of bytes
written, its return value should be of the same type as nbytes; but
since it can return -1, its return value must be signed.  Hence nbytes
should not be unsigned.  In "Advanced UNIX Programming", Marc J.
Rochkind describes the write() system call with the same inconsistent
parameter declarations.

The real problem is that if I declare and use write() correctly, lint
complains, because the lint library wants nbytes to be unsigned.  And I
don't WANT to declare it incorrectly.
-- 
Rahul Dhesi         UUCP:  {ihnp4,seismo}!{iuvax,pur-ee}!bsu-cs!dhesi