summaryrefslogtreecommitdiff
path: root/support/tspell/chk.c
blob: c256557a86e4c3a0f1b0d7d6f2b2df74e7f4398e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Save file as: CHK.C                  Source: FILESERV@SHSU.BITNET  
#include <stdio.h>
main(argc,argv)
int argc,*argv[];
{char ch;
 int check;
 FILE *fp1,*fp2,*fopen();
 if(argc<3)
{printf("useage: chk inputfile outputfile");
exit(1);
}
 fp1=fopen(argv[1],"r");
 fp2=fopen(argv[2],"w");
 if(fp1==NULL){printf("chk:input file not found");exit(1);}
 if(fp2==NULL){printf("chk:output file cannot be created");exit(1);}
/* printf("%s",argv[2]);*/
 for(;ch!=EOF;)
{ ch=fgetc(fp1);
  switch(ch)
  {case '\\': 
              fputc(ch,fp2);
             check=1;
             while(check!=0)
             {ch=fgetc(fp1);
              switch(ch)
              {case ' ':fputc(ch,fp2);check=0; break;
               case '{':fputc(ch,fp2);check=0; break;
               case '\n':fputc(ch,fp2);check=0;break;
               case '\t':fputc(ch,fp2);check=0;break;
               case '\\':fputc(ch,fp2);
               case EOF:break;
              }
             }
             break;
   default:fputc(ch,fp2);
  } 
}
  
}