diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-26 12:26:49 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-26 12:41:47 +0200 |
commit | f891e5ca638ead13485cc490320e74d698641623 (patch) | |
tree | 50c063589ed2b5aba130e87149c97f9ed487911b /xS/xS-gen-replies.awk | |
parent | 4d50ed111ad4f3172c4c186a2ca19b638c709a70 (diff) | |
parent | 8344b09c4f9989370691c71b1145b09348e0a6d3 (diff) | |
download | xK-f891e5ca638ead13485cc490320e74d698641623.tar.gz xK-f891e5ca638ead13485cc490320e74d698641623.tar.xz xK-f891e5ca638ead13485cc490320e74d698641623.zip |
Merge hid IRCd from haven as xS
Given that this project already contains a Go binary,
it only makes sense to put the IRCds back together.
Diffstat (limited to 'xS/xS-gen-replies.awk')
-rwxr-xr-x | xS/xS-gen-replies.awk | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/xS/xS-gen-replies.awk b/xS/xS-gen-replies.awk new file mode 100755 index 0000000..fce7b50 --- /dev/null +++ b/xS/xS-gen-replies.awk @@ -0,0 +1,16 @@ +#!/usr/bin/awk -f +/^[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 "}" +} |