version 1.31, 2000/08/19 21:55:52 |
version 1.32, 2000/08/19 22:21:19 |
|
|
int |
int |
process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) |
process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) |
{ |
{ |
|
char string[1024]; |
pid_t pid; |
pid_t pid; |
int bytes = 0; |
int bytes = 0; |
unsigned int i; |
unsigned int i; |
|
|
switch (ch) { |
switch (ch) { |
case '.': |
case '.': |
/* Terminate the connection. */ |
/* Terminate the connection. */ |
snprintf(buf, sizeof buf, "%c.\r\n", escape_char); |
snprintf(string, sizeof string, "%c.\r\n", escape_char); |
buffer_append(berr, buf, strlen(buf)); |
buffer_append(berr, string, strlen(string)); |
/*stderr_bytes += strlen(buf); XXX*/ |
/*stderr_bytes += strlen(string); XXX*/ |
|
|
quit_pending = 1; |
quit_pending = 1; |
return -1; |
return -1; |
|
|
case 'Z' - 64: |
case 'Z' - 64: |
/* Suspend the program. */ |
/* Suspend the program. */ |
/* Print a message to that effect to the user. */ |
/* Print a message to that effect to the user. */ |
snprintf(buf, sizeof buf, "%c^Z [suspend ssh]\r\n", escape_char); |
snprintf(string, sizeof string, "%c^Z [suspend ssh]\r\n", escape_char); |
buffer_append(berr, buf, strlen(buf)); |
buffer_append(berr, string, strlen(string)); |
/*stderr_bytes += strlen(buf); XXX*/ |
/*stderr_bytes += strlen(string); XXX*/ |
|
|
/* Restore terminal modes and suspend. */ |
/* Restore terminal modes and suspend. */ |
client_suspend_self(bin, bout, berr); |
client_suspend_self(bin, bout, berr); |
|
|
continue; /*XXX ? */ |
continue; /*XXX ? */ |
|
|
case '?': |
case '?': |
snprintf(buf, sizeof buf, |
snprintf(string, sizeof string, |
"%c?\r\n\ |
"%c?\r\n\ |
Supported escape sequences:\r\n\ |
Supported escape sequences:\r\n\ |
~. - terminate connection\r\n\ |
~. - terminate connection\r\n\ |
|
|
~~ - send the escape character by typing it twice\r\n\ |
~~ - send the escape character by typing it twice\r\n\ |
(Note that escapes are only recognized immediately after newline.)\r\n", |
(Note that escapes are only recognized immediately after newline.)\r\n", |
escape_char); |
escape_char); |
buffer_append(berr, buf, strlen(buf)); |
buffer_append(berr, string, strlen(string)); |
continue; |
continue; |
|
|
case '#': |
case '#': |
snprintf(buf, sizeof buf, "%c#\r\n", escape_char); |
snprintf(string, sizeof string, "%c#\r\n", escape_char); |
buffer_append(berr, buf, strlen(buf)); |
buffer_append(berr, string, strlen(string)); |
s = channel_open_message(); |
s = channel_open_message(); |
buffer_append(berr, s, strlen(s)); |
buffer_append(berr, s, strlen(s)); |
xfree(s); |
xfree(s); |