Multiple fixes:

* Added Bill's fixes for errors when compiling with WARNS=1
* Incorporated fixes to make usage of unctrl consistent in debug and
  made improvements to ctrace - it now timestamps it's output better.
* Reduced the number of mallocs done by __init_getch by allocating key
  structs in bunches instead of singly.
* Removed the shadowing of global declarations in newwin and subwin
  functions
This commit is contained in:
blymn 2000-04-17 12:25:45 +00:00
parent 5c507c46b5
commit ec6e2540fe
11 changed files with 249 additions and 169 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: addnstr.c,v 1.8 2000/04/15 23:36:55 jdc Exp $ */
/* $NetBSD: addnstr.c,v 1.9 2000/04/17 12:25:45 blymn Exp $ */
/*
* Copyright (c) 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addnstr.c,v 1.8 2000/04/15 23:36:55 jdc Exp $");
__RCSID("$NetBSD: addnstr.c,v 1.9 2000/04/17 12:25:45 blymn Exp $");
#endif
#endif /* not lint */
@ -54,12 +54,21 @@ __RCSID("$NetBSD: addnstr.c,v 1.8 2000/04/15 23:36:55 jdc Exp $");
* Add a string to stdscr starting at (_cury, _curx).
*/
int
addstr(s)
const char *s;
addstr(const char *s)
{
return waddnstr(stdscr, s, -1);
}
/*
* waddstr --
* Add a string to the given window starting at (_cury, _curx).
*/
int
waddstr(WINDOW *win, const char *s)
{
return waddnstr(win, s, -1);
}
/*
* addnstr --
* Add a string (at most n characters) to stdscr starting
@ -71,16 +80,6 @@ addnstr(const char *str, int n)
return waddnstr(stdscr, str, n);
}
/*
* mvwaddstr --
* Add a string to the given window.
*/
int
waddstr(WINDOW *win, const char *str)
{
return waddnstr(win, str, -1);
}
/*
* mvaddstr --
* Add a string to stdscr starting at (y, x)

View File

@ -1,4 +1,4 @@
/* $NetBSD: color.c,v 1.4 2000/04/15 22:53:05 jdc Exp $ */
/* $NetBSD: color.c,v 1.5 2000/04/17 12:25:45 blymn Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -106,7 +106,7 @@ can_change_colors(void)
* Initialise colour support.
*/
int
start_color()
start_color(void)
{
int i;
attr_t temp_nc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctrace.c,v 1.8 2000/04/16 01:16:43 thorpej Exp $ */
/* $NetBSD: ctrace.c,v 1.9 2000/04/17 12:25:45 blymn Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93";
#else
__RCSID("$NetBSD: ctrace.c,v 1.8 2000/04/16 01:16:43 thorpej Exp $");
__RCSID("$NetBSD: ctrace.c,v 1.9 2000/04/17 12:25:45 blymn Exp $");
#endif
#endif /* not lint */
@ -51,6 +51,8 @@ __RCSID("$NetBSD: ctrace.c,v 1.8 2000/04/16 01:16:43 thorpej Exp $");
#include <varargs.h>
#endif
#include <sys/time.h>
#include "curses.h"
#ifndef TFILE
@ -68,6 +70,8 @@ __CTRACE(fmt, va_alist)
va_dcl
#endif
{
struct timeval tv;
static int seencr = 1;
va_list ap;
#ifdef __STDC__
va_start(ap, fmt);
@ -78,13 +82,21 @@ va_dcl
tracefp = fopen(TFILE, "w");
if (tracefp == NULL)
return;
(void) vfprintf(tracefp, fmt, ap);
gettimeofday(&tv, NULL);
if (seencr) {
gettimeofday(&tv, NULL);
(void) fprintf(tracefp, "%lu.%06lu: ", tv.tv_sec, tv.tv_usec);
}
(void) vfprintf(tracefp, fmt, ap);
seencr = (strchr(fmt, '\n') != NULL);
va_end(ap);
(void) fflush(tracefp);
}
#else
/* this kills the empty translation unit message from lint... */
void __cursesi_make_lint_shut_up_if_debug_not_defined(void);
void
__cursesi_make_lint_shut_up_if_debug_not_defined(void);
void
__cursesi_make_lint_shut_up_if_debug_not_defined(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.c,v 1.13 2000/04/12 21:46:49 jdc Exp $ */
/* $NetBSD: curses.c,v 1.14 2000/04/17 12:25:45 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: curses.c,v 1.13 2000/04/12 21:46:49 jdc Exp $");
__RCSID("$NetBSD: curses.c,v 1.14 2000/04/17 12:25:45 blymn Exp $");
#endif
#endif /* not lint */
@ -78,7 +78,7 @@ int LINES; /* Lines on the screen. */
int COLORS; /* Maximum colors on the screen */
int COLOR_PAIRS; /* Maximum color pairs on the screen */
int My_term = 0; /* Use Def_term regardless. */
char *Def_term = "unknown"; /* Default terminal type. */
const char *Def_term = "unknown"; /* Default terminal type. */
char GT; /* Gtty indicates tabs. */
char NONL; /* Term can't hack LF doing a CR. */
char UPPERCASE; /* Terminal is uppercase only. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.h,v 1.36 2000/04/16 09:52:49 jdc Exp $ */
/* $NetBSD: curses.h,v 1.37 2000/04/17 12:25:45 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -85,7 +85,7 @@ extern char NONL; /* Term can't hack LF doing a CR. */
extern char UPPERCASE; /* Terminal is uppercase only. */
extern int My_term; /* Use Def_term regardless. */
extern char *Def_term; /* Default terminal type. */
extern const char *Def_term; /* Default terminal type. */
/* Termcap capabilities. */
extern char AM, BE, BS, CA, CC, DA, EO, HC, HL, IN, MI, MS, NC, NS,
@ -523,7 +523,7 @@ int mvscanw(int y, int x, const char *fmt, ...);
int mvwin(WINDOW *win, int y, int x);
int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...);
int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...);
WINDOW *newwin(int nl, int nc, int by, int bx);
WINDOW *newwin(int nlines, int ncols, int by, int bx);
int nl(void);
int nocbreak(void);
void nodelay(WINDOW *win, bool bf);
@ -544,8 +544,8 @@ int scanw(const char *, ...);
int scroll(WINDOW *win);
int scrollok(WINDOW *win, bool bf);
int setterm(char *);
int start_color(void);
WINDOW *subwin(WINDOW *orig, int nl, int nc, int by, int bx);
int start_color(void);
WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int by, int bx);
int touchline(WINDOW *win, int start, int count);
int touchoverlap(WINDOW *win1, WINDOW *win2);
int touchwin(WINDOW *win);

View File

@ -1,4 +1,4 @@
/* $NetBSD: getch.c,v 1.19 2000/04/15 22:59:05 jdc Exp $ */
/* $NetBSD: getch.c,v 1.20 2000/04/17 12:25:46 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: getch.c,v 1.19 2000/04/15 22:59:05 jdc Exp $");
__RCSID("$NetBSD: getch.c,v 1.20 2000/04/17 12:25:46 blymn Exp $");
#endif
#endif /* not lint */
@ -80,13 +80,19 @@ struct key_entry {
* it is the end of a multi-char sequence or a
* single char key that generates a symbol */
/* allocate this many key_entry structs at once to speed start up must
* be a power of 2.
*/
#define KEYMAP_ALLOC_CHUNK 4
/* The max number of different chars we can receive */
#define MAX_CHAR 256
struct keymap {
int count; /* count of number of key structs allocated */
short mapping[MAX_CHAR]; /* mapping of key to allocated structs */
key_entry_t **key; /* dynamic array of keys */};
key_entry_t **key; /* dynamic array of keys */
};
/* Key buffer */
@ -109,7 +115,7 @@ static short state; /* state of the inkey function */
/* The termcap data we are interested in and the symbols they map to */
struct tcdata {
char *name; /* name of termcap entry */
const char *name; /* name of termcap entry */
wchar_t symbol; /* the symbol associated with it */
};
@ -159,9 +165,89 @@ static const int num_tcs = (sizeof(tc) / sizeof(struct tcdata));
static keymap_t *base_keymap;
/* prototypes for private functions */
static key_entry_t *add_new_key(keymap_t *current, char chr, int key_type,
int symbol);
static keymap_t *new_keymap(void); /* create a new keymap */
static key_entry_t *new_key(void); /* create a new key entry */
static wchar_t inkey(int, int);
static wchar_t inkey(int to, int delay);
/*
* Add a new key entry to the keymap pointed to by current. Entry
* contains the character to add to the keymap, type is the type of
* entry to add (either multikey or leaf) and symbol is the symbolic
* value for a leaf type entry. The function returns a pointer to the
* new keymap entry.
*/
static key_entry_t *
add_new_key(keymap_t *current, char chr, int key_type, int symbol)
{
key_entry_t *the_key;
int i;
#ifdef DEBUG
__CTRACE("Adding character %s of type %d, symbol 0x%x\n", unctrl(chr),
key_type, symbol);
#endif
if (current->mapping[(unsigned) chr] < 0) {
/* first time for this char */
current->mapping[(unsigned) chr] = current->count; /* map new entry */
/* make sure we have room in the key array first */
if ((current->count & (KEYMAP_ALLOC_CHUNK - 1)) == 0)
{
if ((current->key =
realloc(current->key,
(current->count) * sizeof(key_entry_t *)
+ KEYMAP_ALLOC_CHUNK * sizeof(key_entry_t *))) == NULL) {
fprintf(stderr,
"Could not malloc for key entry\n");
exit(1);
}
the_key = new_key();
for (i = 0; i < KEYMAP_ALLOC_CHUNK; i++) {
current->key[current->count + i]
= &the_key[i];
}
}
/* point at the current key array element to use */
the_key = current->key[current->count];
the_key->type = key_type;
switch (key_type) {
case KEYMAP_MULTI:
/* need for next key */
#ifdef DEBUG
__CTRACE("Creating new keymap\n");
#endif
the_key->value.next = new_keymap();
break;
case KEYMAP_LEAF:
/* the associated symbol for the key */
#ifdef DEBUG
__CTRACE("Adding leaf key\n");
#endif
the_key->value.symbol = symbol;
break;
default:
fprintf(stderr, "add_new_key: bad type passed\n");
exit(1);
}
current->count++;
} else {
/* the key is already known - just return the address. */
#ifdef DEBUG
__CTRACE("Keymap already known\n");
#endif
the_key = current->key[current->mapping[(unsigned) chr]];
}
return the_key;
}
/*
* Init_getch - initialise all the pointers & structures needed to make
@ -171,12 +257,15 @@ static wchar_t inkey(int, int);
void
__init_getch(char *sp)
{
static struct tinfo *termcap;
static struct tinfo *termcap;
char entry[1024], termname[1024], *p;
int i, j, length;
size_t limit;
int i, j, length, key_ent;
size_t limit;
key_entry_t *tmp_key;
keymap_t *current;
key_entry_t *the_key;
#ifdef DEBUG
int k;
#endif
/* init the inkey state variable */
state = INKEY_NORM;
@ -191,71 +280,52 @@ static struct tinfo *termcap;
(void) strncpy(termname, sp, (size_t) 1022);
termname[1023] = 0;
if (t_getent(&termcap, termname) <= 0)
return;
if (t_getent(&termcap, termname) > 0) {
for (i = 0; i < num_tcs; i++) {
p = entry;
limit = 1023;
if (t_getstr(termcap, tc[i].name, &p, &limit) != NULL) {
current = base_keymap; /* always start with
* base keymap. */
length = (int) strlen(entry);
#ifdef DEBUG
__CTRACE("Processing termcap entry %s, sequence ",
tc[i].name);
for (k = 0; k <= length -1; k++)
__CTRACE("%s", unctrl(entry[k]));
__CTRACE("\n");
#endif
for (j = 0; j < length - 1; j++) {
/* add the entry to the struct */
tmp_key = add_new_key(current,
entry[j],
KEYMAP_MULTI, 0);
/* index into the key array - it's
clearer if we stash this */
key_ent = current->mapping[
(unsigned) entry[j]];
for (i = 0; i < num_tcs; i++) {
p = entry;
limit = 1023;
if (t_getstr(termcap, tc[i].name, &p, &limit) == NULL)
continue;
current = base_keymap; /* always start with base keymap. */
length = (int) strlen(entry);
for (j = 0; j < length - 1; j++) {
if (current->mapping[(unsigned) entry[j]] < 0) {
/* first time for this char */
current->mapping[(unsigned) entry[j]] = current->count; /* map new entry */
the_key = new_key();
/* multikey coz we are here */
the_key->type = KEYMAP_MULTI;
/* need for next key */
the_key->value.next = new_keymap();
/* put into key array */
if ((current->key = realloc(current->key, (current->count + 1) * sizeof(key_entry_t *))) == NULL) {
fprintf(stderr,
"Could not malloc for key entry\n");
exit(1);
current->key[key_ent] = tmp_key;
/* next key uses this map... */
current = current->key[key_ent]->value.next;
}
current->key[current->count++] = the_key;
}
/* next key uses this map... */
current = current->key[current->mapping[(unsigned) entry[j]]]->value.next;
}
/*
* This is the last key in the sequence (it may have been
* the only one but that does not matter) this means it is
* a leaf key and should have a symbol associated with it.
*/
if (current->count > 0) {
/*
* If there were other keys then we need to
* extend the mapping array.
*/
if ((current->key =
realloc(current->key,
(current->count + 1) *
sizeof(key_entry_t *))) == NULL) {
fprintf(stderr,
"Could not malloc for key entry\n");
exit(1);
/* this is the last key in the sequence (it
* may have been the only one but that does
* not matter) this means it is a leaf key and
* should have a symbol associated with it.
*/
tmp_key = add_new_key(current,
entry[length - 1],
KEYMAP_LEAF,
tc[i].symbol);
current->key[
current->mapping[(int)entry[length - 1]]] =
tmp_key;
}
}
current->mapping[(unsigned) entry[length - 1]] = current->count;
the_key = new_key();
the_key->type = KEYMAP_LEAF; /* leaf key */
/* the associated symbol */
the_key->value.symbol = tc[i].symbol;
current->key[current->count++] = the_key;
}
}
@ -282,13 +352,9 @@ new_keymap(void)
new_map->mapping[i] = -1; /* no mapping for char */
}
/* one does assume there will be at least one key mapped.... */
if ((new_map->key = malloc(sizeof(key_entry_t *))) == NULL) {
perror("Could not malloc first key ent");
exit(1);
}
return (new_map);
/* key array will be allocated when first key is added */
return new_map;
}
/*
@ -300,15 +366,20 @@ static key_entry_t *
new_key(void)
{
key_entry_t *new_one;
if ((new_one = malloc(sizeof(key_entry_t))) == NULL) {
perror("inkey: Cannot allocate new key entry");
int i;
if ((new_one = malloc(KEYMAP_ALLOC_CHUNK * sizeof(key_entry_t)))
== NULL) {
perror("inkey: Cannot allocate new key entry chunk");
exit(2);
}
new_one->type = 0;
new_one->value.next = NULL;
return (new_one);
for (i = 0; i < KEYMAP_ALLOC_CHUNK; i++) {
new_one[i].type = 0;
new_one[i].value.next = NULL;
}
return new_one;
}
/*
@ -318,13 +389,12 @@ new_key(void)
*/
wchar_t
inkey(to, delay)
int to, delay;
inkey(int to, int delay)
{
wchar_t k;
ssize_t nchar;
unsigned char c;
keymap_t *current = base_keymap;
wchar_t k;
ssize_t nchar;
char c;
keymap_t *current = base_keymap;
for (;;) { /* loop until we get a complete key sequence */
reread:
@ -398,7 +468,7 @@ reread:
}
/* Check key has no special meaning and we have not timed out */
if ((current->mapping[k] < 0) || (state == INKEY_TIMEOUT)) {
if ((state == INKEY_TIMEOUT) || (current->mapping[k] < 0)) {
/* return the first key we know about */
k = inbuf[start];
@ -553,10 +623,10 @@ wgetch(WINDOW *win)
}
#ifdef DEBUG
if (inp > 255)
/* we have a key symbol - treat it differently */
/* XXXX perhaps __unctrl should be expanded to include
* XXXX the keysyms in the table....
*/
/* we have a key symbol - treat it differently */
/* XXXX perhaps __unctrl should be expanded to include
* XXXX the keysyms in the table....
*/
__CTRACE("wgetch assembled keysym 0x%x\n", inp);
else
__CTRACE("wgetch got '%s'\n", unctrl(inp));

View File

@ -1,4 +1,4 @@
/* $NetBSD: initscr.c,v 1.15 2000/04/15 13:17:04 blymn Exp $ */
/* $NetBSD: initscr.c,v 1.16 2000/04/17 12:25:46 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: initscr.c,v 1.15 2000/04/15 13:17:04 blymn Exp $");
__RCSID("$NetBSD: initscr.c,v 1.16 2000/04/17 12:25:46 blymn Exp $");
#endif
#endif /* not lint */
@ -75,7 +75,7 @@ initscr(void)
* use Def_term.
*/
if (My_term || (sp = getenv("TERM")) == NULL)
sp = Def_term;
sp = (char *)Def_term;
if (setterm(sp) == ERR)
return (NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: newwin.c,v 1.18 2000/04/16 05:48:25 mycroft Exp $ */
/* $NetBSD: newwin.c,v 1.19 2000/04/17 12:25:46 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#else
__RCSID("$NetBSD: newwin.c,v 1.18 2000/04/16 05:48:25 mycroft Exp $");
__RCSID("$NetBSD: newwin.c,v 1.19 2000/04/17 12:25:46 blymn Exp $");
#endif
#endif /* not lint */
@ -47,32 +47,30 @@ __RCSID("$NetBSD: newwin.c,v 1.18 2000/04/16 05:48:25 mycroft Exp $");
#include "curses.h"
#include "curses_private.h"
#undef nl /* Don't need it here, and it interferes. */
extern struct __winlist *winlistp;
static WINDOW *__makenew __P((int, int, int, int, int));
static WINDOW *__makenew(int nlines, int ncols, int by, int bx, int sub);
void __set_subwin __P((WINDOW *, WINDOW *));
void __set_subwin(WINDOW *orig, WINDOW *win);
/*
* newwin --
* Allocate space for and set up defaults for a new window.
*/
WINDOW *
newwin(int nl, int nc, int by, int bx)
newwin(int nlines, int ncols, int by, int bx)
{
WINDOW *win;
__LINE *lp;
int i, j;
__LDATA *sp;
if (nl == 0)
nl = LINES - by;
if (nc == 0)
nc = COLS - bx;
if (nlines == 0)
nlines = LINES - by;
if (ncols == 0)
ncols = COLS - bx;
if ((win = __makenew(nl, nc, by, bx, 0)) == NULL)
if ((win = __makenew(nlines, ncols, by, bx, 0)) == NULL)
return (NULL);
win->nextp = win;
@ -83,21 +81,21 @@ newwin(int nl, int nc, int by, int bx)
__CTRACE("newwin: win->ch_off = %d\n", win->ch_off);
#endif
for (i = 0; i < nl; i++) {
for (i = 0; i < nlines; i++) {
lp = win->lines[i];
lp->flags = 0;
for (sp = lp->line, j = 0; j < nc; j++, sp++) {
for (sp = lp->line, j = 0; j < ncols; j++, sp++) {
sp->ch = ' ';
sp->attr = 0;
}
lp->hash = __hash((char *)(void *)lp->line,
(int) (nc * __LDATASIZE));
(int) (ncols * __LDATASIZE));
}
return (win);
}
WINDOW *
subwin(WINDOW *orig, int nl, int nc, int by, int bx)
subwin(WINDOW *orig, int nlines, int ncols, int by, int bx)
{
int i;
__LINE *lp;
@ -105,17 +103,17 @@ subwin(WINDOW *orig, int nl, int nc, int by, int bx)
/* Make sure window fits inside the original one. */
#ifdef DEBUG
__CTRACE("subwin: (%0.2o, %d, %d, %d, %d)\n", orig, nl, nc, by, bx);
__CTRACE("subwin: (%0.2o, %d, %d, %d, %d)\n", orig, nlines, ncols, by, bx);
#endif
if (by < orig->begy || bx < orig->begx
|| by + nl > orig->maxy + orig->begy
|| bx + nc > orig->maxx + orig->begx)
|| by + nlines > orig->maxy + orig->begy
|| bx + ncols > orig->maxx + orig->begx)
return (NULL);
if (nl == 0)
nl = orig->maxy + orig->begy - by;
if (nc == 0)
nc = orig->maxx + orig->begx - bx;
if ((win = __makenew(nl, nc, by, bx, 1)) == NULL)
if (nlines == 0)
nlines = orig->maxy + orig->begy - by;
if (ncols == 0)
ncols = orig->maxx + orig->begx - bx;
if ((win = __makenew(nlines, ncols, by, bx, 1)) == NULL)
return (NULL);
win->nextp = orig->nextp;
orig->nextp = win;
@ -157,9 +155,7 @@ __set_subwin(WINDOW *orig, WINDOW *win)
* Set up a window buffer and returns a pointer to it.
*/
static WINDOW *
__makenew(nl, nc, by, bx, sub)
int by, bx, nl, nc;
int sub;
__makenew(int nlines, int ncols, int by, int bx, int sub)
{
WINDOW *win;
__LINE *lp;
@ -168,20 +164,20 @@ __makenew(nl, nc, by, bx, sub)
#ifdef DEBUG
__CTRACE("makenew: (%d, %d, %d, %d)\n", nl, nc, by, bx);
__CTRACE("makenew: (%d, %d, %d, %d)\n", nlines, ncols, by, bx);
#endif
if ((win = malloc(sizeof(*win))) == NULL)
return (NULL);
#ifdef DEBUG
__CTRACE("makenew: nl = %d\n", nl);
__CTRACE("makenew: nlines = %d\n", nlines);
#endif
/* Set up line pointer array and line space. */
if ((win->lines = malloc(nl * sizeof(__LINE *))) == NULL) {
if ((win->lines = malloc(nlines * sizeof(__LINE *))) == NULL) {
free(win);
return NULL;
}
if ((win->lspace = malloc(nl * sizeof(__LINE))) == NULL) {
if ((win->lspace = malloc(nlines * sizeof(__LINE))) == NULL) {
free(win);
free(win->lines);
return NULL;
@ -192,7 +188,7 @@ __makenew(nl, nc, by, bx, sub)
* Allocate window space in one chunk.
*/
if ((win->wspace =
malloc(nc * nl * sizeof(__LDATA))) == NULL) {
malloc(ncols * nlines * sizeof(__LDATA))) == NULL) {
free(win->lines);
free(win->lspace);
free(win);
@ -222,9 +218,9 @@ __makenew(nl, nc, by, bx, sub)
* Point line pointers to line space, and lines themselves into
* window space.
*/
for (lp = win->lspace, i = 0; i < nl; i++, lp++) {
for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
win->lines[i] = lp;
lp->line = &win->wspace[i * nc];
lp->line = &win->wspace[i * ncols];
lp->firstchp = &lp->firstch;
lp->lastchp = &lp->lastch;
lp->firstch = 0;
@ -232,11 +228,11 @@ __makenew(nl, nc, by, bx, sub)
}
}
#ifdef DEBUG
__CTRACE("makenew: nc = %d\n", nc);
__CTRACE("makenew: ncols = %d\n", ncols);
#endif
win->cury = win->curx = 0;
win->maxy = nl;
win->maxx = nc;
win->maxy = nlines;
win->maxx = ncols;
win->begy = by;
win->begx = bx;

View File

@ -1,4 +1,4 @@
/* $NetBSD: setterm.c,v 1.16 2000/04/15 13:17:04 blymn Exp $ */
/* $NetBSD: setterm.c,v 1.17 2000/04/17 12:25:46 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)setterm.c 8.8 (Berkeley) 10/25/94";
#else
__RCSID("$NetBSD: setterm.c,v 1.16 2000/04/15 13:17:04 blymn Exp $");
__RCSID("$NetBSD: setterm.c,v 1.17 2000/04/17 12:25:46 blymn Exp $");
#endif
#endif /* not lint */
@ -188,7 +188,8 @@ setterm(char *type)
static void
zap()
{
char *namp, ***sp;
const char *namp;
char ***sp;
int **vp;
char **fp;
char tmp[3];

View File

@ -1,4 +1,4 @@
/* $NetBSD: tscroll.c,v 1.7 2000/04/15 23:01:47 jdc Exp $ */
/* $NetBSD: tscroll.c,v 1.8 2000/04/17 12:25:46 blymn Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)tscroll.c 8.4 (Berkeley) 7/27/94";
#else
__RCSID("$NetBSD: tscroll.c,v 1.7 2000/04/15 23:01:47 jdc Exp $");
__RCSID("$NetBSD: tscroll.c,v 1.8 2000/04/17 12:25:46 blymn Exp $");
#endif
#endif /* not lint */
@ -243,5 +243,5 @@ __parse_cap (cap, va_alist)
return (result);
err: va_end (ap);
return ("\0");
return ((char *) "\0");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.15 2000/04/15 13:17:05 blymn Exp $ */
/* $NetBSD: tty.c,v 1.16 2000/04/17 12:25:46 blymn Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95";
#else
__RCSID("$NetBSD: tty.c,v 1.15 2000/04/15 13:17:05 blymn Exp $");
__RCSID("$NetBSD: tty.c,v 1.16 2000/04/17 12:25:46 blymn Exp $");
#endif
#endif /* not lint */
@ -47,6 +47,8 @@ __RCSID("$NetBSD: tty.c,v 1.15 2000/04/15 13:17:05 blymn Exp $");
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include "curses.h"
#include "curses_private.h"