Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses/director Manually craft a (default) term...



details:   https://anonhg.NetBSD.org/src/rev/9c25930eabe6
branches:  trunk
changeset: 764399:9c25930eabe6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 19 20:13:55 2011 +0000

description:
Manually craft a (default) termios description instead of trying to fetch
one from stdin - ATF tests should not rely on stdin being a terminal.

diffstat:

 tests/lib/libcurses/director/director.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r cfebf6237fe4 -r 9c25930eabe6 tests/lib/libcurses/director/director.c
--- a/tests/lib/libcurses/director/director.c   Tue Apr 19 20:07:53 2011 +0000
+++ b/tests/lib/libcurses/director/director.c   Tue Apr 19 20:13:55 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: director.c,v 1.2 2011/04/11 22:37:10 joerg Exp $       */
+/*     $NetBSD: director.c,v 1.3 2011/04/19 20:13:55 martin Exp $      */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -190,8 +190,15 @@
                exit(2);
        }
 
-       if (tcgetattr(0, &term_attr) < 0)
-               err(2, "Failed to get term attributes");
+       /*
+        * Create default termios settings for later use
+        */
+       memset(&term_attr, 0, sizeof(term_attr));
+       term_attr.c_iflag = TTYDEF_IFLAG;
+       term_attr.c_oflag = TTYDEF_OFLAG;
+       term_attr.c_cflag = TTYDEF_CFLAG;
+       term_attr.c_lflag = TTYDEF_LFLAG;
+       cfsetspeed(&term_attr, TTYDEF_SPEED);
 
        if ((slave_pid = forkpty(&master, NULL, &term_attr, NULL)) < 0) {
                fprintf(stderr, "Fork of pty for slave failed\n");



Home | Main Index | Thread Index | Old Index