aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/tack/scan.c
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2007-01-20 07:32:02 +0000
committerRong-En Fan <rafan@FreeBSD.org>2007-01-20 07:32:02 +0000
commit4a1a95108dd76c4259fe6c37c4471f7969b17983 (patch)
tree1c6c3b549401156e1dbd96b9a6b18521f63ffb58 /contrib/ncurses/tack/scan.c
parent555c9cae3cf9146482732c28c06a73314b618149 (diff)
downloadsrc-4a1a95108dd76c4259fe6c37c4471f7969b17983.tar.gz
src-4a1a95108dd76c4259fe6c37c4471f7969b17983.zip
Import ncurses 5.6-20061217 onto the vender branch
Approved by: delphij
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=166124
Diffstat (limited to 'contrib/ncurses/tack/scan.c')
-rw-r--r--contrib/ncurses/tack/scan.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/contrib/ncurses/tack/scan.c b/contrib/ncurses/tack/scan.c
index d9429c96ee5a..dbe684bd5ce1 100644
--- a/contrib/ncurses/tack/scan.c
+++ b/contrib/ncurses/tack/scan.c
@@ -15,31 +15,32 @@
**
** You should have received a copy of the GNU General Public License
** along with TACK; see the file COPYING. If not, write to
-** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-** Boston, MA 02111-1307, USA.
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+** Boston, MA 02110-1301, USA
*/
/* scan mode keyboard support */
#include <tack.h>
-MODULE_ID("$Id: scan.c,v 1.2 1999/08/21 23:09:35 tom Exp $")
+MODULE_ID("$Id: scan.c,v 1.5 2005/09/17 19:49:16 tom Exp $")
-int scan_max; /* length of longest scan code */
+unsigned scan_max; /* length of longest scan code */
char **scan_up, **scan_down, **scan_name;
-int *scan_tested, *scan_length, *scan_value;
+unsigned *scan_tested, *scan_length;
+static unsigned *scan_value;
static int shift_state;
static char *str;
static int debug_char_count;
-#define SHIFT_KEY 0x100
+#define SHIFT_KEY 0x100
#define CONTROL_KEY 0x200
-#define META_KEY 0x400
-#define CAPS_LOCK 0x800
+#define META_KEY 0x400
+#define CAPS_LOCK 0x800
static const struct {
const char *name;
- int type;
+ unsigned type;
} scan_special[] = {
{"<shift>", SHIFT_KEY},
{"<left shift>", SHIFT_KEY},
@@ -102,6 +103,7 @@ scan_init(char *fn)
char *s, *sl;
FILE *fp;
int ch, i, j;
+ unsigned len;
char home[512];
if ((str = getenv("HOME")))
@@ -140,9 +142,9 @@ scan_init(char *fn)
scan_up = (char **) malloc(sizeof(char *) * MAX_SCAN);
scan_down = (char **) malloc(sizeof(char *) * MAX_SCAN);
scan_name = (char **) malloc(sizeof(char *) * MAX_SCAN);
- scan_tested = (int *) malloc(sizeof(int *) * MAX_SCAN);
- scan_length = (int *) malloc(sizeof(int *) * MAX_SCAN);
- scan_value = (int *) malloc(sizeof(int *) * MAX_SCAN);
+ scan_tested = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN);
+ scan_length = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN);
+ scan_value = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN);
scan_up[0] = scan_down[0] = scan_name[0] = (char *) 0;
str = (char *) malloc(4096); /* buffer space */
sl = str + 4000; /* an upper limit */
@@ -165,11 +167,11 @@ scan_init(char *fn)
scan_name[i] = str;
scan_length[i] = strlen(scan_down[i]);
- ch = strlen(scan_up[i]) + scan_length[i];
- if (ch > scan_max)
- scan_max = ch;
+ len = strlen(scan_up[i]) + scan_length[i];
+ if (len > scan_max)
+ scan_max = len;
- scan_value[i] = scan_name[i][0];
+ scan_value[i] = UChar(scan_name[i][0]);
if (scan_name[i][1]) /* multi-character name */
for (j = 0; scan_special[j].name; j++) {
if (!strcmp(scan_name[i], scan_special[j].name)) {
@@ -202,7 +204,8 @@ int
scan_key(void)
{ /* read a key and translate scan mode to
ASCII */
- int i, j, ch;
+ unsigned i;
+ int j, ch;
char buf[64];
for (i = 1;; i++) {