diff --git a/abduco.c b/abduco.c index 0ac2774..b218945 100644 --- a/abduco.c +++ b/abduco.c @@ -15,6 +15,7 @@ */ #include #include +#include #include #include #include @@ -71,12 +72,15 @@ enum PacketType { }; typedef struct { - unsigned int type; - size_t len; + uint32_t type; + uint32_t len; union { char msg[BUFSIZ]; - struct winsize ws; - int i; + struct { + uint16_t rows; + uint16_t cols; + } ws; + uint32_t i; } u; } Packet; diff --git a/client.c b/client.c index 744f061..2c2192b 100644 --- a/client.c +++ b/client.c @@ -78,7 +78,7 @@ static int client_mainloop(void) { if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) { Packet pkt = { .type = MSG_RESIZE, - .u = { .ws = ws }, + .u = { .ws = { .rows = ws.ws_row, .cols = ws.ws_col } }, .len = sizeof(ws), }; if (client_send_packet(&pkt)) diff --git a/debug.c b/debug.c index b5748ab..e904e33 100644 --- a/debug.c +++ b/debug.c @@ -29,7 +29,7 @@ static void print_packet(const char *prefix, Packet *pkt) { fwrite(pkt->u.msg, pkt->len, 1, stderr); break; case MSG_RESIZE: - fprintf(stderr, "%dx%d", pkt->u.ws.ws_col, pkt->u.ws.ws_row); + fprintf(stderr, "%"PRIu16"x%"PRIu16, pkt->u.ws.cols, pkt->u.ws.rows); break; case MSG_ATTACH: fprintf(stderr, "readonly: %d low-priority: %d", @@ -37,7 +37,7 @@ static void print_packet(const char *prefix, Packet *pkt) { pkt->u.i & CLIENT_LOWPRIORITY); break; default: - fprintf(stderr, "len: %zu", pkt->len); + fprintf(stderr, "len: %"PRIu32, pkt->len); break; } fprintf(stderr, "\n"); diff --git a/server.c b/server.c index 78ccbe2..6f62cfb 100644 --- a/server.c +++ b/server.c @@ -224,7 +224,10 @@ static void server_mainloop(void) { case MSG_REDRAW: if (!(c->flags & CLIENT_READONLY) && (client_packet.type == MSG_REDRAW || c == server.clients)) { debug("server-ioct: TIOCSWINSZ\n"); - ioctl(server.pty, TIOCSWINSZ, &client_packet.u.ws); + struct winsize ws = { 0 }; + ws.ws_row = client_packet.u.ws.rows; + ws.ws_col = client_packet.u.ws.cols; + ioctl(server.pty, TIOCSWINSZ, &ws); } kill(-server.pid, SIGWINCH); break;