diff --git a/ttynvt.c b/ttynvt.c index c00856e..6594b5f 100644 --- a/ttynvt.c +++ b/ttynvt.c @@ -529,6 +529,36 @@ static int baudrate(speed_t speed) static const char pstr[] = { ' ', 'N', 'O', 'E', 'M', 'S' }; +#define CASE(name) case name: return #name + +static const char *_ioctl_name(int cmd) +{ + static char buf[16]; + + switch (cmd) + { + default: + snprintf(buf, sizeof(buf), "0x%x", cmd); + return buf; + CASE(TCSETSF); + CASE(TCSETSW); + CASE(TCSETS); + CASE(TCGETS); + CASE(TIOCINQ); + CASE(TIOCOUTQ); + CASE(TCFLSH); + CASE(TCIFLUSH); + CASE(TCOFLUSH); + CASE(TCIOFLUSH); + CASE(TIOCMGET); + CASE(TIOCMBIS); + CASE(TIOCMBIC); + CASE(TIOCMSET); + CASE(TCSBRK); + CASE(TIOCGWINSZ); + } +} + static void ttynvt_ioctl(fuse_req_t req, int cmd, void *arg, struct fuse_file_info *info, unsigned int flags, @@ -542,6 +572,10 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg, }; int val; + DBG("%s: cmd=%s arg=%p ibuf=%p:%u obuf=:%u\n", __func__, + _ioctl_name(cmd), arg, in_buf, + (unsigned int)in_bufsz, (unsigned int)out_bufsz); + switch (cmd) { case TCSETSF: