Path: utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!ucbvax!TAURUS.BITNET!hart
From: hart@TAURUS.BITNET
Newsgroups: comp.sys.dec.micro
Subject: uudecode - missing blanks
Message-ID: <8809220614.AA08171@MATH.Tau.Ac.IL>
Date: 22 Sep 88 06:14:45 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: 
Organization: The Internet
Lines: 62


[]

Some mailers do indeed throw away blanks at the end of the line.
There is however no problem to add them back, since the length
of the line is encoded in the first character.

Following is a simple program to do just that.  I don't remember
where I got it from, but it works!

====================================================================
/*
    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  repaired
             uudecode repaired

        or:  pgm 

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++