Print protocol attach flags in debug output

This commit is contained in:
Marc André Tanner 2016-01-06 14:55:49 +01:00
parent 3e9a3fdf4d
commit 160de0ceb7
1 changed files with 6 additions and 2 deletions

View File

@ -26,12 +26,16 @@ static void print_packet(const char *prefix, Packet *pkt) {
fprintf(stderr, "%s: %s ", prefix, type);
switch (pkt->type) {
case MSG_CONTENT:
for (size_t i = 0; i < pkt->len && i < sizeof(pkt->u.msg); i++)
fprintf(stderr, "%c", pkt->u.msg[i]);
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);
break;
case MSG_ATTACH:
fprintf(stderr, "readonly: %d low-priority: %d",
pkt->u.i & CLIENT_READONLY,
pkt->u.i & CLIENT_LOWPRIORITY);
break;
default:
fprintf(stderr, "len: %zu", pkt->len);
break;