- print the line discipline using the new ioctl
- print the queue size
This commit is contained in:
parent
dffa067438
commit
700d3ab22a
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: extern.h,v 1.12 2011/08/29 14:51:19 joerg Exp $ */
|
/* $NetBSD: extern.h,v 1.13 2013/09/12 19:47:23 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -43,7 +43,7 @@ void gread(struct termios *, char *);
|
|||||||
int ksearch(char ***, struct info *);
|
int ksearch(char ***, struct info *);
|
||||||
int msearch(char ***, struct info *);
|
int msearch(char ***, struct info *);
|
||||||
void optlist(void);
|
void optlist(void);
|
||||||
void print(struct termios *, struct winsize *, int, enum FMT);
|
void print(struct termios *, struct winsize *, int, const char *, enum FMT);
|
||||||
__dead void usage(void);
|
__dead void usage(void);
|
||||||
|
|
||||||
extern const struct cchar cchars1[], cchars2[];
|
extern const struct cchar cchars1[], cchars2[];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: key.c,v 1.20 2004/04/01 16:10:03 tsarna Exp $ */
|
/* $NetBSD: key.c,v 1.21 2013/09/12 19:47:23 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991, 1993, 1994
|
* Copyright (c) 1991, 1993, 1994
|
||||||
@ -34,7 +34,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)key.c 8.4 (Berkeley) 2/20/95";
|
static char sccsid[] = "@(#)key.c 8.4 (Berkeley) 2/20/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: key.c,v 1.20 2004/04/01 16:10:03 tsarna Exp $");
|
__RCSID("$NetBSD: key.c,v 1.21 2013/09/12 19:47:23 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ ksearch(char ***argvp, struct info *ip)
|
|||||||
void
|
void
|
||||||
f_all(struct info *ip)
|
f_all(struct info *ip)
|
||||||
{
|
{
|
||||||
print(&ip->t, &ip->win, ip->ldisc, STTY_BSD);
|
print(&ip->t, &ip->win, ip->queue, ip->ldisc, STTY_BSD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -185,7 +185,7 @@ f_dec(struct info *ip)
|
|||||||
void
|
void
|
||||||
f_everything(struct info *ip)
|
f_everything(struct info *ip)
|
||||||
{
|
{
|
||||||
print(&ip->t, &ip->win, ip->ldisc, STTY_BSD);
|
print(&ip->t, &ip->win, ip->queue, ip->ldisc, STTY_BSD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: print.c,v 1.22 2005/06/26 19:10:49 christos Exp $ */
|
/* $NetBSD: print.c,v 1.23 2013/09/12 19:47:23 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991, 1993, 1994
|
* Copyright (c) 1991, 1993, 1994
|
||||||
@ -34,7 +34,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
|
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: print.c,v 1.22 2005/06/26 19:10:49 christos Exp $");
|
__RCSID("$NetBSD: print.c,v 1.23 2013/09/12 19:47:23 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -52,7 +52,8 @@ static void bput(const char *);
|
|||||||
static const char *ccval(const struct cchar *, int);
|
static const char *ccval(const struct cchar *, int);
|
||||||
|
|
||||||
void
|
void
|
||||||
print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
|
print(struct termios *tp, struct winsize *wp, int queue, const char *ldisc,
|
||||||
|
enum FMT fmt)
|
||||||
{
|
{
|
||||||
const struct cchar *p;
|
const struct cchar *p;
|
||||||
long tmp;
|
long tmp;
|
||||||
@ -62,29 +63,6 @@ print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
|
|||||||
|
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
|
||||||
/* Line discipline. */
|
|
||||||
#ifdef TTYDISC
|
|
||||||
if (ldisc != TTYDISC) {
|
|
||||||
switch(ldisc) {
|
|
||||||
case TABLDISC:
|
|
||||||
cnt += printf("tablet disc; ");
|
|
||||||
break;
|
|
||||||
case SLIPDISC:
|
|
||||||
cnt += printf("slip disc; ");
|
|
||||||
break;
|
|
||||||
case PPPDISC:
|
|
||||||
cnt += printf("ppp disc; ");
|
|
||||||
break;
|
|
||||||
case STRIPDISC:
|
|
||||||
cnt += printf("strip disc; ");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cnt += printf("#%d disc; ", ldisc);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Line speed. */
|
/* Line speed. */
|
||||||
ispeed = cfgetispeed(tp);
|
ispeed = cfgetispeed(tp);
|
||||||
ospeed = cfgetospeed(tp);
|
ospeed = cfgetospeed(tp);
|
||||||
@ -93,8 +71,14 @@ print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
|
|||||||
printf("ispeed %d baud; ospeed %d baud;", ispeed, ospeed);
|
printf("ispeed %d baud; ospeed %d baud;", ispeed, ospeed);
|
||||||
else
|
else
|
||||||
cnt += printf("speed %d baud;", ispeed);
|
cnt += printf("speed %d baud;", ispeed);
|
||||||
if (fmt >= STTY_BSD)
|
if (fmt >= STTY_BSD) {
|
||||||
cnt += printf(" %d rows; %d columns;", wp->ws_row, wp->ws_col);
|
cnt += printf(" %d rows; %d columns;", wp->ws_row, wp->ws_col);
|
||||||
|
if (queue)
|
||||||
|
cnt += printf(" queue = %d;", queue);
|
||||||
|
if (ldisc)
|
||||||
|
cnt += printf(" line = %s;", ldisc);
|
||||||
|
}
|
||||||
|
|
||||||
if (cnt)
|
if (cnt)
|
||||||
(void)printf("\n");
|
(void)printf("\n");
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: stty.c,v 1.22 2012/06/20 10:09:43 wiz Exp $ */
|
/* $NetBSD: stty.c,v 1.23 2013/09/12 19:47:23 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1989, 1991, 1993, 1994
|
* Copyright (c) 1989, 1991, 1993, 1994
|
||||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1991, 1993, 1994\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)stty.c 8.3 (Berkeley) 4/2/94";
|
static char sccsid[] = "@(#)stty.c 8.3 (Berkeley) 4/2/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: stty.c,v 1.22 2012/06/20 10:09:43 wiz Exp $");
|
__RCSID("$NetBSD: stty.c,v 1.23 2013/09/12 19:47:23 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -58,8 +58,6 @@ __RCSID("$NetBSD: stty.c,v 1.22 2012/06/20 10:09:43 wiz Exp $");
|
|||||||
#include "stty.h"
|
#include "stty.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
int main(int, char *[]);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -99,12 +97,14 @@ main(int argc, char *argv[])
|
|||||||
args: argc -= optind;
|
args: argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0)
|
if (ioctl(i.fd, TIOCGLINED, i.ldisc) < 0)
|
||||||
err(1, "TIOCGETD");
|
err(1, "TIOCGLINED");
|
||||||
if (tcgetattr(i.fd, &i.t) < 0)
|
if (tcgetattr(i.fd, &i.t) < 0)
|
||||||
err(1, "tcgetattr");
|
err(1, "tcgetattr");
|
||||||
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
|
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
|
||||||
warn("TIOCGWINSZ");
|
warn("TIOCGWINSZ");
|
||||||
|
if (ioctl(i.fd, TIOCGQSIZE, &i.queue) < 0)
|
||||||
|
warn("TIOCGQSIZE");
|
||||||
|
|
||||||
switch(fmt) {
|
switch(fmt) {
|
||||||
case STTY_NOTSET:
|
case STTY_NOTSET:
|
||||||
@ -113,7 +113,7 @@ args: argc -= optind;
|
|||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case STTY_BSD:
|
case STTY_BSD:
|
||||||
case STTY_POSIX:
|
case STTY_POSIX:
|
||||||
print(&i.t, &i.win, i.ldisc, fmt);
|
print(&i.t, &i.win, i.queue, i.ldisc, fmt);
|
||||||
break;
|
break;
|
||||||
case STTY_GFLAG:
|
case STTY_GFLAG:
|
||||||
gprint(&i.t);
|
gprint(&i.t);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: stty.h,v 1.10 2003/08/07 09:05:42 agc Exp $ */
|
/* $NetBSD: stty.h,v 1.11 2013/09/12 19:47:23 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -39,7 +39,8 @@
|
|||||||
|
|
||||||
struct info {
|
struct info {
|
||||||
int fd; /* file descriptor */
|
int fd; /* file descriptor */
|
||||||
int ldisc; /* line discipline */
|
linedn_t ldisc; /* line discipline */
|
||||||
|
int queue; /* queue size */
|
||||||
int off; /* turn off */
|
int off; /* turn off */
|
||||||
int set; /* need set */
|
int set; /* need set */
|
||||||
int wset; /* need window set */
|
int wset; /* need window set */
|
||||||
|
Loading…
Reference in New Issue
Block a user