Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mips.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!oliveb!Glacier!mips!mash From: mash@mips.UUCP (John Mashey) Newsgroups: net.lang.c Subject: Re: Need strnlen(). Message-ID: <229@mips.UUCP> Date: Tue, 19-Nov-85 02:03:22 EST Article-I.D.: mips.229 Posted: Tue Nov 19 02:03:22 1985 Date-Received: Thu, 21-Nov-85 03:43:44 EST References: <207@a.sei.cmu.edu> Organization: MIPS Computer Systems, Mountain View, CA Lines: 15 > One should never allow a character array to not have a null terminating byte. > Doing things like this should be automatic. Yes, except that for (at the time, and perhaps still) good reasons, certain structures had strings that might not be null-terminated. Such include directories (except in 4.2), accounting file command names, utmp/wtmp. Those things are why the strn* routines were written in the first place. I generally agree with the first advice, but there are at least a few occasions where one extra byte is fairly handy. -- -john mashey UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash DDD: 415-960-1200 USPS: MIPS Computer Systems, 1330 Charleston Rd, Mtn View, CA 94043