ache 7bbce1048f 1) Oops! Insert again if (n == 0) return 0.
Final word is Bruce's quote:

C9x specifies the BSD4.4-Lite behaviour:

       [#3] ...   Thus,  the
       null-terminated  output  has  been completely written if and
       only if the returned value is less than n.

It means that if we not have any null-terminated output as for n == 0
we can't return value less than n, so we forced to return value
equal to n i.e. 0

The next good thing is glibc compatibility, of course.

2) Do check for too big n in machine-independent way.
3) Minor optimization assuming EOF is < 0
1997-12-24 20:24:08 +00:00
..
1997-10-16 14:41:25 +00:00
1997-10-21 08:41:15 +00:00
1997-10-21 08:41:15 +00:00
1997-11-23 17:58:55 +00:00
1997-10-21 08:41:15 +00:00
1997-10-26 10:37:35 +00:00
1997-10-21 08:41:15 +00:00
1997-11-23 17:58:55 +00:00