aboutsummaryrefslogtreecommitdiff
path: root/core/rsync/files
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-03-02 12:33:50 +0300
committerCem Keylan <cem@ckyln.com>2020-03-02 12:33:50 +0300
commite41336d5af0464e9f28045429196d5f6b4babf92 (patch)
treed17796740339c32a41ef3b1196c8512193e45273 /core/rsync/files
parentf7b14e632076525d823bde02527668ba599acf09 (diff)
downloadrepository-e41336d5af0464e9f28045429196d5f6b4babf92.tar.gz
rsync: build without perl
Diffstat (limited to 'core/rsync/files')
-rw-r--r--core/rsync/files/mkproto.awk39
1 files changed, 39 insertions, 0 deletions
diff --git a/core/rsync/files/mkproto.awk b/core/rsync/files/mkproto.awk
new file mode 100644
index 00000000..d3802f95
--- /dev/null
+++ b/core/rsync/files/mkproto.awk
@@ -0,0 +1,39 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+ while ((getline i < "proto.h") > 0) old_protos = old_protos ? old_protos "\n" i : i
+ protos = "/* This file is automatically generated with \"make proto\". DO NOT EDIT */\n"
+}
+
+inheader {
+ protos = protos "\n" ((inheader = /\)[ \t]*$/ ? 0 : 1) ? $0 : $0 ";")
+ next
+}
+
+/^FN_(LOCAL|GLOBAL)_[^(]+\([^,()]+/ {
+ local = /^FN_LOCAL/
+ gsub(/^FN_(LOC|GLOB)AL_|,.*$/, "")
+ sub(/^BOOL\(/, "BOOL ")
+ sub(/^CHAR\(/, "char ")
+ sub(/^INTEGER\(/, "int ")
+ sub(/^STRING\(/, "char *")
+ protos = protos "\n" $0 (local ? "(int module_id);" : "(void);")
+ next
+}
+
+/^static|^extern|;/||!/^[A-Za-z][A-Za-z0-9_]* / { next }
+
+/\(.*\)[ \t]*$/ {
+ protos = protos "\n" $0 ";"
+ next
+}
+
+/\(/ {
+ inheader = 1
+ protos = protos "\n" $0
+}
+
+END {
+ if (old_protos != protos) print protos > "proto.h"
+ print "" > "proto.h-tstamp"
+}