forked from MEGA65/mega65-user-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_condensed.c
47 lines (39 loc) · 867 Bytes
/
generate_condensed.c
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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
FILE* rp;
FILE* wp;
char Line[60000];
int skip(const char *text)
{
size_t len;
len = strlen(text);
return (!strncmp(Line,text,len));
}
int main(int argc, char* argv[])
{
rp = fopen("appendix-basic65-indexed.tex", "r");
if (!rp) {
fprintf(stderr, "*** Could not open appendix-basic65-indexed.tex\n");
exit(1);
}
wp = fopen("appendix-basic65-condensed.tex", "w");
if (!wp) {
fprintf(stderr, "*** Could not open appendix-basic65-condensed.tex\n");
exit(1);
}
while (!feof(rp)) {
fgets(Line, sizeof(Line), rp);
if (skip("\\newpage"))
continue;
if (skip("\\item [Token:"))
continue;
if (skip("\\input{appendix-keywords}"))
continue;
fputs(Line, wp);
}
return 0;
}