summaryrefslogtreecommitdiff
path: root/xD-gen-replies.sh
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-08-06 16:12:15 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-08-06 16:43:59 +0200
commit50057d5149dda340b3b47aca4096f4a6ec66b9ee (patch)
tree79323d20b17c2c8e32942a1ac9b84d9da3041c6d /xD-gen-replies.sh
parent1f64710e795b0c5434d15813d4f1f568467ca087 (diff)
downloadxK-50057d5149dda340b3b47aca4096f4a6ec66b9ee.tar.gz
xK-50057d5149dda340b3b47aca4096f4a6ec66b9ee.tar.xz
xK-50057d5149dda340b3b47aca4096f4a6ec66b9ee.zip
Come up with sillier names for the binaries
I'm not entirely sure, but it looks like some people might not like jokes about the Holocaust. On a more serious note, the project has become more serious over the 7 or so years of its existence.
Diffstat (limited to 'xD-gen-replies.sh')
-rwxr-xr-xxD-gen-replies.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/xD-gen-replies.sh b/xD-gen-replies.sh
new file mode 100755
index 0000000..0fcbbba
--- /dev/null
+++ b/xD-gen-replies.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+LC_ALL=C exec awk '
+ BEGIN {
+ # The message catalog is a by-product
+ msg = "xD.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 "};"
+ }'