Experimental IRC client, daemon and bot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kike-gen-replies.sh 599B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. LC_ALL=C exec awk '
  3. BEGIN {
  4. # The message catalog is a by-product
  5. msg = "kike.msg"
  6. print "$quote \"" > msg;
  7. print "$set 1" > msg;
  8. }
  9. /^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
  10. match($0, /".*"/);
  11. ids[$1] = $2;
  12. texts[$2] = substr($0, RSTART, RLENGTH);
  13. print $1 " " texts[$2] > msg
  14. }
  15. END {
  16. printf("enum\n{")
  17. for (i in ids) {
  18. if (seen_first)
  19. printf(",")
  20. seen_first = 1
  21. printf("\n\t%s = %s", ids[i], i)
  22. }
  23. print "\n};\n"
  24. print "static const char *g_default_replies[] =\n{"
  25. for (i in ids)
  26. print "\t[" ids[i] "] = " texts[ids[i]] ","
  27. print "};"
  28. }'