Add winnstr family and fake resizeterm from ncurses 4.1 for compatibility

with recent applications.
Bump minor number.
This commit is contained in:
Andrey A. Chernov 1997-08-24 19:09:45 +00:00
parent 1818482d81
commit cefcce61a0
5 changed files with 73 additions and 6 deletions

View File

@ -1,16 +1,16 @@
# Makefile for ncurses
# $Id$
# $Id: Makefile,v 1.21 1997/02/22 15:07:38 peter Exp $
LIB= ncurses
SHLIB_MAJOR= 3
SHLIB_MINOR= 0
SHLIB_MINOR= 1
SRCS= lib_kernel.c lib_pad.c lib_bkgd.c \
lib_unctrl.c lib_raw.c lib_vidattr.c lib_trace.c lib_beep.c \
lib_doupdate.c lib_refresh.c lib_initscr.c lib_newwin.c lib_addch.c \
lib_addstr.c lib_scroll.c lib_clreol.c lib_touch.c lib_mvcur.c lib_keyname.c\
lib_delwin.c lib_endwin.c lib_clrbot.c lib_move.c lib_printw.c \
lib_scanw.c lib_erase.c lib_getch.c lib_options.c lib_acs.c lib_slk.c\
lib_box.c lib_clear.c lib_delch.c lib_insch.c \
lib_box.c lib_clear.c lib_delch.c lib_insch.c lib_instr.c \
lib_getstr.c lib_mvwin.c lib_longname.c lib_tstp.c \
lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c lib_color.c \
lib_insstr.c lib_insdel.c lib_twait.c lib_window.c copyright.c

View File

@ -166,6 +166,8 @@ extern int LINES, COLS;
extern "C" {
#endif
extern int resizeterm (int, int);
#if 0 /* MYTINFO not have it */
extern char ttytype[]; /* needed for backward compatibility */
#endif
@ -278,6 +280,7 @@ extern int werase(WINDOW *);
extern int wgetch(WINDOW *);
extern int wgetnstr(WINDOW *,char *,int maxlen);
extern int whline(WINDOW *,chtype,int);
extern int winnstr(WINDOW *, char *, int);
extern int winsch(WINDOW *,chtype);
extern int winsdelln(WINDOW *,int);
extern int winsnstr(WINDOW *,char *,int);
@ -361,6 +364,7 @@ extern int slk_touch(void);
#define vline(ch, n) wvline(stdscr, ch, n)
#define winsstr(w, s) winsnstr(w, s, 0)
#define winstr(w, s) winnstr(w, s, -1)
#define redrawwin(w) wredrawln(w, 0, w->_maxy+1)
#define waddstr(win,str) waddnstr(win,str,-1)
@ -393,6 +397,7 @@ extern int slk_touch(void);
#define deleteln() winsdelln(stdscr, -1)
#define wdeleteln(w) winsdelln(w, -1)
#define refresh() wrefresh(stdscr)
#define innstr(s,n) winnstr(stdscr,s,n)
#define insch(c) winsch(stdscr,c)
#define delch() wdelch(stdscr)
#define setscrreg(t,b) wsetscrreg(stdscr,t,b)
@ -418,6 +423,7 @@ extern int slk_touch(void);
#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? ERR : winch(win))
#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win))
#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
@ -426,6 +432,7 @@ extern int slk_touch(void);
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
#define mvinch(y,x) mvwinch(stdscr,y,x)
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n)
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
#define mvwinsstr(w, y, x, s) (wmove(w,y,x) == ERR ? ERR : winsstr(w,s))
#define mvwinsnstr(w, y, x, s, n) (wmove(w,y,x) == ERR ? ERR : winsnstr(w,s,n))

View File

@ -0,0 +1,54 @@
/***************************************************************************
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992-1995 *
* Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* Eric S. Raymond *
* esr@snark.thyrsus.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice is included with any such distribution, and is not *
* removed from any of its header files. Mention of ncurses in any *
* applications linked with it is highly appreciated. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/
/*
** lib_instr.c
**
** The routine winnstr().
**
*/
#include "curses.priv.h"
int winnstr(WINDOW *win, char *str, int n)
{
int i, row, col;
T(("winnstr(%p,%p,%d) called", win, str, n));
getyx(win, row, col);
if (n < 0)
n = win->_maxx - win->_curx + 1;
for (i = 0; i < n;) {
str[i++] = TextOf(win->_line[row][col]);
if (++col > win->_maxx) {
col = 0;
if (++row > win->_maxy)
break;
}
}
str[i] = '\0'; /* SVr4 does not seem to count the null */
return (i);
}

View File

@ -310,3 +310,9 @@ int resetty()
return OK;
}
int
resizeterm(int ToLines, int ToCols)
{
return OK;
}

View File

@ -1,16 +1,16 @@
# Makefile for ncurses
# $Id$
# $Id: Makefile,v 1.21 1997/02/22 15:07:38 peter Exp $
LIB= ncurses
SHLIB_MAJOR= 3
SHLIB_MINOR= 0
SHLIB_MINOR= 1
SRCS= lib_kernel.c lib_pad.c lib_bkgd.c \
lib_unctrl.c lib_raw.c lib_vidattr.c lib_trace.c lib_beep.c \
lib_doupdate.c lib_refresh.c lib_initscr.c lib_newwin.c lib_addch.c \
lib_addstr.c lib_scroll.c lib_clreol.c lib_touch.c lib_mvcur.c lib_keyname.c\
lib_delwin.c lib_endwin.c lib_clrbot.c lib_move.c lib_printw.c \
lib_scanw.c lib_erase.c lib_getch.c lib_options.c lib_acs.c lib_slk.c\
lib_box.c lib_clear.c lib_delch.c lib_insch.c \
lib_box.c lib_clear.c lib_delch.c lib_insch.c lib_instr.c \
lib_getstr.c lib_mvwin.c lib_longname.c lib_tstp.c \
lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c lib_color.c \
lib_insstr.c lib_insdel.c lib_twait.c lib_window.c copyright.c