View | Details | Raw Unified | Return to bug 2478 | Differences between
and this patch

Collapse All | Expand All

(-)a/clientloop.c (-7 / +18 lines)
Lines 154-159 volatile sig_atomic_t quit_pending; /* Set non-zero to quit the loop. */ Link Here
154
static int escape_char1;	/* Escape character. (proto1 only) */
154
static int escape_char1;	/* Escape character. (proto1 only) */
155
static int escape_pending1;	/* Last character was an escape (proto1 only) */
155
static int escape_pending1;	/* Last character was an escape (proto1 only) */
156
static int last_was_cr;		/* Last character was a newline. */
156
static int last_was_cr;		/* Last character was a newline. */
157
static int last_was_ansi;	/* Last character was part of an ANSI escape. */
157
static int exit_status;		/* Used to store the command exit status. */
158
static int exit_status;		/* Used to store the command exit status. */
158
static int stdin_eof;		/* EOF has been encountered on stderr. */
159
static int stdin_eof;		/* EOF has been encountered on stderr. */
159
static Buffer stdin_buffer;	/* Buffer for stdin data. */
160
static Buffer stdin_buffer;	/* Buffer for stdin data. */
Lines 1096-1102 process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, Link Here
1096
		/* Get one character at a time. */
1097
		/* Get one character at a time. */
1097
		ch = buf[i];
1098
		ch = buf[i];
1098
1099
1099
		if (*escape_pendingp) {
1100
		/* ANSI terminal escape sequences may appear anywhere in input stream. */
1101
		/* They do not affect our processing of our own escapes. */
1102
		if (ch == 0x1B) {
1103
			last_was_ansi = 1;
1104
		} else if (last_was_ansi) {
1105
			if (ch != '[' && ch != ';' && !isdigit(ch))
1106
				last_was_ansi = 0;
1107
		} else if (*escape_pendingp) {
1100
			/* We have previously seen an escape character. */
1108
			/* We have previously seen an escape character. */
1101
			/* Clear the flag now. */
1109
			/* Clear the flag now. */
1102
			*escape_pendingp = 0;
1110
			*escape_pendingp = 0;
Lines 1276-1281 process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, Link Here
1276
					buffer_put_char(bin, escape_char);
1284
					buffer_put_char(bin, escape_char);
1277
					bytes++;
1285
					bytes++;
1278
				}
1286
				}
1287
1288
				/* Record whether escaped character was a newline. */
1289
				last_was_cr = (ch == '\r' || ch == '\n');
1290
1279
				/* Escaped characters fall through here */
1291
				/* Escaped characters fall through here */
1280
				break;
1292
				break;
1281
			}
1293
			}
Lines 1292-1304 process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, Link Here
1292
				*escape_pendingp = 1;
1304
				*escape_pendingp = 1;
1293
				continue;
1305
				continue;
1294
			}
1306
			}
1307
1308
			/* It wasn't an escape, was it a newline? */
1309
			last_was_cr = (ch == '\r' || ch == '\n');
1295
		}
1310
		}
1296
1311
1297
		/*
1312
		/* Normal character.  Append it to the buffer. */
1298
		 * Normal character.  Record whether it was a newline,
1299
		 * and append it to the buffer.
1300
		 */
1301
		last_was_cr = (ch == '\r' || ch == '\n');
1302
		buffer_put_char(bin, ch);
1313
		buffer_put_char(bin, ch);
1303
		bytes++;
1314
		bytes++;
1304
	}
1315
	}
Lines 1495-1500 client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) Link Here
1495
	/* Initialize variables. */
1506
	/* Initialize variables. */
1496
	escape_pending1 = 0;
1507
	escape_pending1 = 0;
1497
	last_was_cr = 1;
1508
	last_was_cr = 1;
1509
	last_was_ansi = 0;
1498
	exit_status = -1;
1510
	exit_status = -1;
1499
	stdin_eof = 0;
1511
	stdin_eof = 0;
1500
	buffer_high = 64 * 1024;
1512
	buffer_high = 64 * 1024;
1501
- 

Return to bug 2478