mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 12:53:42 +02:00
pidwait: send status as second agument.
Implemented EPIC-compatible /EXEC git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1030 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1257104980
commit
f372f6d327
5 changed files with 588 additions and 42 deletions
|
|
@ -249,7 +249,7 @@ static void cmd_help(const char *data)
|
|||
g_free(cmd);
|
||||
}
|
||||
|
||||
/* SYNTAX: ECHO [<text>] */
|
||||
/* SYNTAX: ECHO [-current] [-window <name>] [-level <level>] <text> */
|
||||
static void cmd_echo(const char *data, void *server, WI_ITEM_REC *item)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
|
|
@ -326,44 +326,6 @@ static void cmd_cat(const char *data)
|
|||
close(f);
|
||||
}
|
||||
|
||||
|
||||
/* SYNTAX: EXEC <cmd line> */
|
||||
static void cmd_exec(const char *cmdline)
|
||||
{
|
||||
#ifndef WIN32
|
||||
char tmpbuf[512];
|
||||
char *foo;
|
||||
FILE *stream;
|
||||
|
||||
stream = popen(cmdline, "r");
|
||||
|
||||
if (!stream) {
|
||||
/* execution error of some kind */
|
||||
printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP,
|
||||
"Cannot open output stream.");
|
||||
return;
|
||||
}
|
||||
|
||||
while (fgets(tmpbuf, sizeof(tmpbuf), stream)) {
|
||||
/* strip \n characters appended from fgets
|
||||
This is safer than using gets, though it is more work tbd
|
||||
*/
|
||||
foo = tmpbuf;
|
||||
while (*foo != '\0') {
|
||||
if (*foo == '\n') {
|
||||
*foo = '\0';
|
||||
break;
|
||||
}
|
||||
foo++;
|
||||
}
|
||||
|
||||
printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%s", tmpbuf);
|
||||
}
|
||||
|
||||
pclose(stream);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* SYNTAX: BEEP */
|
||||
static void cmd_beep(void)
|
||||
{
|
||||
|
|
@ -475,7 +437,6 @@ void fe_core_commands_init(void)
|
|||
command_bind("echo", NULL, (SIGNAL_FUNC) cmd_echo);
|
||||
command_bind("version", NULL, (SIGNAL_FUNC) cmd_version);
|
||||
command_bind("cat", NULL, (SIGNAL_FUNC) cmd_cat);
|
||||
command_bind("exec", NULL, (SIGNAL_FUNC) cmd_exec);
|
||||
command_bind("beep", NULL, (SIGNAL_FUNC) cmd_beep);
|
||||
|
||||
signal_add("send command", (SIGNAL_FUNC) event_command);
|
||||
|
|
@ -492,7 +453,6 @@ void fe_core_commands_deinit(void)
|
|||
command_unbind("echo", (SIGNAL_FUNC) cmd_echo);
|
||||
command_unbind("version", (SIGNAL_FUNC) cmd_version);
|
||||
command_unbind("cat", (SIGNAL_FUNC) cmd_cat);
|
||||
command_unbind("exec", (SIGNAL_FUNC) cmd_exec);
|
||||
command_unbind("beep", (SIGNAL_FUNC) cmd_beep);
|
||||
|
||||
signal_remove("send command", (SIGNAL_FUNC) event_command);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue