Newsgroups: comp.binaries.ibm.pc.d Path: utzoo!utgpu!cunews!bnrgate!bigsur!bcars53!mussar From: mussar@bcars53.uucp (G. Mussar) Subject: Re: uudecoding blues Message-ID: <1991Apr17.034511.26074@bigsur.uucp> Sender: news@bigsur.uucp Reply-To: mussar@bnr.ca (G. Mussar) Organization: Bell-Northern Research, Ottawa, Canada References: <1991Apr14.035919.8473@magnus.acs.ohio-state.edu> Distribution: na Date: Wed, 17 Apr 91 03:45:11 GMT In article <1991Apr14.035919.8473@magnus.acs.ohio-state.edu> skesterk@magnus.acs.ohio-state.edu (Shane Kesterke) writes: >Does anyone know how to keep trailing spaces in uuencoded files from >getting stripped off? Everytime I get a uuencoded e-mail message I keep >getting "short file" whenever I try to uudecode it and I'm sure it's >because the trailing spaces get stripped off. I've got a lot of really nice >stuff uuencoded and I can't get to it. Can anyone help me?! I can't keep the trailing blanks from being stripped off, but I can make uudecode much more forgiving in the face of trailing blanks. Try the following diff against the C version of uudecode recently posted by Keith Peterson. *** old.c Tue Apr 16 23:43:50 1991 --- uudecode.c Sat Apr 13 23:11:51 1991 *************** *** 32,37 **** --- 32,40 ---- * but other programs such as zoo or arc may or may not require the file * to be "BILFed" (or "unBILFed" or whatever). Also, unlike the other * flavors, VMS files don't get overwritten (a higher version is created). + * + * Modified 13 April 1991 by Gary Mussar to be forgiving of systems that + * appear to be stripping trailing blanks. */ #ifndef lint *************** *** 156,162 **** { char buf[80]; char *bp; ! int n; for (;;) { /* for each input line */ --- 159,165 ---- { char buf[80]; char *bp; ! int n, i, expected; for (;;) { /* for each input line */ *************** *** 165,172 **** exit(10); } n = DEC(buf[0]); ! if (n <= 0) break; bp = &buf[1]; while (n > 0) { --- 168,179 ---- exit(10); } n = DEC(buf[0]); ! if ((n <= 0) || (buf[0] == '\n')) break; + + /* Calculate expected # of chars and pad if necessary */ + expected = ((n+2)/3)<<2; + for (i = strlen(buf)-1; i <= expected; i++) buf[i] = ' '; bp = &buf[1]; while (n > 0) { -- ------------------------------------------------------------------------------- Gary Mussar |Internet: mussar@bnr.ca | Phone: (613) 763-4937 BNR Ltd. | | FAX: (613) 763-2626