home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / a / aspretty.lbr / ASPRETTY.CZ / ASPRETTY.C
Encoding:
C/C++ Source or Header  |  1993-10-26  |  1.1 KB  |  44 lines

  1. #include    "libc.h"
  2.  
  3. main(argc,argv)
  4. int  argc; char  **argv;
  5. {
  6.     int    c, f1, f2, comment, onequote, twoquote;
  7.  
  8.     f1 = fopen(argv[1],"r");       /* open file 1 */
  9.     f2 = fopen(argv[2],"w");       /* open file 2 */
  10.  
  11.         comment = onequote = twoquote = 0;
  12.  
  13.     while((c=agetc(f1))!=EOF) {
  14.         switch (c) {
  15.         case ';' :
  16.                     comment = 1;
  17.                     break;
  18.                 case '\n':
  19.                     comment = 0;
  20.                     onequote = 0;
  21.                     twoquote = 0;
  22.                     break;
  23.         case '"' :
  24.                     twoquote = ~twoquote;
  25.                     break;
  26.                 case '\'':
  27.                     onequote = ~onequote;
  28.                     break;
  29.                 default  :
  30.                     break;
  31.                 }
  32.             if (((onequote != 0) | (twoquote != 0)) & (comment == 0))
  33.                 aputc(c,f2);
  34.             else if (comment == 0)
  35.         aputc(toupper(c),f2);
  36.             else if (comment == 1)
  37.                 aputc(tolower(c),f2);
  38.         }
  39.  
  40.     fclose(f1);
  41.     fclose(f2);
  42.     exit(0);
  43. }
  44.