home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 2 / CDPD_II_2352.bin / scope / 051-075 / scopedisk74 / uushut / shprep.c < prev    next >
C/C++ Source or Header  |  1992-10-27  |  2KB  |  75 lines

  1.  
  2. /**********
  3.  *
  4.  * shprep.c - strip off the header of USENET shar files for UNSHAR'ng
  5.  *
  6.  * Related Files                    Relationship
  7.  * -------------------------------------------------------------------------
  8.  *
  9.  * -------------------------------------------------------------------------
  10.  *
  11.  * File History:
  12.  *
  13.  * Date        Author               Version     Comments
  14.  * -------------------------------------------------------------------------
  15.  * 10-Jun-89   Keith Elbertson         1.0P     Original Version
  16.  * -------------------------------------------------------------------------
  17.  *
  18.  * Known Bug List:
  19.  * -------------------------------------------------------------------------
  20.  *
  21.  * -------------------------------------------------------------------------
  22.  *
  23.  * Copyright (c) 1989 Keith Elbertson, All Rights Reserved.
  24.  *
  25.  **********/
  26.  
  27. #include <stdio.h>
  28.  
  29. #define TRUE -1
  30. #define FALSE 0
  31.  
  32. main(argc, argv)
  33. int   argc;
  34. char **argv;
  35. {
  36.    register FILE *infile, *outfile;
  37.    char s[256];
  38.    short found = FALSE;
  39.  
  40.    puts("Copyright 1989, Keith Elbertson, All Rights Reserved.");
  41.  
  42.    if(argc == 3){
  43.  
  44.       if((infile = fopen(argv[1],"r")) != NULL){
  45.  
  46.          if((outfile = fopen(argv[2],"w")) != NULL){
  47.  
  48.             while ( fgets( s, 255, infile )){ /* skip leading junk lines */
  49.  
  50.                if ( found )
  51.  
  52.                   fputs( s, outfile);
  53.  
  54.                else if ( s[0] == '#' )
  55.  
  56.                   found = TRUE;
  57.             }
  58.  
  59.             fclose(outfile);
  60.          }
  61.          else {
  62.             puts("No outfile");
  63.          }
  64.  
  65.          fclose(infile);
  66.       }
  67.       else puts("No infile");
  68.    }
  69.    else {
  70.       puts("Usage: SHPREP <infile> <outfile>");
  71.       return(20);
  72.    }
  73.    return(0);
  74. }
  75.