date and time created 88/10/07 16:35:45 by marc
[unix-history] / usr / src / lib / libcompat / 4.3 / ruserpass.c
index 9c65c2d..b6f5278 100644 (file)
@@ -1,12 +1,30 @@
-/* Copyright (c) 1982 Regents of the University of California */
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
 
 
-static char sccsid[] = "@(#)ruserpass.c 4.2 %G%";
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ruserpass.c        5.5 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
 
 #include <stdio.h>
 #include <utmp.h>
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include <stdio.h>
 #include <utmp.h>
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <errno.h>
 
 char   *renvlook(), *malloc(), *index(), *getenv(), *getpass(), *getlogin();
 struct utmp *getutmp();
 
 char   *renvlook(), *malloc(), *index(), *getenv(), *getpass(), *getlogin();
 struct utmp *getutmp();
@@ -128,14 +146,16 @@ rnetrc(host, aname, apass)
        char *hdir, buf[BUFSIZ];
        int t;
        struct stat stb;
        char *hdir, buf[BUFSIZ];
        int t;
        struct stat stb;
+       extern int errno;
 
        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) {
        cfile = fopen(buf, "r");
        if (cfile == NULL) {
-               perror(buf);
+               if (errno != ENOENT)
+                       perror(buf);
                return;
        }
 next:
                return;
        }
 next:
@@ -755,7 +775,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)