Annotation of OpenXM/src/asir-doc/extract_man.c, Revision 1.2
1.2 ! ohara 1: /* $OpenXM: OpenXM/src/asir-doc/extract_man.c,v 1.1 1999/12/21 02:47:29 noro Exp $ */
1.1 noro 2:
3: #include <stdio.h>
4: #include <string.h>
5:
6: main(argc,argv)
7: int argc;
8: char **argv;
9: {
10: int c;
11: FILE *in,*fp;
12: char buf[BUFSIZ*100];
13: char *ok,*ng,*bok,*eok,*bng,*eng;
14:
15: if ( argc != 3 )
16: goto usage;
1.2 ! ohara 17: if ( !strcmp(argv[1],"ja") || !strcmp(argv[1],"JP") ) {
1.1 noro 18: ok = "\\JP";
19: bok = "\\BJP";
20: eok = "\\E";
21: ng = "\\EG";
22: bng = "\\BEG";
23: eng = "\\E";
1.2 ! ohara 24: } else if ( !strcmp(argv[1],"en") || !strcmp(argv[1],"EG") ) {
1.1 noro 25: ok = "\\EG";
26: bok = "\\BEG";
27: eok = "\\E";
28: ng = "\\JP";
29: bng = "\\BJP";
30: eng = "\\E";
31: } else
32: goto usage;
33:
34: in = fopen(argv[2],"rb");
35: if ( !in ) {
36: fprintf(stderr,"%s : not found",argv[2]);
37: exit(0);
38: }
39: while ( 1 ) {
40: if ( !fgets(buf,BUFSIZ,in) )
41: exit(0);
42: if ( !strncmp(buf,ok,3) )
43: fputs(buf+4,stdout);
44: else if ( !strncmp(buf,bok,4) ) {
45: while ( 1 ) {
46: if ( !fgets(buf,BUFSIZ,in) ) {
47: fprintf(stderr,"%s : EOF while %s is active.",argv[2],bok);
48: exit(0);
49: }
50: if ( !strncmp(buf,eok,2) )
51: break;
52: else
53: fputs(buf,stdout);
54: }
55: } else if ( !strncmp(buf,bng,4) ) {
56: while ( 1 ) {
57: if ( !fgets(buf,BUFSIZ,in) ) {
58: fprintf(stderr,"%s : EOF while %s is active.",argv[2],bng);
59: exit(0);
60: }
61: if ( !strncmp(buf,eng,2) )
62: break;
63: }
64: } else if ( strncmp(buf,ng,3) )
65: fputs(buf,stdout);
66: }
67: usage:
68: fprintf(stderr,"usage : extract_man JP|EG texinfofile\n");
69: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>