Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!cwruecmp!chet From: chet@cwruecmp.UUCP Newsgroups: comp.os.minix Subject: Re: asld bug? Message-ID: <2222@cwruecmp.UUCP> Date: Thu, 13-Aug-87 19:46:41 EDT Article-I.D.: cwruecmp.2222 Posted: Thu Aug 13 19:46:41 1987 Date-Received: Sat, 15-Aug-87 16:06:18 EDT References: <1237@cognos.UUCP> Reply-To: chet@cwru.EDU (Chet Ramey) Organization: CWRU Dept. of Computer Engineering, Cleveland, Ohio Lines: 32 In article <1237@cognos.UUCP> brianc@cognos.uucp (Brian Campbell) writes: >And while I'm here ... I thought sprintf() was >supposed to return the number of characters copied... not the address of >the buffer. With BSD systems (at least on the VAX), sprintf() returns a pointer to the buffer because it's "too painful to do right", which, I assume, means returning the number of characters copied into the buffer. I think Sys V systems return the number of characters. I assume this is because V7 had sprintf() return a pointer to the buffer, and BSD followed that. Now that there is so much BSD kernel (and other) code, at least on the VAX, that depends upon or assumes that sprintf() returns a pointer, it's too tough to follow AT&T's lead and return the number of characters copied. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ chet%cat /usr/include/stdio.h . . #ifdef vax char *sprintf(); /* too painful to do right */ #endif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Chet Ramey Internet: chet@cwru.edu UUCP: {...}!cbosgd!cwruecmp!chet BITNET: ramey%cwru20@cu20b He was a sharp guy...He lived on the edge of town...