On 10 February 2015 at 19:23, Ralph Eastwood <tcmreastw...@gmail.com> wrote:
> Hi, > > Attached patch gives support for uuencode -m, base64 encoding and decoding > in uudecode. > Flag, -o, added so that uudecode can output to stdout to override the > output in encoded files. > > uudecode -m is accepted but ignored - the patch has an autodetection of > the file (begin-base64) in the header. > > Cheers, > Ralph > Small fixes to this patch; uudecode didn't flush in a corner case - and there's an extra #include <assert.h> lying in uuencode.
From 1318be09c38180c5b965154baadd6abfbd3c5e37 Mon Sep 17 00:00:00 2001 From: Tai Chi Minh Ralph Eastwood <tcmreastw...@gmail.com> Date: Tue, 10 Feb 2015 19:37:06 +0000 Subject: [PATCH 3/3] uuencode: refactor by removing extranous #include --- uuencode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/uuencode.c b/uuencode.c index 5ef93bf..af41473 100644 --- a/uuencode.c +++ b/uuencode.c @@ -4,7 +4,6 @@ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#include <assert.h> #include "util.h" -- 2.3.0
From 7e8a55c9228d6db2e7859ac0fad4cefc7b152779 Mon Sep 17 00:00:00 2001 From: Tai Chi Minh Ralph Eastwood <tcmreastw...@gmail.com> Date: Tue, 10 Feb 2015 19:36:34 +0000 Subject: [PATCH 2/3] uudecode: fix flushing in corner case --- uudecode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/uudecode.c b/uudecode.c index f3bbfd0..947a846 100644 --- a/uudecode.c +++ b/uudecode.c @@ -173,16 +173,16 @@ uudecodeb64(FILE *fp, FILE *outfp) if (++t < 4) continue; else - return; + goto flush; } else if (b == 1) { eprintf("unexpected \"=\" appeared."); } else if (b == 2) { *po++ = b24[0]; - fwrite(out, 1, (po - out), outfp); + goto flush; } else if (b == 3) { *po++ = b24[0]; *po++ = b24[1]; - fwrite(out, 1, (po - out), outfp); + goto flush; } } if ((e = b64dt[(int)*pb]) == -1) { @@ -205,9 +205,11 @@ uudecodeb64(FILE *fp, FILE *outfp) b = 0; } } - fwrite(out, 1, (po - out), outfp); + goto flush; } eprintf("invalid uudecode footer \"====\" not found\n"); +flush: + fwrite(out, 1, (po - out), outfp); } static void -- 2.3.0