Module Name:    src
Committed By:   martin
Date:           Tue Apr 19 20:07:53 UTC 2011

Modified Files:
        src/tests/lib/libc/ttyio: t_ttyio.c

Log Message:
Make the test case independend of stdin being a terminal


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/ttyio/t_ttyio.c

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

Modified files:

Index: src/tests/lib/libc/ttyio/t_ttyio.c
diff -u src/tests/lib/libc/ttyio/t_ttyio.c:1.1 src/tests/lib/libc/ttyio/t_ttyio.c:1.2
--- src/tests/lib/libc/ttyio/t_ttyio.c:1.1	Fri Jan  7 02:47:41 2011
+++ src/tests/lib/libc/ttyio/t_ttyio.c	Tue Apr 19 20:07:53 2011
@@ -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);

Reply via email to