blob: 00e60f026df9468ebf53bfae25b9449db2fcb94b (
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
54
|
# $Id$
BEGIN {
print "#include <config.h>"
print "#include <stdio.h>"
print "#ifdef HAVE_SYS_TYPES_H"
print "#include <sys/types.h>"
print "#endif"
print "#ifdef HAVE_SYS_SOCKET_H"
print "#include <sys/socket.h>"
print "#endif"
print "#ifdef HAVE_ERRNO_H"
print "#include <errno.h>"
print "#endif"
print "#if !defined(__has_extension)"
print "#define __has_extension(x) 0"
print "#endif"
print "#ifndef ROKEN_REQUIRE_GNUC"
print "#define ROKEN_REQUIRE_GNUC(m,n,p) \\"
print " (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \\"
print " (((m) * 10000) + ((n) * 100) + (p)))"
print "#endif"
print ""
print "int main(int argc, char **argv)"
print "{"
print "puts(\"/* This is an OS dependent, generated file */\");"
print "puts(\"\\n\");"
print "puts(\"#ifndef __ROKEN_H__\");"
print "puts(\"#define __ROKEN_H__\");"
print "puts(\"\");"
}
$1 == "#ifdef" || $1 == "#ifndef" || $1 == "#if" || $1 == "#else" || $1 == "#elif" || $1 == "#endif" {
print $0;
next
}
{
s = ""
for(i = 1; i <= length; i++){
x = substr($0, i, 1)
if(x == "\"" || x == "\\")
s = s "\\";
s = s x;
}
print "puts(\"" s "\");"
}
END {
print "puts(\"\");"
print "puts(\"#endif /* __ROKEN_H__ */\");"
print "return 0;"
print "}"
}
|