roken.awk revision 1.1.1.3 1 # Id
2
3 BEGIN {
4 print "#include <config.h>"
5 print "#include <stdio.h>"
6 print "#ifdef HAVE_SYS_TYPES_H"
7 print "#include <sys/types.h>"
8 print "#endif"
9 print "#ifdef HAVE_SYS_SOCKET_H"
10 print "#include <sys/socket.h>"
11 print "#endif"
12 print "#ifdef HAVE_ERRNO_H"
13 print "#include <errno.h>"
14 print "#endif"
15 print ""
16 print "int main(int argc, char **argv)"
17 print "{"
18 print "puts(\"/* This is an OS dependent, generated file */\");"
19 print "puts(\"\\n\");"
20 print "puts(\"#ifndef __ROKEN_H__\");"
21 print "puts(\"#define __ROKEN_H__\");"
22 print "puts(\"\");"
23 }
24
25 $1 == "#ifdef" || $1 == "#ifndef" || $1 == "#if" || $1 == "#else" || $1 == "#elif" || $1 == "#endif" {
26 print $0;
27 next
28 }
29
30 {
31 s = ""
32 for(i = 1; i <= length; i++){
33 x = substr($0, i, 1)
34 if(x == "\"" || x == "\\")
35 s = s "\\";
36 s = s x;
37 }
38 print "puts(\"" s "\");"
39 }
40
41 END {
42 print "puts(\"\");"
43 print "puts(\"#endif /* __ROKEN_H__ */\");"
44 print "return 0;"
45 print "}"
46 }
47