in src/terminal/terminal-handlers.c [1563:1619]
int guac_terminal_osc(guac_terminal* term, unsigned char c) {
static int operation = 0;
/* If digit, append to operation */
if (c >= '0' && c <= '9')
operation = operation * 10 + c - '0';
/* If end of parameter, check value */
else if (c == ';') {
/* Download OSC */
if (operation == 482200)
term->char_handler = guac_terminal_download;
/* Set upload directory OSC */
else if (operation == 482201)
term->char_handler = guac_terminal_set_directory;
/* Open and redirect output to pipe stream OSC */
else if (operation == 482202)
term->char_handler = guac_terminal_open_pipe_stream;
/* Close pipe stream OSC */
else if (operation == 482203)
term->char_handler = guac_terminal_close_pipe_stream;
/* Set scrollback size OSC */
else if (operation == 482204)
term->char_handler = guac_terminal_set_scrollback;
/* Set window title OSC */
else if (operation == 0 || operation == 2)
term->char_handler = guac_terminal_window_title;
/* xterm 256-color palette redefinition */
else if (operation == 4)
term->char_handler = guac_terminal_xterm_palette;
/* Reset parameter for next OSC */
operation = 0;
}
/* Stop on ECMA-48 ST (String Terminator */
else if (c == 0x9C || c == 0x5C || c == 0x07)
term->char_handler = guac_terminal_echo;
/* Stop on unrecognized character */
else {
guac_client_log(term->client, GUAC_LOG_DEBUG,
"Unexpected character in OSC: 0x%X", c);
term->char_handler = guac_terminal_echo;
}
return 0;
}