🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.dec.micro
Article #1576

uudecode - missing blanks

#1576
From: hart
Date: Thu, 22 Sep 1988 06:14
62 lines
2167 bytes
[]

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 <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);
      }
  }

===============================================================

           -Sergiu Hart
---------------------------------------------------------------------
     MAIL:      School of Mathematical Sciences
                Tel-Aviv University
                69978  Tel-Aviv,  Israel
     E-MAIL:    hart@taurus.bitnet,    hart@math.tau.ac.il,
                hart%math.tau.ac.il@cunyvm.cuny.edu,
                hart%taurus.bitnet@cunyvm.cuny.edu,
                hart%taurus.bitnet@cornellc.ccs.cornell.edu,
                hart%taurus.bitnet@cnuce-vm.arpa
---------------------------------------------------------------------
Technical Details
Message-ID: <8809220614.AA08171@MATH.Tau.Ac.IL>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!ucbvax!TAURUS.BITNET!hart

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <hart%TAURUS.BITNET@cunyvm.cuny.edu>
Organization: The Internet
Lines: 62