ANSI C; sprintf now returns an int.
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 23 Oct 1987 10:14:48 +0000 (02:14 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 23 Oct 1987 10:14:48 +0000 (02:14 -0800)
SCCS-vsn: include/stdio.h 5.4
SCCS-vsn: old/cpp/cpp.c 1.17
SCCS-vsn: lib/libc/net/rcmd.c 5.14
SCCS-vsn: lib/libc/net/res_debug.c 5.21
SCCS-vsn: lib/libc/net/res_mkquery.c 6.6
SCCS-vsn: lib/libcompat/4.3/rexec.c 5.3
SCCS-vsn: lib/libcompat/4.3/ruserpass.c 5.3
SCCS-vsn: lib/libc/gen/syslog.c 5.12
SCCS-vsn: lib/libc/stdio/sprintf.c 5.3
SCCS-vsn: usr.bin/rsh/rsh.c 5.6
SCCS-vsn: usr.bin/ruptime/ruptime.c 5.4
SCCS-vsn: usr.bin/mail/def.h 5.4
SCCS-vsn: old/sysline/sysline.c 5.8

13 files changed:
usr/src/include/stdio.h
usr/src/lib/libc/gen/syslog.c
usr/src/lib/libc/net/rcmd.c
usr/src/lib/libc/net/res_debug.c
usr/src/lib/libc/net/res_mkquery.c
usr/src/lib/libc/stdio/sprintf.c
usr/src/lib/libcompat/4.3/rexec.c
usr/src/lib/libcompat/4.3/ruserpass.c
usr/src/old/cpp/cpp.c
usr/src/old/sysline/sysline.c
usr/src/usr.bin/mail/def.h
usr/src/usr.bin/rsh/rsh.c
usr/src/usr.bin/ruptime/ruptime.c

index 5669c5d..3a9117a 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)stdio.h     5.3 (Berkeley) %G%
+ *     @(#)stdio.h     5.4 (Berkeley) %G%
  */
 
 # ifndef FILE
  */
 
 # ifndef FILE
@@ -59,7 +59,5 @@ FILE  *popen();
 long   ftell();
 char   *fgets();
 char   *gets();
 long   ftell();
 char   *fgets();
 char   *gets();
-#ifdef vax
-char   *sprintf();             /* too painful to do right */
-#endif
+int    sprintf();      /* here until everyone does it right */
 # endif
 # endif
index bc35335..80705d5 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)syslog.c   5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)syslog.c   5.12 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 /*
 #endif LIBC_SCCS and not lint
 
 /*
@@ -76,17 +76,17 @@ syslog(pri, fmt, p0, p1, p2, p3, p4)
 
        /* build the message */
        o = outline;
 
        /* build the message */
        o = outline;
-       sprintf(o, "<%d>", pri);
+       (void)sprintf(o, "<%d>", pri);
        o += strlen(o);
        time(&now);
        o += strlen(o);
        time(&now);
-       sprintf(o, "%.15s ", ctime(&now) + 4);
+       (void)sprintf(o, "%.15s ", ctime(&now) + 4);
        o += strlen(o);
        if (LogTag) {
                strcpy(o, LogTag);
                o += strlen(o);
        }
        if (LogStat & LOG_PID) {
        o += strlen(o);
        if (LogTag) {
                strcpy(o, LogTag);
                o += strlen(o);
        }
        if (LogStat & LOG_PID) {
-               sprintf(o, "[%d]", getpid());
+               (void)sprintf(o, "[%d]", getpid());
                o += strlen(o);
        }
        if (LogTag) {
                o += strlen(o);
        }
        if (LogTag) {
@@ -107,14 +107,14 @@ syslog(pri, fmt, p0, p1, p2, p3, p4)
                        continue;
                }
                if ((unsigned)olderrno > sys_nerr)
                        continue;
                }
                if ((unsigned)olderrno > sys_nerr)
-                       sprintf(b, "error %d", olderrno);
+                       (void)sprintf(b, "error %d", olderrno);
                else
                        strcpy(b, sys_errlist[olderrno]);
                b += strlen(b);
        }
        *b++ = '\n';
        *b = '\0';
                else
                        strcpy(b, sys_errlist[olderrno]);
                b += strlen(b);
        }
        *b++ = '\n';
        *b = '\0';
-       sprintf(o, buf, p0, p1, p2, p3, p4);
+       (void)sprintf(o, buf, p0, p1, p2, p3, p4);
        c = strlen(outline);
        if (c > MAXLINE)
                c = MAXLINE;
        c = strlen(outline);
        if (c > MAXLINE)
                c = MAXLINE;
index b5de9e6..d7dfc37 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rcmd.c     5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)rcmd.c     5.14 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
@@ -23,7 +23,7 @@ static char sccsid[] = "@(#)rcmd.c    5.13 (Berkeley) %G%";
 #include <errno.h>
 
 extern errno;
 #include <errno.h>
 
 extern errno;
-char   *index(), *sprintf();
+char   *index();
 
 rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
        char **ahost;
 
 rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
        char **ahost;
index 2c20a5d..42c812b 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_debug.c        5.20 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_debug.c        5.21 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #if defined(lint) && !defined(DEBUG)
 #endif LIBC_SCCS and not lint
 
 #if defined(lint) && !defined(DEBUG)
@@ -348,7 +348,6 @@ p_rr(cp, msg, file)
 }
 
 static char nbuf[20];
 }
 
 static char nbuf[20];
-extern char *sprintf();
 
 /*
  * Return a string for the type
 
 /*
  * Return a string for the type
@@ -409,7 +408,8 @@ p_type(type)
                return("UNSPEC");
 #endif /* ALLOW_T_UNSPEC */
        default:
                return("UNSPEC");
 #endif /* ALLOW_T_UNSPEC */
        default:
-               return (sprintf(nbuf, "%d", type));
+               (void)sprintf(nbuf, "%d", type);
+               return(nbuf);
        }
 }
 
        }
 }
 
@@ -427,6 +427,7 @@ p_class(class)
        case C_ANY:             /* matches any class */
                return("ANY");
        default:
        case C_ANY:             /* matches any class */
                return("ANY");
        default:
-               return (sprintf(nbuf, "%d", class));
+               (void)sprintf(nbuf, "%d", class);
+               return(nbuf);
        }
 }
        }
 }
index 89ea186..7915f87 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_mkquery.c      6.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_mkquery.c      6.6 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
@@ -14,8 +14,6 @@ static char sccsid[] = "@(#)res_mkquery.c     6.5 (Berkeley) %G%";
 #include <arpa/nameser.h>
 #include <resolv.h>
 
 #include <arpa/nameser.h>
 #include <resolv.h>
 
-extern char *sprintf();
-
 /*
  * Form all types of queries.
  * Returns the size of the result or -1.
 /*
  * Form all types of queries.
  * Returns the size of the result or -1.
@@ -70,8 +68,10 @@ res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
                if (!(_res.options & RES_INIT))
                        if (res_init() == -1)
                                return(-1);
                if (!(_res.options & RES_INIT))
                        if (res_init() == -1)
                                return(-1);
-               if (_res.defdname[0] != '\0')
-                       dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);
+               if (_res.defdname[0] != '\0') {
+                       (void)sprintf(dnbuf, "%s.%s", dname, _res.defdname);
+                       dname = dnbuf;
+               }
        }
        /*
         * perform opcode specific processing
        }
        /*
         * perform opcode specific processing
index 5acdf80..61f5b02 100644 (file)
@@ -1,5 +1,5 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sprintf.c  5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)sprintf.c  5.3 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include       <stdio.h>
 #endif LIBC_SCCS and not lint
 
 #include       <stdio.h>
index 5e6567c..c468434 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rexec.c    5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)rexec.c    5.3 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <sys/types.h>
 #endif LIBC_SCCS and not lint
 
 #include <sys/types.h>
@@ -18,7 +18,7 @@ static char sccsid[] = "@(#)rexec.c   5.2 (Berkeley) %G%";
 #include <errno.h>
 
 extern errno;
 #include <errno.h>
 
 extern errno;
-char   *index(), *sprintf();
+char   *index();
 int    rexecoptions;
 char   *getpass(), *getlogin();
 
 int    rexecoptions;
 char   *getpass(), *getlogin();
 
index 1b59781..6b68457 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ruserpass.c        5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)ruserpass.c        5.3 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
@@ -140,7 +140,7 @@ rnetrc(host, aname, apass)
        hdir = getenv("HOME");
        if (hdir == NULL)
                hdir = ".";
        hdir = getenv("HOME");
        if (hdir == NULL)
                hdir = ".";
-       sprintf(buf, "%s/.netrc", hdir);
+       (void)sprintf(buf, "%s/.netrc", hdir);
        cfile = fopen(buf, "r");
        if (cfile == NULL) {
                if (errno != ENOENT)
        cfile = fopen(buf, "r");
        if (cfile == NULL) {
                if (errno != ENOENT)
@@ -764,7 +764,7 @@ char *mkenvkey(mch)
        while (*p)
                *sk++ = *p++;
        *sk++ = mch;
        while (*p)
                *sk++ = *p++;
        *sk++ = mch;
-       sprintf(stemp, "%ld", putmp->ut_time);
+       (void)sprintf(stemp, "%ld", putmp->ut_time);
        sreverse(stemp1, stemp);
        p = stemp1;
        while (*p)
        sreverse(stemp1, stemp);
        p = stemp1;
        while (*p)
index 9a50739..5564bac 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)cpp.c      1.16 %G%";
+static char sccsid[] = "@(#)cpp.c      1.17 %G%";
 #endif lint
 
 #ifdef FLEXNAMES
 #endif lint
 
 #ifdef FLEXNAMES
@@ -969,10 +969,10 @@ subst(p,sp) register char *p; struct symtab *sp; {
        dump();
        if (sp==ulnloc) {
                vp=acttxt; *vp++='\0';
        dump();
        if (sp==ulnloc) {
                vp=acttxt; *vp++='\0';
-               sprintf(vp,"%d",lineno[ifno]); while (*vp++);
+               (void)sprintf(vp,"%d",lineno[ifno]); while (*vp++);
        } else if (sp==uflloc) {
                vp=acttxt; *vp++='\0';
        } else if (sp==uflloc) {
                vp=acttxt; *vp++='\0';
-               sprintf(vp,"\"%s\"",fnames[ifno]); while (*vp++);
+               (void)sprintf(vp,"\"%s\"",fnames[ifno]); while (*vp++);
        }
        if (0!=(params= *--vp&0xFF)) {/* definition calls for params */
                register char **pa;
        }
        if (0!=(params= *--vp&0xFF)) {/* definition calls for params */
                register char **pa;
index 139c263..952b26e 100644 (file)
@@ -11,7 +11,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)sysline.c  5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)sysline.c  5.8 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -971,7 +971,8 @@ stringprt(format, a, b, c)
 {
        char tempbuf[150];
 
 {
        char tempbuf[150];
 
-       stringcat(sprintf(tempbuf, format, a, b, c), -1);
+       (void)sprintf(tempbuf, format, a, b, c);
+       stringcat(tempbuf, -1);
 }
 
 stringdump()
 }
 
 stringdump()
index 162c0bf..c62ebf8 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)def.h       5.3 (Berkeley) %G%
+ *     @(#)def.h       5.4 (Berkeley) %G%
  */
 
 #include <sys/param.h>         /* includes <sys/types.h> */
  */
 
 #include <sys/param.h>         /* includes <sys/types.h> */
@@ -276,7 +276,6 @@ char        *salloc();
 char   *savestr();
 char   *skin();
 char   *snarf();
 char   *savestr();
 char   *skin();
 char   *snarf();
-char   *sprintf();
 char   *value();
 char   *vcopy();
 char   *yankword();
 char   *value();
 char   *vcopy();
 char   *yankword();
index 5e96994..dec368e 100644 (file)
@@ -11,7 +11,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)rsh.c      5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)rsh.c      5.6 (Berkeley) %G%";
 #endif not lint
 
 #include <sys/types.h>
 #endif not lint
 
 #include <sys/types.h>
@@ -32,7 +32,7 @@ static char sccsid[] = "@(#)rsh.c     5.5 (Berkeley) %G%";
  */
 /* VARARGS */
 int    error();
  */
 /* VARARGS */
 int    error();
-char   *index(), *rindex(), *malloc(), *getpass(), *sprintf(), *strcpy();
+char   *index(), *rindex(), *malloc(), *getpass(), *strcpy();
 
 struct passwd *getpwuid();
 
 
 struct passwd *getpwuid();
 
index fa9ac68..23f1d62 100644 (file)
@@ -11,7 +11,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)ruptime.c  5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)ruptime.c  5.4 (Berkeley) %G%";
 #endif not lint
 
 #include <sys/param.h>
 #endif not lint
 
 #include <sys/param.h>
@@ -35,7 +35,7 @@ int   hscmp(), ucmp(), lcmp(), tcmp();
 
 char   *interval();
 int    now;
 
 char   *interval();
 int    now;
-char   *malloc(), *sprintf();
+char   *malloc();
 int    aflg;
 int    rflg = 1;
 
 int    aflg;
 int    rflg = 1;