diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-05-17 12:27:02 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-05-17 12:27:02 +0000 |
commit | 86d7b4e02629328c3880cf46c9158d927a244d02 (patch) | |
tree | ae992bd709c58d7f95a768d5b9bc7ef638dbe56f | |
parent | fbce3fb517eb3bb05b8714f4c918020f61edbb4d (diff) | |
download | FreeBSD-src-86d7b4e02629328c3880cf46c9158d927a244d02.zip FreeBSD-src-86d7b4e02629328c3880cf46c9158d927a244d02.tar.gz |
Group the output chunks differently, to try to match BSD/OS output. Switch
to using arithmatic to determine buffer sizes to encode into.
Diane Bruce pointed out to me that BSD/OS did MIME too, so I want to match
their output, too, since my decision of 8 output groups was wholly arbitrary.
-rw-r--r-- | usr.bin/uuencode/uuencode.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/uuencode/uuencode.c b/usr.bin/uuencode/uuencode.c index 96c3370..e50c94c 100644 --- a/usr.bin/uuencode/uuencode.c +++ b/usr.bin/uuencode/uuencode.c @@ -142,9 +142,12 @@ main(int argc, char *argv[]) void base64_encode(void) { -#define GROUPS 8 /* Group output chunks */ - unsigned char buf[6]; - char buf2[16]; + /* + * Output must fit into 80 columns, chunks come in 4, leave 1. + */ +#define GROUPS ((80 / 4) - 1) + unsigned char buf[3]; + char buf2[sizeof(buf) * 2 + 1]; size_t n; int rv, sequence; |