GUACAMOLE-597: Add flag which sends terminal output to both the user's display and the open pipe stream.

This commit is contained in:
Michael Jumper 2018-07-01 22:28:04 -07:00
parent e02df8d550
commit 99b17b0ac4
2 changed files with 18 additions and 1 deletions

View File

@ -98,6 +98,13 @@
*/ */
#define GUAC_TERMINAL_SCHEME_NUMBERED "color" #define GUAC_TERMINAL_SCHEME_NUMBERED "color"
/**
* Flag which specifies that terminal output should be sent to both the current
* pipe stream and the user's display. By default, terminal output will be sent
* only to the open pipe.
*/
#define GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT 1
typedef struct guac_terminal guac_terminal; typedef struct guac_terminal guac_terminal;
/** /**
@ -219,6 +226,8 @@ struct guac_terminal {
* Bitwise OR of all flags which apply to the currently-open pipe stream. * Bitwise OR of all flags which apply to the currently-open pipe stream.
* If no pipe stream is open, this value has no meaning, and its contents * If no pipe stream is open, this value has no meaning, and its contents
* are undefined. * are undefined.
*
* @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
*/ */
int pipe_stream_flags; int pipe_stream_flags;
@ -931,6 +940,8 @@ int guac_terminal_next_tab(guac_terminal* term, int column);
* @param flags * @param flags
* A bitwise OR of all integer flags which should apply to the new pipe * A bitwise OR of all integer flags which should apply to the new pipe
* stream. * stream.
*
* @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
*/ */
void guac_terminal_pipe_stream_open(guac_terminal* term, const char* name, void guac_terminal_pipe_stream_open(guac_terminal* term, const char* name,
int flags); int flags);

View File

@ -135,8 +135,14 @@ int guac_terminal_echo(guac_terminal* term, unsigned char c) {
/* Echo to pipe stream if open and not starting an ESC sequence */ /* Echo to pipe stream if open and not starting an ESC sequence */
if (term->pipe_stream != NULL && c != 0x1B) { if (term->pipe_stream != NULL && c != 0x1B) {
guac_terminal_pipe_stream_write(term, c); guac_terminal_pipe_stream_write(term, c);
/* Do not render output while pipe is open unless explicitly requested
* via flags */
if (!(term->pipe_stream_flags & GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT))
return 0; return 0;
} }
/* If using non-Unicode mapping, just map straight bytes */ /* If using non-Unicode mapping, just map straight bytes */