PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/crypto/heimdal/lib/roken/roken.awk

https://bitbucket.org/freebsd/freebsd-head/
AWK | 43 lines | 38 code | 4 blank | 1 comment | 0 complexity | 5356c76f4d3006302feea1f23773ebdc MD5 | raw file
 1# $Id$
 2
 3BEGIN {
 4	print "#include <config.h>"
 5	print "#include <stdio.h>"
 6	print "#ifdef HAVE_SYS_TYPES_H"
 7	print "#include <sys/types.h>"
 8	print "#endif"
 9	print "#ifdef HAVE_SYS_SOCKET_H"
10	print "#include <sys/socket.h>"
11	print "#endif"
12	print ""
13	print "int main(int argc, char **argv)"
14	print "{"
15	    print "puts(\"/* This is an OS dependent, generated file */\");"
16	print "puts(\"\\n\");"
17	print "puts(\"#ifndef __ROKEN_H__\");"
18	print "puts(\"#define __ROKEN_H__\");"
19	print "puts(\"\");"
20}
21
22$1 == "#ifdef" || $1 == "#ifndef" || $1 == "#if" || $1 == "#else" || $1 == "#elif" || $1 == "#endif" {
23	print $0;
24	next
25}
26
27{
28	s = ""
29	for(i = 1; i <= length; i++){
30		x = substr($0, i, 1)
31		if(x == "\"" || x == "\\")
32			s = s "\\";
33		s = s x;
34	}
35	print "puts(\"" s "\");"
36}
37
38END {
39	print "puts(\"\");"
40	print "puts(\"#endif /* __ROKEN_H__ */\");"
41	print "return 0;"
42	print "}"
43}