home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / csr.arc / FLINE.C < prev    next >
Text File  |  1986-03-03  |  2KB  |  67 lines

  1. /*
  2. **  F I R S T   L I N E
  3. **
  4. **  A Structured Programming Tool.
  5. **
  6. **  Copyright 1986 Bob Pritchett
  7. **
  8. **  Created: 03/02/86  Last Updated: 03/02/86
  9. **
  10. */
  11.  
  12. #include <stdio.h>
  13. #include <ctype.h>
  14.  
  15. FILE *in, *out;
  16.  
  17. main(argc,argv)
  18.  int argc;
  19.  char *argv[];
  20.  {
  21.   char *line;
  22.   if ( argc != 3 )
  23.      help();
  24.   strcpy(argv[1],strupr(argv[1]));
  25.   strcpy(argv[2],strupr(argv[2]));
  26.   if ( strcmp(argv[1],argv[2]) == 0 )
  27.    {
  28.     printf("FLINE: Source and Output File Must be Different Files.\n");
  29.     exit(0);
  30.    }
  31.   if ( ( in = fopen(argv[1],"r") ) == 00 )
  32.    {
  33.     printf("FLINE: Unable to open source file.\n");
  34.     exit(0);
  35.    }
  36.   if ( ( out = fopen(argv[2],"w") ) == 00 )
  37.    {
  38.     printf("FLINE: Unable to open output file.\n");
  39.     exit(0);
  40.    }
  41.   fprintf(out,"FLINE Output File for %s.\n\n",argv[1]);
  42.   while ( fgets(line,100,in) )
  43.    {
  44.     if ( ! isspace(*line) )
  45.        fprintf(out,"%s",line);
  46.    }
  47.   fclose(out);
  48.   fclose(in);
  49.   printf("FLINE: Successful.\n");
  50.   exit(0);
  51.  }
  52.  
  53. help()
  54.  {
  55.   printf("\n    First Line is a utility for programmers who write formatted\n");
  56.   printf(" source code.  FLine goes through a source file and puts all\n");
  57.   printf(" lines beginning with a non-whitespace character into the\n");
  58.   printf(" output file.  This creates and easy reference file with the\n");
  59.   printf(" name and argument list for all functions contained in the\n");
  60.   printf(" source in addition to all global variables and include files.\n");
  61.   printf("    Call FLine like:\n\n");
  62.   printf("    FLINE <source> <output>\n\n");
  63.   printf("  Version 1.1  Copyright 1986 Bob Pritchett\n");
  64.   printf("           New Dimension Software\n");
  65.   exit(0);
  66.  }
  67.