summaryrefslogtreecommitdiff
path: root/kike-gen-replies.sh
diff options
context:
space:
mode:
Diffstat (limited to 'kike-gen-replies.sh')
-rwxr-xr-xkike-gen-replies.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/kike-gen-replies.sh b/kike-gen-replies.sh
new file mode 100755
index 0000000..7318608
--- /dev/null
+++ b/kike-gen-replies.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+LC_ALL=C exec awk '
+ BEGIN {
+ # The message catalog is a byproduct
+ msg = "kike.msg"
+ print "$quote \"" > msg;
+ print "$set 1" > msg;
+ }
+ /^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
+ match($0, /".*"/);
+ ids[$1] = $2;
+ texts[$2] = substr($0, RSTART, RLENGTH);
+ print $1 " " texts[$2] > msg
+ }
+ END {
+ printf("enum\n{")
+ for (i in ids) {
+ if (seen_first)
+ printf(",")
+ seen_first = 1
+ printf("\n\t%s = %s", ids[i], i)
+ }
+ print "\n};\n"
+ print "static const char *g_default_replies[] =\n{"
+ for (i in ids)
+ print "\t[" ids[i] "] = " texts[ids[i]] ","
+ print "};"
+ }'