M DOCUMENTATION => DOCUMENTATION +5 -0
@@ 34,6 34,11 @@ Send a PRIVMSG to the actor/channel that triggered the current event.
Terminate the current connection with message "quitmsg". The variables
_msg and _len are local variables that shouldn't set.
+*** irc_shell(cmd)
+An auxiliary function that will execute "cmd" and send the output
+using "irc_msg". Please use this only if you are sure that the
+command is sanitised.
+
*** READ(pat, to)
True when the message body of the current even matches
M irc.awk => irc.awk +8 -0
@@ 393,6 393,14 @@ function FROM(pat, to) { return MSG && (WHO ~ pat) && (TO ~ to); }
function JOINED(pat, to) { return JOIN && (!pat || WHO ~ pat) && (!to || TO ~ to); }
function MENTIONED(to) { return MSG && (MSG ~ ("^" __irc_nick ":")) && (TO ~ to); }
+### Auxiliary functions
+
+# Send the output of CMD using "irc_msg"
+function irc_shell(cmd) {
+ while ((cmd | getline line) > 0) irc_msg(line);
+ close(cmd);
+}
+
### Cleaning Up
END {