mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-14 17:47:33 -05:00
New system for handling SSH terminal modes.
I've introduced a new POD struct type 'ssh_ttymodes' which stores an encoding of everything you can specify in the "pty-req" packet or the SSH-1 equivalent. This allows me to split up write_ttymodes_to_packet_from_conf() into two separate functions, one to parse all the ttymode data out of a Conf (and a Seat for fallback) and return one of those structures, and the other to write it into an SSH packet. While I'm at it, I've moved the special case of terminal speeds into the same mechanism, simplifying the call sites in both versions of the SSH protocol. The new master definition of all terminal modes lives in a header file, with an ifdef around each item, so that later on I'll be able to include it in a context that only enumerates the modes supported by the particular target Unix platform.
This commit is contained in:
@ -1593,13 +1593,8 @@ static void ssh2channel_request_pty(
|
||||
{
|
||||
struct ssh2_channel *c = container_of(sc, struct ssh2_channel, sc);
|
||||
struct ssh2_connection_state *s = c->connlayer;
|
||||
int ospeed, ispeed;
|
||||
strbuf *modebuf;
|
||||
|
||||
ospeed = ispeed = 38400; /* last-resort defaults */
|
||||
sscanf(conf_get_str(conf, CONF_termspeed), "%d,%d",
|
||||
&ospeed, &ispeed);
|
||||
|
||||
PktOut *pktout = ssh2_chanreq_init(
|
||||
c, "pty-req", want_reply ? ssh2_channel_response : NULL, NULL);
|
||||
put_stringz(pktout, conf_get_str(conf, CONF_termtype));
|
||||
@ -1608,9 +1603,9 @@ static void ssh2channel_request_pty(
|
||||
put_uint32(pktout, 0); /* pixel width */
|
||||
put_uint32(pktout, 0); /* pixel height */
|
||||
modebuf = strbuf_new();
|
||||
write_ttymodes_to_packet_from_conf(
|
||||
BinarySink_UPCAST(modebuf), s->ppl.seat, conf,
|
||||
2, ospeed, ispeed);
|
||||
write_ttymodes_to_packet(
|
||||
BinarySink_UPCAST(modebuf), 2,
|
||||
get_ttymodes_from_conf(s->ppl.seat, conf));
|
||||
put_stringsb(pktout, modebuf);
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
}
|
||||
|
Reference in New Issue
Block a user