/*                           file  uufill.c                                */
#include "stdio.h"
#include "string.h"
/*
   Program uufill for arranging uuencoded files for sending them via e-mail
   so that they will be protected against right-marginal blanks truncation.
   The program also corrects uuencoded files that were sent via e-mail
   without protection against right-marginal blanks truncation.
   Written by Uzi Paz   (uzipaz@bgumail.bgu.ac.il or uzipaz@poboxes.com).
   You may modify this program, as long as the name and details of the
   modifier are added to this comment.
   This program can be distributed freely and by anyone, and you may not use it
   in a manner that will restrict this right.
                                                                            */
char line[82],oldline[82];
main()
{
  gets(line);
  while(line[0]!='M')
  {
   strcpy(oldline,line); /*       |  the header is       */
   gets(line);           /*       |  stripped off         */
  }
  puts(oldline);         /* should contain the line with "begin ..."    */
  while(line[0] == 'M')
  {
    while (strlen(line) < 61) strcat(line,"`"); /* for receiving files */
    if (line[60] == ' ') line[60] = '`';            /* for sending files */
    puts(line); gets(line);
  }
  puts(line);
  puts("`");
  puts("end");
}
