BSD 4_3_Tahoe release
[unix-history] / usr / src / usr.bin / uucp / uudecode.c
index 55ad988..fbb8311 100644 (file)
@@ -1,6 +1,23 @@
+/*
+ * 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.
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uudecode.c 5.1 (Berkeley) 7/2/83";
-#endif
+static char sccsid[] = "@(#)uudecode.c 5.5 (Berkeley) 7/6/88";
+#endif /* not lint */
 
 /*
  * uudecode [input]
 
 /*
  * uudecode [input]
@@ -20,7 +37,6 @@ main(argc, argv)
 char **argv;
 {
        FILE *in, *out;
 char **argv;
 {
        FILE *in, *out;
-       struct stat sbuf;
        int mode;
        char dest[128];
        char buf[80];
        int mode;
        char dest[128];
        char buf[80];
@@ -49,15 +65,14 @@ char **argv;
                if (strncmp(buf, "begin ", 6) == 0)
                        break;
        }
                if (strncmp(buf, "begin ", 6) == 0)
                        break;
        }
-       sscanf(buf, "begin %o %s", &mode, dest);
+       (void)sscanf(buf, "begin %o %s", &mode, dest);
 
        /* handle ~user/file format */
        if (dest[0] == '~') {
                char *sl;
                struct passwd *getpwnam();
 
        /* handle ~user/file format */
        if (dest[0] == '~') {
                char *sl;
                struct passwd *getpwnam();
-               char *index();
                struct passwd *user;
                struct passwd *user;
-               char dnbuf[100];
+               char dnbuf[100], *index(), *strcat(), *strcpy();
 
                sl = index(dest, '/');
                if (sl == NULL) {
 
                sl = index(dest, '/');
                if (sl == NULL) {
@@ -145,40 +160,3 @@ FILE *f;
        if (n >= 3)
                putc(c3, f);
 }
        if (n >= 3)
                putc(c3, f);
 }
-
-
-/* fr: like read but stdio */
-int
-fr(fd, buf, cnt)
-FILE *fd;
-char *buf;
-int cnt;
-{
-       int c, i;
-
-       for (i=0; i<cnt; i++) {
-               c = getc(fd);
-               if (c == EOF)
-                       return(i);
-               buf[i] = c;
-       }
-       return (cnt);
-}
-
-/*
- * Return the ptr in sp at which the character c appears;
- * NULL if not found
- */
-
-#define        NULL    0
-
-char *
-index(sp, c)
-register char *sp, c;
-{
-       do {
-               if (*sp == c)
-                       return(sp);
-       } while (*sp++);
-       return(NULL);
-}