Add -q/-- flags to /execwrite to EXECWRITE and cmd_execW (#2675)

added two flags to EXECWRITE and cmd_execw
-q : (quiet) to allow suppressing of additional (debug) output at the text box
--  : (stop parsing for further flags) for the edge cases where -q itself migh be part of used data and the user wants to show that at the text box

Closes #2666
This commit is contained in:
orcus 2022-01-24 18:38:21 +01:00 committed by GitHub
parent 1de339dfbc
commit 7cff05c7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1579,9 +1579,26 @@ cmd_execw (struct session *sess, char *tbuf, char *word[], char *word_eol[])
EMIT_SIGNAL (XP_TE_NOCHILD, sess, NULL, NULL, NULL, NULL, 0);
return FALSE;
}
len = strlen(word_eol[2]);
temp = g_strconcat (word_eol[2], "\n", NULL);
PrintText(sess, temp);
if (strcmp (word[2], "--") == 0)
{
len = strlen(word_eol[3]);
temp = g_strconcat (word_eol[3], "\n", NULL);
PrintText(sess, temp);
}
else
{
if (strcmp (word[2], "-q") == 0)
{
len = strlen(word_eol[3]);
temp = g_strconcat (word_eol[3], "\n", NULL);
}
else
{
len = strlen(word_eol[2]);
temp = g_strconcat (word_eol[2], "\n", NULL);
PrintText(sess, temp);
}
}
write(sess->running_exec->myfd, temp, len + 1);
g_free(temp);
@ -3977,7 +3994,7 @@ const struct commands xc_cmds[] = {
N_("EXECKILL [-9], kills a running exec in the current session. If -9 is given the process is SIGKILL'ed")},
#ifndef __EMX__
{"EXECSTOP", cmd_execs, 0, 0, 1, N_("EXECSTOP, sends the process SIGSTOP")},
{"EXECWRITE", cmd_execw, 0, 0, 1, N_("EXECWRITE, sends data to the processes stdin")},
{"EXECWRITE", cmd_execw, 0, 0, 1, N_("EXECWRITE [-q|--], sends data to the processes stdin; use -q flag to quiet/suppress output at text box; use -- flag to stop interpreting arguments as flags, needed if -q itself would occur as data")},
#endif
#endif
#if 0