Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/ttyio Make the test case independend of stdin...



details:   https://anonhg.NetBSD.org/src/rev/cfebf6237fe4
branches:  trunk
changeset: 764398:cfebf6237fe4
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 19 20:07:53 2011 +0000

description:
Make the test case independend of stdin being a terminal

diffstat:

 tests/lib/libc/ttyio/t_ttyio.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 4eabb6c20a22 -r cfebf6237fe4 tests/lib/libc/ttyio/t_ttyio.c
--- a/tests/lib/libc/ttyio/t_ttyio.c    Tue Apr 19 18:34:39 2011 +0000
+++ b/tests/lib/libc/ttyio/t_ttyio.c    Tue Apr 19 20:07:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ttyio.c,v 1.1 2011/01/07 02:47:41 pgoyette Exp $ */
+/*     $NetBSD: t_ttyio.c,v 1.2 2011/04/19 20:07:53 martin Exp $ */
 
 /*
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ttyio.c,v 1.1 2011/01/07 02:47:41 pgoyette Exp $");
+__RCSID("$NetBSD: t_ttyio.c,v 1.2 2011/04/19 20:07:53 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -85,8 +85,15 @@
        /* unbuffer stdout */
        setbuf(stdout, NULL);
 
-       /* get terminal settings for later use */
-       REQUIRE_ERRNO(tcgetattr(STDIN_FILENO, &term), -1);
+       /*
+        * Create default termios settings for later use
+        */
+       memset(&term, 0, sizeof(term));
+       term.c_iflag = TTYDEF_IFLAG;
+       term.c_oflag = TTYDEF_OFLAG;
+       term.c_cflag = TTYDEF_CFLAG;
+       term.c_lflag = TTYDEF_LFLAG;
+       cfsetspeed(&term, TTYDEF_SPEED);
 
        /* get a tty */
        REQUIRE_ERRNO(openpty(&m, &s, name, &term, NULL), -1);



Home | Main Index | Thread Index | Old Index