Module Name:    src
Committed By:   christos
Date:           Thu Sep 12 19:47:23 UTC 2013

Modified Files:
        src/bin/stty: extern.h key.c print.c stty.c stty.h

Log Message:
- print the line discipline using the new ioctl
- print the queue size


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/stty/extern.h
cvs rdiff -u -r1.20 -r1.21 src/bin/stty/key.c
cvs rdiff -u -r1.22 -r1.23 src/bin/stty/print.c src/bin/stty/stty.c
cvs rdiff -u -r1.10 -r1.11 src/bin/stty/stty.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/stty/extern.h
diff -u src/bin/stty/extern.h:1.12 src/bin/stty/extern.h:1.13
--- src/bin/stty/extern.h:1.12	Mon Aug 29 10:51:19 2011
+++ src/bin/stty/extern.h	Thu Sep 12 15:47:23 2013
@@ -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
@@ -43,7 +43,7 @@ void	gread(struct termios *, char *);
 int	ksearch(char ***, struct info *);
 int	msearch(char ***, struct info *);
 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);
 
 extern const struct cchar cchars1[], cchars2[];

Index: src/bin/stty/key.c
diff -u src/bin/stty/key.c:1.20 src/bin/stty/key.c:1.21
--- src/bin/stty/key.c:1.20	Thu Apr  1 11:10:03 2004
+++ src/bin/stty/key.c	Thu Sep 12 15:47:23 2013
@@ -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
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)key.c	8.4 (Berkeley) 2/20/95";
 #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 /* not lint */
 
@@ -146,7 +146,7 @@ ksearch(char ***argvp, struct info *ip)
 void
 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
@@ -185,7 +185,7 @@ f_dec(struct info *ip)
 void
 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

Index: src/bin/stty/print.c
diff -u src/bin/stty/print.c:1.22 src/bin/stty/print.c:1.23
--- src/bin/stty/print.c:1.22	Sun Jun 26 15:10:49 2005
+++ src/bin/stty/print.c	Thu Sep 12 15:47:23 2013
@@ -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
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";
 #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 /* not lint */
 
@@ -52,7 +52,8 @@ static void bput(const char *);
 static const char *ccval(const struct cchar *, int);
 
 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;
 	long tmp;
@@ -62,29 +63,6 @@ print(struct termios *tp, struct winsize
 
 	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. */
 	ispeed = cfgetispeed(tp);
 	ospeed = cfgetospeed(tp);
@@ -93,8 +71,14 @@ print(struct termios *tp, struct winsize
 		    printf("ispeed %d baud; ospeed %d baud;", ispeed, ospeed);
 	else
 		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);
+		if (queue)
+			cnt += printf(" queue = %d;", queue);
+		if (ldisc)
+			cnt += printf(" line = %s;", ldisc);
+	}
+
 	if (cnt)
 		(void)printf("\n");
 
Index: src/bin/stty/stty.c
diff -u src/bin/stty/stty.c:1.22 src/bin/stty/stty.c:1.23
--- src/bin/stty/stty.c:1.22	Wed Jun 20 06:09:43 2012
+++ src/bin/stty/stty.c	Thu Sep 12 15:47:23 2013
@@ -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
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)stty.c	8.3 (Berkeley) 4/2/94";
 #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 /* not lint */
 
@@ -58,8 +58,6 @@ __RCSID("$NetBSD: stty.c,v 1.22 2012/06/
 #include "stty.h"
 #include "extern.h"
 
-int main(int, char *[]);
-
 int
 main(int argc, char *argv[])
 {
@@ -99,12 +97,14 @@ main(int argc, char *argv[])
 args:	argc -= optind;
 	argv += optind;
 
-	if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0)
-		err(1, "TIOCGETD");
+	if (ioctl(i.fd, TIOCGLINED, i.ldisc) < 0)
+		err(1, "TIOCGLINED");
 	if (tcgetattr(i.fd, &i.t) < 0)
 		err(1, "tcgetattr");
 	if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
 		warn("TIOCGWINSZ");
+	if (ioctl(i.fd, TIOCGQSIZE, &i.queue) < 0)
+		warn("TIOCGQSIZE");
 
 	switch(fmt) {
 	case STTY_NOTSET:
@@ -113,7 +113,7 @@ args:	argc -= optind;
 		/* FALLTHROUGH */
 	case STTY_BSD:
 	case STTY_POSIX:
-		print(&i.t, &i.win, i.ldisc, fmt);
+		print(&i.t, &i.win, i.queue, i.ldisc, fmt);
 		break;
 	case STTY_GFLAG:
 		gprint(&i.t);

Index: src/bin/stty/stty.h
diff -u src/bin/stty/stty.h:1.10 src/bin/stty/stty.h:1.11
--- src/bin/stty/stty.h:1.10	Thu Aug  7 05:05:42 2003
+++ src/bin/stty/stty.h	Thu Sep 12 15:47:23 2013
@@ -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
@@ -39,7 +39,8 @@
 
 struct info {
 	int fd;					/* file descriptor */
-	int ldisc;				/* line discipline */
+	linedn_t ldisc;				/* line discipline */
+	int queue;				/* queue size */
 	int off;				/* turn off */
 	int set;				/* need set */
 	int wset;				/* need window set */

Reply via email to