blob: 30abfb6f2ab6f5714f64406c94dadf95dcd415ce (
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
|
#include <stdio.h>
#include <slang.h>
#include <stdlib.h>
static void usage (void)
{
fprintf (stderr, "Usage: mkmake [DEF1 [DEF2 ...]]\n");
exit (1);
}
int main (int argc, char **argv)
{
char buf[1024];
int i;
SLPreprocess_Type pt;
if (isatty (0))
usage ();
SLprep_open_prep (&pt);
pt.preprocess_char = '!';
pt.comment_char = '#';
pt.flags = SLPREP_BLANK_LINES_OK | SLPREP_COMMENT_LINES_OK;
for (i = 1; i < argc; i++)
SLdefine_for_ifdef (argv[i]);
while (NULL != fgets (buf, sizeof (buf) - 1, stdin))
{
if (SLprep_line_ok (buf, &pt))
{
fputs (buf, stdout);
}
}
SLprep_close_prep (&pt);
return 0;
}
|