generate roken.h

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4104 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-12-04 22:43:45 +00:00
parent e18544bc4f
commit d8e2b641b5
5 changed files with 195 additions and 553 deletions

36
lib/roken/roken.awk Normal file
View File

@@ -0,0 +1,36 @@
BEGIN {
print "#include <stdio.h>"
print "#ifdef HAVE_CONFIG_H"
print "#include <config.h>"
print "#endif"
print ""
print "int main()"
print "{"
print "printf(\"/* This is (as usual) a generated file,\\n\");"
print "printf(\" it is also machine dependent */\\n\");"
print "printf(\"\\n\");"
print "printf(\"#ifndef __ROKEN_H__\\n\");"
print "printf(\"#define __ROKEN_H__\\n\");"
print "printf(\"\\n\");"
}
END {
print "printf(\"#endif /* __ROKEN_H__ */\\n\");"
print "exit(0);"
print "}"
}
$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;
}
printf("printf(\"%s\\n\");\n", s);
}