blob: b257f12fb30ddd7ebd4842a0246895d46b3a4488 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include "textparser.hxx"
#include "htmlparser.hxx"
#include "latexparser.hxx"
#ifndef W32
using namespace std;
#endif
int
main(int argc, char** argv)
{
FILE * f;
/* first parse the command line options */
if (argc < 2) {
fprintf(stderr,"correct syntax is:\n");
fprintf(stderr,"testparser file\n");
fprintf(stderr,"example: testparser /dev/stdin\n");
exit(1);
}
/* open the words to check list */
f = fopen(argv[1],"r");
if (!f) {
fprintf(stderr,"Error - could not open file of words to check\n");
exit(1);
}
TextParser * p = new LaTeXParser("qwertzuiopasdfghjklyxcvbnméáúõûóüöíQWERTZUIOPASDFGHJKLYXCVBNMÍÉÁÕÚÖÜÓÛ");
char buf[MAXLNLEN];
char * next;
while(fgets(buf,MAXLNLEN,f)) {
fprintf(stdout,"---------------------------------------\n");
p->put_line(buf);
fprintf(stderr, "x:%s\n", buf);
p->set_url_checking(1);
while ((next=p->next_token())) {
fprintf(stdout,"token: %s\n",next);
free(next);
}
}
delete p;
fclose(f);
return 0;
}
|