fst-print.C
1.5 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*******************************************************************/
/* */
/* FILE fst-print.C */
/* MODULE fst-print */
/* PROGRAM SFST */
/* AUTHOR Helmut Schmid, IMS, University of Stuttgart */
/* */
/*******************************************************************/
#include "fst.h"
using std::cout;
using std::cerr;
/*******************************************************************/
/* */
/* main */
/* */
/*******************************************************************/
int main( int argc, char **argv )
{
FILE *file;
if (argc > 1 && (!strcmp(argv[1],"-h") ||
!strcmp(argv[1],"-help") ||
!strcmp(argv[1],"-?")))
{
fprintf(stderr,"\nUsage: %s [file]\n\n", argv[0]);
exit(1);
}
if (argc == 1)
file = stdin;
else if ((file = fopen(argv[1],"rb")) == NULL) {
fprintf(stderr,"\nError: Cannot open transducer file %s\n\n", argv[1]);
exit(1);
}
try {
Transducer a(file);
fclose(file);
cout << a;
}
catch (const char *p) {
cerr << p << "\n";
return 1;
}
return 0;
}