Fix a bug in the writing of the batch.sh file
[rsync.git] / mkproto.awk
blobab97d54f86f2b452d6a4b0fa84bdaf828bf3a7b1
1 #!/usr/bin/awk -f
3 BEGIN {
4 while ((getline i < "proto.h") > 0) old_protos = old_protos ? old_protos "\n" i : i
5 protos = "/* This file is automatically generated with \"make proto\". DO NOT EDIT */\n"
8 inheader {
9 protos = protos "\n" ((inheader = /\)[ \t]*$/ ? 0 : 1) ? $0 : $0 ";")
10 next
13 /^FN_(LOCAL|GLOBAL)_[^(]+\([^,()]+/ {
14 local = /^FN_LOCAL/
15 gsub(/^FN_(LOC|GLOB)AL_|,.*$/, "")
16 sub(/^BOOL\(/, "BOOL ")
17 sub(/^CHAR\(/, "char ")
18 sub(/^INTEGER\(/, "int ")
19 sub(/^STRING\(/, "char *")
20 protos = protos "\n" $0 (local ? "(int module_id);" : "(void);")
21 next
24 /^static|^extern|;/||!/^[A-Za-z][A-Za-z0-9_]* / { next }
26 /\(.*\)[ \t]*$/ {
27 protos = protos "\n" $0 ";"
28 next
31 /\(/ {
32 inheader = 1
33 protos = protos "\n" $0
36 END {
37 if (old_protos != protos) print protos > "proto.h"
38 printf "" > "proto.h-tstamp"