summary refs log tree commit diff stats
path: root/src/common/outbound.c
diff options
context:
space:
mode:
authororcus <29999282+orcus-de@users.noreply.github.com>2022-01-24 18:38:21 +0100
committerGitHub <noreply@github.com>2022-01-24 11:38:21 -0600
commit7cff05c7ac4efe30a34f7f1bc5d5aa7463cb4f16 (patch)
tree6d89d95fe0785bdd4ee45a2c1cc64ecb6be9823e /src/common/outbound.c
parent1de339dfbcbc167f14345a75512b1e2658eafdad (diff)
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
Diffstat (limited to 'src/common/outbound.c')
-rw-r--r--src/common/outbound.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index da57ea33..6f0241be 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -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