Stub out guac OSC handling.

This commit is contained in:
Michael Jumper 2013-10-20 19:09:15 -07:00
parent 4381485051
commit 273c6a8503
2 changed files with 71 additions and 3 deletions

View File

@ -890,10 +890,76 @@ int guac_terminal_csi(guac_terminal* term, char c) {
} }
int guac_terminal_osc(guac_terminal* term, char c) { int guac_terminal_guac_set_directory(guac_terminal* term, char c) {
/* TODO: Implement OSC */
if (c == 0x9C || c == 0x5C || c == 0x07) /* ECMA-48 ST (String Terminator */ static char filename[2048];
static int length = 0;
/* Stop on ECMA-48 ST (String Terminator */
if (c == 0x9C || c == 0x5C || c == 0x07) {
filename[length++] = '\0';
term->char_handler = guac_terminal_echo; term->char_handler = guac_terminal_echo;
guac_client_log_info(term->client, "STUB: set: %s", filename);
length = 0;
}
/* Otherwise, store character */
else if (length < sizeof(filename)-1)
filename[length++] = c;
return 0;
}
int guac_terminal_guac_download(guac_terminal* term, char c) {
static char filename[2048];
static int length = 0;
/* Stop on ECMA-48 ST (String Terminator */
if (c == 0x9C || c == 0x5C || c == 0x07) {
filename[length++] = '\0';
term->char_handler = guac_terminal_echo;
guac_client_log_info(term->client, "STUB: get: %s", filename);
length = 0;
}
/* Otherwise, store character */
else if (length < sizeof(filename)-1)
filename[length++] = c;
return 0;
}
int guac_terminal_osc(guac_terminal* term, 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_guac_download;
/* Set upload directory OSC */
else if (operation == 482201)
term->char_handler = guac_terminal_guac_set_directory;
/* 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;
return 0; return 0;
} }

View File

@ -47,6 +47,8 @@ int guac_terminal_g1_charset(guac_terminal* term, char c);
int guac_terminal_g2_charset(guac_terminal* term, char c); int guac_terminal_g2_charset(guac_terminal* term, char c);
int guac_terminal_g3_charset(guac_terminal* term, char c); int guac_terminal_g3_charset(guac_terminal* term, char c);
int guac_terminal_csi(guac_terminal* term, char c); int guac_terminal_csi(guac_terminal* term, char c);
int guac_terminal_guac_download(guac_terminal* term, char c);
int guac_terminal_guac_set_directory(guac_terminal* term, char c);
int guac_terminal_osc(guac_terminal* term, char c); int guac_terminal_osc(guac_terminal* term, char c);
int guac_terminal_ctrl_func(guac_terminal* term, char c); int guac_terminal_ctrl_func(guac_terminal* term, char c);