summaryrefslogtreecommitdiff
path: root/xS/hid-gen-replies.sh
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-07-28 16:21:34 +0200
committerPřemysl Janouch <p@janouch.name>2018-07-28 16:21:34 +0200
commit2d287752d4b17ebac1db25bc6a013215e8b32162 (patch)
tree512bc20e79f689478f9ad7345b58a7abd42992ee /xS/hid-gen-replies.sh
downloadxK-2d287752d4b17ebac1db25bc6a013215e8b32162.tar.gz
xK-2d287752d4b17ebac1db25bc6a013215e8b32162.tar.xz
xK-2d287752d4b17ebac1db25bc6a013215e8b32162.zip
hid: add a work in progress IRC daemon
The port is more than viable but it's also sort of all-or-nothing and versioning needs have come before I've had a chance to finish it.
Diffstat (limited to 'xS/hid-gen-replies.sh')
-rwxr-xr-xxS/hid-gen-replies.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/xS/hid-gen-replies.sh b/xS/hid-gen-replies.sh
new file mode 100755
index 0000000..c32b000
--- /dev/null
+++ b/xS/hid-gen-replies.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+LC_ALL=C exec awk '
+ /^[0-9]+ *(ERR|RPL)_[A-Z]+ *".*"$/ {
+ match($0, /".*"/);
+ ids[$1] = $2;
+ texts[$2] = substr($0, RSTART, RLENGTH);
+ }
+ END {
+ print "package " ENVIRON["GOPACKAGE"] "\n\nconst ("
+ for (i in ids)
+ printf("\t%s = %s\n", ids[i], i)
+ print ")\n\nvar defaultReplies = map[int]string{"
+ for (i in ids)
+ print "\t" ids[i] ": " texts[ids[i]] ","
+ print "}"
+ }'