roken.awk revision 72445
1178476Sjb# $Id: roken.awk,v 1.6 2000/08/16 01:56:30 assar Exp $
2178476Sjb
3178476SjbBEGIN {
4178476Sjb	print "#include <stdio.h>"
5178476Sjb	print "#ifdef HAVE_CONFIG_H"
6178476Sjb	print "#include <config.h>"
7178476Sjb	print "#endif"
8178476Sjb	print ""
9178476Sjb	print "int main()"
10178476Sjb	print "{"
11178476Sjb	    print "puts(\"/* This is an OS dependent, generated file */\");"
12178476Sjb	print "puts(\"\\n\");"
13178476Sjb	print "puts(\"#ifndef __ROKEN_H__\");"
14178476Sjb	print "puts(\"#define __ROKEN_H__\");"
15178476Sjb	print "puts(\"\");"
16178476Sjb}
17178476SjbEND {
18178476Sjb	print "puts(\"#define ROKEN_VERSION \" VERSION );"
19178476Sjb	print "puts(\"\");"
20178476Sjb	print "puts(\"#endif /* __ROKEN_H__ */\");"
21178476Sjb	print "return 0;"
22178476Sjb	print "}"
23178476Sjb}
24178476Sjb
25178476Sjb$1 == "\#ifdef" || $1 == "\#ifndef" || $1 == "\#if" || $1 == "\#else" || $1 == "\#elif" || $1 == "\#endif" || $1 == "#ifdef" || $1 == "#ifndef" || $1 == "#if" || $1 == "#else" || $1 == "#elif" || $1 == "#endif" {
26178476Sjb	print $0;
27178476Sjb	next
28178476Sjb}
29178476Sjb
30178476Sjb{
31178476Sjb	s = ""
32178476Sjb	for(i = 1; i <= length; i++){
33178476Sjb		x = substr($0, i, 1)
34178476Sjb		if(x == "\"" || x == "\\")
35178476Sjb			s = s "\\";
36178476Sjb		s = s x;
37178476Sjb	}
38178476Sjb	print "puts(\"" s "\");"
39178476Sjb}
40178476Sjb