roken.awk revision 55682
1BEGIN {
2	print "#include <stdio.h>"
3	print "#ifdef HAVE_CONFIG_H"
4	print "#include <config.h>"
5	print "#endif"
6	print ""
7	print "int main()"
8	print "{"
9	    print "puts(\"/* This is an OS dependent, generated file */\");"
10	print "puts(\"\\n\");"
11	print "puts(\"#ifndef __ROKEN_H__\");"
12	print "puts(\"#define __ROKEN_H__\");"
13	print "puts(\"\");"
14}
15END {
16	print "puts(\"#endif /* __ROKEN_H__ */\");"
17	print "exit(0);"
18	print "}"
19}
20
21$1 == "\#ifdef" || $1 == "\#ifndef" || $1 == "\#if" || $1 == "\#else" || $1 == "\#elif" || $1 == "\#endif" || $1 == "#ifdef" || $1 == "#ifndef" || $1 == "#if" || $1 == "#else" || $1 == "#elif" || $1 == "#endif" {
22	print $0;
23	next
24}
25
26{
27	s = ""
28	for(i = 1; i <= length; i++){
29		x = substr($0, i, 1)
30		if(x == "\"" || x == "\\")
31			s = s "\\";
32		s = s x;
33	}
34	print "puts(\"" s "\");"
35}
36