
/**********
 *
 * shprep.c - strip off the header of USENET shar files for UNSHAR'ng
 *
 * Related Files                    Relationship
 * -------------------------------------------------------------------------
 *
 * -------------------------------------------------------------------------
 *
 * File History:
 *
 * Date        Author               Version     Comments
 * -------------------------------------------------------------------------
 * 10-Jun-89   Keith Elbertson         1.0P     Original Version
 * -------------------------------------------------------------------------
 *
 * Known Bug List:
 * -------------------------------------------------------------------------
 *
 * -------------------------------------------------------------------------
 *
 * Copyright (c) 1989 Keith Elbertson, All Rights Reserved.
 *
 **********/

#include <stdio.h>

#define TRUE -1
#define FALSE 0

main(argc, argv)
int   argc;
char **argv;
{
   register FILE *infile, *outfile;
   char s[256];
   short found = FALSE;

   puts("Copyright 1989, Keith Elbertson, All Rights Reserved.");

   if(argc == 3){

      if((infile = fopen(argv[1],"r")) != NULL){

         if((outfile = fopen(argv[2],"w")) != NULL){

            while ( fgets( s, 255, infile )){ /* skip leading junk lines */

               if ( found )

                  fputs( s, outfile);

               else if ( s[0] == '#' )

                  found = TRUE;
            }

            fclose(outfile);
         }
         else {
            puts("No outfile");
         }

         fclose(infile);
      }
      else puts("No infile");
   }
   else {
      puts("Usage: SHPREP <infile> <outfile>");
      return(20);
   }
   return(0);
}
