roken.awk revision 72445
1# $Id: roken.awk,v 1.6 2000/08/16 01:56:30 assar Exp $ 2 3BEGIN { 4 print "#include <stdio.h>" 5 print "#ifdef HAVE_CONFIG_H" 6 print "#include <config.h>" 7 print "#endif" 8 print "" 9 print "int main()" 10 print "{" 11 print "puts(\"/* This is an OS dependent, generated file */\");" 12 print "puts(\"\\n\");" 13 print "puts(\"#ifndef __ROKEN_H__\");" 14 print "puts(\"#define __ROKEN_H__\");" 15 print "puts(\"\");" 16} 17END { 18 print "puts(\"#define ROKEN_VERSION \" VERSION );" 19 print "puts(\"\");" 20 print "puts(\"#endif /* __ROKEN_H__ */\");" 21 print "return 0;" 22 print "}" 23} 24 25$1 == "\#ifdef" || $1 == "\#ifndef" || $1 == "\#if" || $1 == "\#else" || $1 == "\#elif" || $1 == "\#endif" || $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