[comp.binaries.ibm.pc.d] uudecoding blues

skesterk@magnus.acs.ohio-state.edu (Shane Kesterke) (04/14/91)

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?!

phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) (04/15/91)

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?!

1.  Add the spaces back on.

2.  Change spaces to backwards quote.

3.  Use xxencode in the future.
-- 
 /***************************************************************************\
/ Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu   |  Guns don't aim guns at  \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks  |  people; CRIMINALS do!!  /
 \***************************************************************************/

andy@mks.com (Andy Toy) (04/15/91)

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. 

Just add spaces to the end of the lines.  I've received uuencoded mail
with trailing spaces deleted and have successfully uudecoded them by
adding spaces to the end of all lines between the `begin' and `end'
lines.
-- 
Andy Toy, Mortice Kern Systems Inc.,       Internet: andy@mks.com
  35 King Street North, Waterloo,       UUCP: uunet!watmath!mks!andy
      Ontario, N2J 2W9 CANADA      Phone: 519-884-2251  FAX: 519-884-8861

mussar@bcars53.uucp (G. Mussar) (04/17/91)

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