[comp.sys.atari.st] program to replace trailing spaces in uuencoded files

csrobe@ICASE.ARPA (Charles S. Roberson) (04/15/88)

I saw this program on the Sun-Spots mailing list and thought it might
be of use to some Atarians.  I have not compiled or tested it, so
I don't know anything more than what was said in the note.   Personally,
I use J.P.H.Dumas' uue and uud, which I find to be very robust.  However,
if I ever receive a munged uuencode file I will definitely give this a
try.

enjoy,
-c

---snip---snip---snip---
SUN-SPOTS DIGEST          Monday, 4 April 1988         Volume 6 : Issue 44
----------------------------------------------------------------------

Date:    Wed, 23 Mar 88 21:50:25 EST
From:    Brian Glendenning <brian@radio.toronto.edu>
Subject: uudecode and trailing blanks

In a recent Sun-Spots Steve Platts complains of uuencoded files being
mangled by having trailing spaces being stripped out (bitnet is the usual
culprit). The following program is quite useful for fixing this. I grabbed
the code off the net a while ago, I'm afraid I don't know who the author
is.

/*
    Try to repair uuencoded files when trailing space has been removed.
    It pads short lines with spaces whenever needed.
    It reads from stdin and writes to stdout.

	use: pgm <uuencoded > repaired
	     uudecode repaired

	or:  pgm <uuencoded | uudecode

    If it doesn't work, I can't help you.
*/

#include <stdio.h>

main()
  {
    char c;
    int tab, len;

    tab = 0;
    while ((c = getchar()) != EOF)
      {
	if (tab == 0)
	  {
	    if (' '<=c && c<='Z') len = ((c-' '+2)/3)*4+1;
	    else len = 1;
	  }
	if (c == '\n')
	  {
	    while (tab++<len) putchar(' ');
	    tab = 0;
	  }
	else tab++;
	putchar (c);
      }
  }
/* End of text from mirror:comp.sys.ibm.pc */

Brian Glendenning                INTERNET - brian@radio.toronto.edu
Radio Astronomy, U. Toronto          UUCP - {uunet,pyramid}!utai!radio!brian
+1 (416) 978-5558                  BITNET - glendenn@utorphys.bitnet

---snip---snip---snip---
+-------------------------------------------------------------------------+
|Chip Roberson                ARPANET:  csrobe@icase.arpa                 |
|1105 London Company Way      BITNET:   $csrobe@wmmvs.bitnet              |
|Williamsburg, VA 23185       UUCP:     ...!uunet!pyrdc!gmu90x!wmcs!csrobe|
+-------------------------------------------------------------------------+
      "One world is enough, for all of us..."         - The Police.