#!/usr/bin/awk BEGIN { print "#include " print "#include " print "#include " print "#include " print "#include " print "#include " print "#include " print "#include " print "#include " print "#include " print "int" print "main()" print "{" } $1 == "#define" && $3 ~ "^_IO[WR]" { printf("\tprintf(\"%s = %%ld\\n\", %s);\n", $2, $2) } END { print " return 0;" print "}" }