create pidfile after forking
[Samba.git] / source / script / mkproto.awk
blobaf2304009356c1b8d5c997261fb55c4a46dc43d7
1 BEGIN {
2 inheader=0;
3 # use_ldap_define = 0;
4 current_file="";
5 if (headername=="") {
6 headername="_PROTO_H_";
9 print "#ifndef",headername
10 print "#define",headername
11 print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */"
12 print ""
15 END {
16 print "#endif /* _PROTO_H_ */"
20 if (FILENAME!=current_file) {
21 # if (use_ldap_define)
22 # {
23 # print "#endif /* USE_LDAP */"
24 # use_ldap_define = 0;
25 # }
26 print ""
27 print "/* The following definitions come from",FILENAME," */"
28 print ""
29 current_file=FILENAME
31 if (inheader) {
32 if (match($0,"[)][ \t]*$")) {
33 inheader = 0;
34 printf "%s;\n",$0;
35 } else {
36 printf "%s\n",$0;
38 next;
42 # special handling for code merge of TNG to head
43 /^#define OLD_NTDOMAIN 1/ {
44 printf "#if OLD_NTDOMAIN\n"
46 /^#undef OLD_NTDOMAIN/ {
47 printf "#endif\n"
49 /^#define NEW_NTDOMAIN 1/ {
50 printf "#if NEW_NTDOMAIN\n"
52 /^#undef NEW_NTDOMAIN/ {
53 printf "#endif\n"
56 # we handle the loadparm.c fns separately
58 /^FN_LOCAL_BOOL/ {
59 split($0,a,"[,()]")
60 printf "BOOL %s(int );\n", a[2]
63 /^FN_LOCAL_STRING/ {
64 split($0,a,"[,()]")
65 printf "char *%s(int );\n", a[2]
68 /^FN_LOCAL_INT/ {
69 split($0,a,"[,()]")
70 printf "int %s(int );\n", a[2]
73 /^FN_LOCAL_CHAR/ {
74 split($0,a,"[,()]")
75 printf "char %s(int );\n", a[2]
78 /^FN_GLOBAL_BOOL/ {
79 split($0,a,"[,()]")
80 printf "BOOL %s(void);\n", a[2]
83 /^FN_GLOBAL_STRING/ {
84 split($0,a,"[,()]")
85 printf "char *%s(void);\n", a[2]
88 /^FN_GLOBAL_INT/ {
89 split($0,a,"[,()]")
90 printf "int %s(void);\n", a[2]
93 /^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ {
94 next;
98 # We have to split up the start
99 # matching as we now have so many start
100 # types that it can cause some versions
101 # of nawk/awk to choke and fail on
102 # the full match. JRA.
106 gotstart = 0;
107 if( $0 ~ /^const|^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^pid_t|^ino_t|^off_t/ ) {
108 gotstart = 1;
111 if( $0 ~ /^vuser_key|^UNISTR2|^LOCAL_GRP|^DOMAIN_GRP|^SMB_STRUCT_DIRENT|^SEC_ACL|^SEC_DESC|^SEC_DESC_BUF|^DOM_SID|^RPC_HND_NODE|^BYTE/ ) {
112 gotstart = 1;
115 if( $0 ~ /^TDB_CONTEXT|^TDB_DATA|^smb_ucs2_t|^TALLOC_CTX|^hash_element|^NT_DEVICEMODE|^enum.*\(|^NT_USER_TOKEN|^SAM_ACCOUNT/ ) {
116 gotstart = 1;
119 if( $0 ~ /^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
120 gotstart = 1;
123 if( $0 ~ /^SAM_ACCT_INFO_NODE|^SMB_ACL_T|^NTSTATUS|^WERROR|^CLI_POLICY_HND|^DATA_BLOB/ ) {
124 gotstart = 1;
127 if(!gotstart) {
128 next;
133 /[(].*[)][ \t]*$/ {
134 printf "%s;\n",$0;
135 next;
138 /[(]/ {
139 inheader=1;
140 printf "%s\n",$0;
141 next;