/****************************************************************************
- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2012,2017 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: test_getstr.c,v 1.9 2009/08/29 19:02:25 tom Exp $
+ * $Id: test_getstr.c,v 1.11 2017/04/15 14:14:37 tom Exp $
*
* Author: Thomas E Dickey
*
eMaxFlavor
} Flavors;
+/*
+ * Return-code is OK/ERR or a keyname.
+ */
+static const char *
+ok_keyname(int code)
+{
+ return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code)));
+}
+
static bool
Quit(int ch)
{
}
static int
-test_getstr(int level, char **argv, WINDOW *strwin)
+recursive_test(int level, char **argv, WINDOW *strwin)
{
WINDOW *txtbox = 0;
WINDOW *txtwin = 0;
break;
case 'w':
- test_getstr(level + 1, argv, strwin);
+ recursive_test(level + 1, argv, strwin);
if (txtbox != 0) {
touchwin(txtbox);
wnoutrefresh(txtbox);
}
noecho();
(void) wattrset(txtwin, A_NORMAL);
- wprintw(strwin, "%d:%s", rc, buffer);
+ wprintw(strwin, "%s:%s", ok_keyname(rc), buffer);
wnoutrefresh(strwin);
break;
default:
strwin = derwin(chrbox, 4, COLS - 2, 1, 1);
- test_getstr(1, argv, strwin);
+ recursive_test(1, argv, strwin);
endwin();
ExitProgram(EXIT_SUCCESS);