From ecebeace0ea28f243045bdee1002530028846fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Mon, 29 Aug 2022 06:02:54 +0200 Subject: Don't wrap xD-gen-replies in a shell script AWK doesn't seem to be that friendly to shebangs, so let env, also required for changing LC_ALL, locate it in PATH. --- xD-gen-replies.awk | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 xD-gen-replies.awk (limited to 'xD-gen-replies.awk') diff --git a/xD-gen-replies.awk b/xD-gen-replies.awk new file mode 100755 index 0000000..c9e8882 --- /dev/null +++ b/xD-gen-replies.awk @@ -0,0 +1,29 @@ +#!/usr/bin/awk -f +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 "};" +} -- cgit v1.2.3