projects
/
ncurses.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ncurses 5.9 - patch 20140831
[ncurses.git]
/
test
/
inchs.c
diff --git
a/test/inchs.c
b/test/inchs.c
index 180d3245db3388be1c9c268b93ce3ae8922d69f7..be3aab86f57829499c1b4d4156414023868dd040 100644
(file)
--- a/
test/inchs.c
+++ b/
test/inchs.c
@@
-1,5
+1,5
@@
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2007
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 *
* *
* 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. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: inchs.c,v 1.
9 2007/07/21 19:01:43
tom Exp $
+ * $Id: inchs.c,v 1.
12 2012/11/18 01:58:15
tom Exp $
*
* Author: Thomas E Dickey
*/
*
* Author: Thomas E Dickey
*/
@@
-50,6
+50,16
@@
#define BASE_Y 7
#define MAX_COLS 1024
#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)
{
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;
}
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 */
keypad(txtwin, TRUE); /* enable keyboard mapping */
(void) cbreak(); /* take input chars one at a time, no wait for \n */
@@
-152,16
+164,16
@@
test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
break;
}
break;
}
-
mvwp
rintw(chrwin, 0, 0, "char:");
+
MvWP
rintw(chrwin, 0, 0, "char:");
wclrtoeol(chrwin);
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
wclrtoeol(chrwin);
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
- if ((ch = winch(txtwin)) != ERR) {
+ if ((ch =
(int)
winch(txtwin)) != ERR) {
if (waddch(chrwin, (chtype) ch) != ERR) {
for (j = txt_x + 1; j < getmaxx(txtwin); ++j) {
if (waddch(chrwin, (chtype) ch) != ERR) {
for (j = txt_x + 1; j < getmaxx(txtwin); ++j) {
- if ((ch = mvwinch(txtwin, txt_y, j)) != ERR) {
+ if ((ch =
(int)
mvwinch(txtwin, txt_y, j)) != ERR) {
if (waddch(chrwin, (chtype) ch) == ERR) {
break;
}
if (waddch(chrwin, (chtype) ch) == ERR) {
break;
}
@@
-174,10
+186,10
@@
test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
} else {
move(txt_y, txt_x);
} else {
move(txt_y, txt_x);
- if ((ch = inch()) != ERR) {
+ if ((ch =
(int)
inch()) != ERR) {
if (waddch(chrwin, (chtype) ch) != ERR) {
for (j = txt_x + 1; j < getmaxx(txtwin); ++j) {
if (waddch(chrwin, (chtype) ch) != ERR) {
for (j = txt_x + 1; j < getmaxx(txtwin); ++j) {
- if ((ch = mvinch(txt_y, j)) != ERR) {
+ if ((ch =
(int)
mvinch(txt_y, j)) != ERR) {
if (waddch(chrwin, (chtype) ch) == ERR) {
break;
}
if (waddch(chrwin, (chtype) ch) == ERR) {
break;
}
@@
-190,7
+202,7
@@
test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
}
wnoutrefresh(chrwin);
}
wnoutrefresh(chrwin);
-
mvwp
rintw(strwin, 0, 0, "text:");
+
MvWP
rintw(strwin, 0, 0, "text:");
wclrtobot(strwin);
limit = getmaxx(strwin) - 5;
wclrtobot(strwin);
limit = getmaxx(strwin) - 5;
@@
-198,38
+210,38
@@
test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
if (winchstr(txtwin, text) != ERR) {
if (txtwin != stdscr) {
wmove(txtwin, txt_y, txt_x);
if (winchstr(txtwin, text) != ERR) {
-
mvwaddchs
tr(strwin, 0, 5, text);
+
MvWAddChS
tr(strwin, 0, 5, text);
}
wmove(txtwin, txt_y, txt_x);
if (winchnstr(txtwin, text, limit) != ERR) {
}
wmove(txtwin, txt_y, txt_x);
if (winchnstr(txtwin, text, limit) != ERR) {
-
mvwaddchs
tr(strwin, 1, 5, text);
+
MvWAddChS
tr(strwin, 1, 5, text);
}
if (mvwinchstr(txtwin, txt_y, txt_x, text) != ERR) {
}
if (mvwinchstr(txtwin, txt_y, txt_x, text) != ERR) {
-
mvwaddchs
tr(strwin, 2, 5, text);
+
MvWAddChS
tr(strwin, 2, 5, text);
}
if (mvwinchnstr(txtwin, txt_y, txt_x, text, limit) != ERR) {
}
if (mvwinchnstr(txtwin, txt_y, txt_x, text, limit) != ERR) {
-
mvwaddchs
tr(strwin, 3, 5, text);
+
MvWAddChS
tr(strwin, 3, 5, text);
}
} else {
move(txt_y, txt_x);
if (inchstr(text) != ERR) {
}
} else {
move(txt_y, txt_x);
if (inchstr(text) != ERR) {
-
mvwaddchs
tr(strwin, 0, 5, text);
+
MvWAddChS
tr(strwin, 0, 5, text);
}
move(txt_y, txt_x);
if (inchnstr(text, limit) != ERR) {
}
move(txt_y, txt_x);
if (inchnstr(text, limit) != ERR) {
-
mvwaddchs
tr(strwin, 1, 5, text);
+
MvWAddChS
tr(strwin, 1, 5, text);
}
if (mvinchstr(txt_y, txt_x, text) != ERR) {
}
if (mvinchstr(txt_y, txt_x, text) != ERR) {
-
mvwaddchs
tr(strwin, 2, 5, text);
+
MvWAddChS
tr(strwin, 2, 5, text);
}
if (mvinchnstr(txt_y, txt_x, text, limit) != ERR) {
}
if (mvinchnstr(txt_y, txt_x, text, limit) != ERR) {
-
mvwaddchs
tr(strwin, 3, 5, text);
+
MvWAddChS
tr(strwin, 3, 5, text);
}
}
}
}