Deleted Added
full compact
45c45
< "$FreeBSD: head/usr.bin/uudecode/uudecode.c 90720 2002-02-16 09:18:33Z mike $";
---
> "$FreeBSD: head/usr.bin/uudecode/uudecode.c 91661 2002-03-05 03:27:47Z jmallett $";
54a55
> #include <sys/socket.h>
56a58,59
> #include <netinet/in.h>
>
58d60
< #include <fnmatch.h>
59a62
> #include <resolv.h>
71a75
> void base64_decode __P((const char *));
158c162
< int ignore, mode, n1;
---
> int base64, ignore, mode, n1;
162c166
< ignore = 0;
---
> base64 = ignore = 0;
172,173c176
< } while (strncmp(buf, "begin ", 6) ||
< fnmatch("begin [0-7]* *", buf, 0));
---
> } while (strncmp(buf, "begin", 5) != 0);
174a178,180
> if (strncmp(buf, "begin-base64", 12) == 0)
> base64 = 1;
>
176c182,185
< (void)sscanf(buf, "begin %o ", &mode);
---
> if (base64)
> (void)sscanf(buf, "begin-base64 %o ", &mode);
> else
> (void)sscanf(buf, "begin %o ", &mode);
181,182c190,195
< } else
< (void)sscanf(buf, "begin %o %[^\n\r]", &mode, buf);
---
> } else {
> if (base64)
> (void)sscanf(buf, "begin-base64 %o %[^\n\r]", &mode, buf);
> else
> (void)sscanf(buf, "begin %o %[^\n\r]", &mode, buf);
> }
232a246
> next:
237a252,257
> if (base64) {
> if (strncmp(buf, "====", 4) == 0)
> return (0);
> base64_decode(buf);
> goto next;
> }
306a327,339
> void
> base64_decode(stream)
> const char *stream;
> {
> unsigned char out[MAXPATHLEN * 4];
> int rv;
>
> rv = b64_pton(stream, out, (sizeof(out) / sizeof(out[0])));
> if (rv == -1)
> errx(1, "b64_pton: error decoding base64 input stream");
> printf("%s", out);
> }
>