Fix the non working unctrl mess:

1. delete the incorrect duplicate macro from unctrl.h
2. move unctrl macros from curses.h to unctrl.h and make curses.h include
   unctrl.h in curses.h instead of duplicating their definition.
3. constify unctrl arrays; make length unsigned.
This commit is contained in:
christos 2004-02-14 18:23:45 +00:00
parent f34a72662f
commit 146f07a922
3 changed files with 23 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.h,v 1.81 2003/12/23 23:12:44 christos Exp $ */
/* $NetBSD: curses.h,v 1.82 2004/02/14 18:23:45 christos Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -181,12 +181,7 @@ typedef char bool;
#define KEY_MOUSE 0x199 /* Mouse event has occurred */
#define KEY_MAX 0x199 /* maximum extended key value */
/* 8-bit ASCII characters. */
#define unctrl(c) __unctrl[((unsigned)c) & 0xff]
#define unctrllen(ch) __unctrllen[((unsigned)ch) & 0xff]
extern char *__unctrl[256]; /* Control strings. */
extern char __unctrllen[256]; /* Control strings length. */
#include <unctrl.h>
/*
* A window an array of __LINE structures pointed to by the 'lines' pointer.

View File

@ -1,4 +1,4 @@
/* $NetBSD: unctrl.c,v 1.9 2003/08/07 16:44:25 agc Exp $ */
/* $NetBSD: unctrl.c,v 1.10 2004/02/14 18:23:45 christos Exp $ */
/*
* Copyright (c) 1981, 1993
@ -34,11 +34,13 @@
#if 0
static char sccsid[] = "@(#)unctrl.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: unctrl.c,v 1.9 2003/08/07 16:44:25 agc Exp $");
__RCSID("$NetBSD: unctrl.c,v 1.10 2004/02/14 18:23:45 christos Exp $");
#endif
#endif /* not lint */
#endif /* not lint */
char *__unctrl[256] = {
#include <unctrl.h>
const char * const __unctrl[256] = {
"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
"^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O",
"^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
@ -74,7 +76,7 @@ char *__unctrl[256] = {
"0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff",
};
char __unctrllen[256] = {
const unsigned char __unctrllen[256] = {
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,

View File

@ -1,4 +1,4 @@
/* $NetBSD: unctrl.h,v 1.2 2003/08/07 16:44:25 agc Exp $ */
/* $NetBSD: unctrl.h,v 1.3 2004/02/14 18:23:45 christos Exp $ */
/*
* Copyright (c) 1982, 1993
@ -31,10 +31,18 @@
* @(#)unctrl.h 8.1 (Berkeley) 5/31/93
*/
/*
* unctrl.h
*/
#ifndef _UNCTRL_H_
#define _UNCTRL_H_
extern char *_unctrl[];
#include <sys/cdefs.h>
# define unctrl(ch) (_unctrl[ch & 0177])
__BEGIN_DECLS
extern const char * const __unctrl[]; /* Control strings. */
extern const unsigned char __unctrllen[]; /* Control strings length. */
__END_DECLS
/* 8-bit ASCII characters. */
#define unctrl(c) __unctrl[((unsigned char)c) & 0xff]
#define unctrllen(c) __unctrllen[((unsigned char)c) & 0xff]
#endif /* _UNCTRL_H_ */