Read a 4-byte mtime as unsigned (old-protocol).
[rsync.git] / mkproto.awk
blobbd2e927b947b86c24e4d447dad5e480fa4cedc97
1 #!/usr/bin/awk -f
3 BEGIN {
4 while ((getline i < "proto.h") > 0) old_protos = old_protos ? old_protos "\n" i : i
5 close("proto.h")
6 protos = "/* This file is automatically generated with \"make proto\". DO NOT EDIT */\n"
9 inheader {
10 protos = protos "\n" ((inheader = /\)[ \t]*$/ ? 0 : 1) ? $0 : $0 ";")
11 next
14 /^FN_(LOCAL|GLOBAL)_[^(]+\([^,()]+/ {
15 local = /^FN_LOCAL/
16 gsub(/^FN_(LOC|GLOB)AL_|,.*$/, "")
17 sub(/^BOOL\(/, "BOOL ")
18 sub(/^CHAR\(/, "char ")
19 sub(/^INTEGER\(/, "int ")
20 sub(/^STRING\(/, "char *")
21 protos = protos "\n" $0 (local ? "(int module_id);" : "(void);")
22 next
25 /^static|^extern|;/||!/^[A-Za-z][A-Za-z0-9_]* / { next }
27 /\(.*\)[ \t]*$/ {
28 protos = protos "\n" $0 ";"
29 next
32 /\(/ {
33 inheader = 1
34 protos = protos "\n" $0
37 END {
38 if (old_protos != protos) print protos > "proto.h"
39 system("touch proto.h-tstamp")