ANSI C; sprintf now returns an int.
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 26 Oct 1987 01:48:25 +0000 (17:48 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 26 Oct 1987 01:48:25 +0000 (17:48 -0800)
SCCS-vsn: lib/libc/stdio/sprintf.c 5.3

usr/src/lib/libc/stdio/sprintf.c

index 61f5b02..2a58f41 100644 (file)
@@ -4,15 +4,16 @@ static char sccsid[] = "@(#)sprintf.c 5.3 (Berkeley) %G%";
 
 #include       <stdio.h>
 
 
 #include       <stdio.h>
 
-char *sprintf(str, fmt, args)
+sprintf(str, fmt, args)
 char *str, *fmt;
 {
        FILE _strbuf;
 char *str, *fmt;
 {
        FILE _strbuf;
+       int len;
 
        _strbuf._flag = _IOWRT+_IOSTRG;
        _strbuf._ptr = str;
        _strbuf._cnt = 32767;
 
        _strbuf._flag = _IOWRT+_IOSTRG;
        _strbuf._ptr = str;
        _strbuf._cnt = 32767;
-       _doprnt(fmt, &args, &_strbuf);
-       putc('\0', &_strbuf);
-       return(str);
+       len = _doprnt(fmt, &args, &_strbuf);
+       *_strbuf._ptr = 0;
+       return(len);
 }
 }