commit b9a59569d8490a3ad120e701b213b4986e36659f
parent 35a2d01456fed44d814d2a3b3b517874706fdae1
Author: Evan Gates <evan.gates@gmail.com>
Date: Wed, 21 Jul 2010 15:52:21 -0700
added ii-1.4-exec.diff and corresponding wiki page
Diffstat:
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/tools.suckless.org/ii/patches/exec.md b/tools.suckless.org/ii/patches/exec.md
@@ -0,0 +1,19 @@
+EXEC
+====
+
+Description
+-----------
+
+Adds support for '/e cmd' printing output of cmd to the channel. True this is
+possible doing 'cmd > in', but this is for lazy people (me). Be careful not to
+flood.
+
+Download
+--------
+
+* [ii-1.4-exec.diff](ii-1.4-exec.diff)
+
+Author
+------
+
+* Evan Gates (emg) <[evan.gates@gmail.com](mailto:evan.gates@gmail.com)>
diff --git a/tools.suckless.org/ii/patches/ii-1.4-exec.diff b/tools.suckless.org/ii/patches/ii-1.4-exec.diff
@@ -0,0 +1,30 @@
+diff -r d93eaacde742 ii.c
+--- a/ii.c Fri Jun 25 10:55:05 2010 +0200
++++ b/ii.c Wed Jul 21 15:51:29 2010 -0700
+@@ -284,6 +284,26 @@
+ rm_channel(c);
+ return;
+ break;
++ case 'e':
++ if(strlen(buf)>=3) {
++ char newbuf[PIPE_BUF];
++ FILE *fp;
++ int len;
++
++ if(!(fp = popen(&buf[3], "r"))) {
++ fprintf(stderr, "error running %s\n", &buf[3]);
++ return;
++ }
++ while (fgets(newbuf, sizeof(newbuf), fp)) {
++ len = strlen(newbuf);
++ if (newbuf[len - 1] == '\n')
++ newbuf[len - 1] = '\0';
++ proc_channels_privmsg(c->name, newbuf);
++ }
++ pclose(fp);
++ }
++ return;
++ break;
+ default:
+ snprintf(message, PIPE_BUF, "%s\r\n", &buf[1]);
+ break;