forked from batari-Basic/batari-Basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbfilter.c
110 lines (104 loc) · 2.21 KB
/
bbfilter.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Provided under the GPL v2 license. See the included LICENSE.txt for details.
/*
bbfilter
reads from stdin, filters out a bunch of bB symbol names, and writes
to stdout.
*/
#define BUFSIZE 1000
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Our term list. If the term starts with ^ it will only be matched at the
// start of a line...
char *filterterm[] = {
"^pfcenter ",
"^shakescreen ",
"^rand16 ",
"^debugscore ",
"^pfscore ",
"^noscore ",
"^vblank_bB_code ",
"^PFcolorandheight ",
"^pfrowheight ",
"^PFmaskvalue ",
"^overscan_time ",
"^vblank_time ",
"^no_blank_lines ",
"^DPC_kernel_options ",
"^superchip ",
"^ROM2k ",
"^NO_ILLEGAL_OPCODES ",
"^bankswitch_hotspot ",
"^kernelmacrodef ",
"^minikernel ",
"^vertical_reflect ",
"^pfhalfwidth ",
"^font ",
"^debugcycles ",
"^mincycles ",
"^legacy ",
"^pfres ",
"^PFcolors ",
"^playercolors ",
"^player1colors ",
"^backgroundchange ",
"^scorefade ",
"^interlaced ",
"^readpaddle ",
"^multisprite ",
"^PFheights ",
"^bankswitch ",
"^screenheight ",
"^dpcspritemax ",
"^_NUSIZ1 ",
"^fontchar",
"^player9height",
"^fontchar",
"^mk_96x2",
"^mk_48x",
"^mk_gameselect_on",
"^mk_player_on",
"^bmp_96x",
"^bmp_48x",
"^FASTFETCH ",
"^lives_centered ",
"^qtcontroller ",
"^score_kernel_fade ",
"^0.title_vblank ",
"^pal ",
"^mk_score_on ",
" Unresolved Symbols",
""
};
int main(int argc, char **argv)
{
char linebuffer[BUFSIZE];
int t, match;
while (fgets(linebuffer, BUFSIZE, stdin) != NULL)
{
match = 0;
for (t = 0; filterterm[t][0] != '\0'; t++)
{
if (filterterm[t][0] == '^')
{
if (strncmp(linebuffer, filterterm[t] + 1, strlen(filterterm[t] + 1)) == 0)
{
match = 1;
break;
}
}
else
{
if (strstr(linebuffer, filterterm[t]) != NULL)
{
match = 1;
break;
}
}
}
if (match == 0)
fputs(linebuffer, stdout);
}
return (0);
}