Deleted Added
full compact
47c47
< __FBSDID("$FreeBSD: head/usr.bin/uudecode/uudecode.c 103201 2002-09-10 20:53:46Z fanf $");
---
> __FBSDID("$FreeBSD: head/usr.bin/uudecode/uudecode.c 103203 2002-09-10 21:10:33Z fanf $");
76c76
< void base64_decode(const char *);
---
> int base64_decode(const char *);
243a244,246
> if (base64)
> return (base64_decode(buffn));
>
250,255c253
< if (base64) {
< if (strncmp(buf, "====", 4) == 0)
< return (0);
< base64_decode(buf);
< continue;
< }
---
>
320,321c318,319
< void
< base64_decode(const char *stream)
---
> int
> base64_decode(const char *outname)
322a321,322
> int n;
> char buf[MAXPATHLEN+1];
324d323
< int rv;
326,333c325,343
< if (index(stream, '\r') != NULL)
< *index(stream, '\r') = '\0';
< if (index(stream, '\n') != NULL)
< *index(stream, '\n') = '\0';
< rv = b64_pton(stream, out, (sizeof(out) / sizeof(out[0])));
< if (rv == -1)
< errx(1, "b64_pton: error decoding base64 input stream");
< fwrite(out, 1, rv, stdout);
---
> for (;;) {
> if (fgets(buf, sizeof(buf), stdin) == NULL) {
> warnx("%s: short file", filename);
> return (1);
> }
> if (strcmp(buf, "====") == 0 ||
> strcmp(buf, "====\n") == 0 ||
> strcmp(buf, "====\r\n") == 0)
> return (0);
> n = strlen(buf);
> while (n > 0 && (buf[n-1] == '\n' || buf[n-1] == '\r'))
> buf[--n] = '\0';
> n = b64_pton(buf, out, sizeof(out));
> if (n < 0) {
> warnx("%s: %s: error decoding base64 input stream", filename, outname);
> return (1);
> }
> fwrite(out, 1, n, stdout);
> }