diff options
author | Xin LI <delphij@FreeBSD.org> | 2014-03-01 00:40:26 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2014-03-01 00:40:26 +0000 |
commit | cea297eb34d2361e79529034397465068ae34ecd (patch) | |
tree | fbc3775582ebd1e6f026931751cfab6c588b643c /test/inchs.c | |
parent | 6826a395a618014c4541ff6a654be0d3afb392a1 (diff) |
Notes
Diffstat (limited to 'test/inchs.c')
-rw-r--r-- | test/inchs.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/inchs.c b/test/inchs.c index f07a2bdabd0d..be3aab86f578 100644 --- a/test/inchs.c +++ b/test/inchs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 2007-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inchs.c,v 1.11 2010/11/13 23:41:23 tom Exp $ + * $Id: inchs.c,v 1.12 2012/11/18 01:58:15 tom Exp $ * * Author: Thomas E Dickey */ @@ -50,6 +50,16 @@ #define BASE_Y 7 #define MAX_COLS 1024 +static void +failed(const char *s) +{ + int save = errno; + endwin(); + errno = save; + perror(s); + ExitProgram(EXIT_FAILURE); +} + static bool Quit(int ch) { @@ -87,6 +97,8 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) txtwin = stdscr; base_y = BASE_Y; } + if (txtwin == 0) + failed("cannot create txtwin"); keypad(txtwin, TRUE); /* enable keyboard mapping */ (void) cbreak(); /* take input chars one at a time, no wait for \n */ |