home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / cleanuud.zip / cleanuud.c next >
C/C++ Source or Header  |  1996-12-01  |  1KB  |  47 lines

  1. #define INCL_DOSFILEMGR
  2. #include <os2.h>
  3.  
  4. #include <stdio.h>
  5. #include <conio.h>
  6. #include <stdlib.h>
  7.  
  8. void main(int argc, char **argv)
  9. {
  10.     FILE *input, *output;
  11.     int j;
  12.     char buffer[81];
  13.     
  14.     if(argc<3)
  15.     {
  16.         puts("CleanUUD:  Removes the > and spaces from quoted uuencoded files");
  17.         printf("Syntax:\n\t%s input.uud output.uud\n", argv[0]);
  18.         exit(0);
  19.     }
  20.  
  21.     if( (input=fopen(argv[1], "r"))==NULL)
  22.     {
  23.         puts("Error:\n\tCould not open input filename!");
  24.         exit(1);
  25.     }
  26.     
  27.     if ((output=fopen(argv[2], "w+"))==NULL)
  28.     {
  29.         puts("Error:\n\tCould not create output filename!");
  30.         exit(2);
  31.     }
  32.     while(fgets(buffer,80, input)!=NULL)
  33.     {
  34.         if(buffer[0]=='>')
  35.         {
  36.             j=1;
  37.             while( ((buffer[j]=='>') || (buffer[j]==' ')) && (buffer[j]!='\0') )
  38.                 j++;
  39.             fputs(buffer+j, output);    
  40.         }
  41.         else
  42.             fputs(buffer, output);
  43.     }
  44.     fclose(input);
  45.     fclose(output);
  46. }
  47.