sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 26168d5c37f370ac0d478ede0810dc12619ac00b
parent 92b14e9c7770bf679da3fa8551f906d46a9a39c3
Author: Tai Chi Minh Ralph Eastwood <tcmreastwood@gmail.com>
Date:   Sun, 15 Feb 2015 12:28:00 +0000

uudecode: fix error msgs (newlines, no output name)

Diffstat:
Muudecode.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/uudecode.c b/uudecode.c @@ -52,13 +52,13 @@ parseheader(FILE *fp, const char *s, char **header, mode_t *mode, eprintf("header string too long or non-newline terminated file\n"); p = bufs; if (!(q = strchr(p, ' '))) - eprintf("malformed mode string in header\n"); + eprintf("malformed mode string in header, expected ' '\n"); *header = bufs; *q++ = '\0'; p = q; /* now header should be null terminated, q points to mode */ if (!(q = strchr(p, ' '))) - eprintf("malformed mode string in header\n"); + eprintf("malformed mode string in header, expected ' '\n"); *q++ = '\0'; /* now mode should be null terminated, q points to fname */ *mode = parsemode(p, *mode, 0); @@ -67,6 +67,8 @@ parseheader(FILE *fp, const char *s, char **header, mode_t *mode, q[--n] = '\0'; if (n > 0) *fname = q; + else + eprintf("header string does not contain output file\n"); } static const char b64dt[] = { @@ -111,7 +113,7 @@ uudecodeb64(FILE *fp, FILE *outfp) continue; case 1: eprintf("%d: unexpected \"=\"" - "appeared.", l); + "appeared\n", l); case 3: *po++ = b24[0]; *po++ = b24[1]; @@ -125,11 +127,12 @@ uudecodeb64(FILE *fp, FILE *outfp) continue; } } else if ((e = b64dt[(int)*pb]) == -1) - eprintf("%d: invalid byte \"%c\"", l, *pb); + eprintf("%d: invalid byte \"%c\"\n", l, *pb); else if (e == -2) /* whitespace */ continue; else if (t > 0) /* state is parsing pad/footer */ - eprintf("%d: invalid byte \"%c\" after padding", + eprintf("%d: invalid byte \"%c\"" + " after padding\n", l, *pb); switch (b) { /* decode next base64 chr based on state */ case 0: b24[0] |= e << 2; break;