diff options
author | Přemysl Janouch <p@janouch.name> | 2018-07-28 16:21:34 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-07-28 16:21:34 +0200 |
commit | f5def2e579f6c9f1f10fe84ac7435fad4c928116 (patch) | |
tree | 17fcb1f957ca8753e12446703516a934c56df9fe /hid/hid-gen-replies.sh | |
parent | b2cd8b46c9d84b4eacf6aa2c1ff871d99b2221a7 (diff) | |
download | haven-f5def2e579f6c9f1f10fe84ac7435fad4c928116.tar.gz haven-f5def2e579f6c9f1f10fe84ac7435fad4c928116.tar.xz haven-f5def2e579f6c9f1f10fe84ac7435fad4c928116.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 'hid/hid-gen-replies.sh')
-rwxr-xr-x | hid/hid-gen-replies.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hid/hid-gen-replies.sh b/hid/hid-gen-replies.sh new file mode 100755 index 0000000..c32b000 --- /dev/null +++ b/hid/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 "}" + }' |