snapshot of project "ncurses", label v1_9_7a

This commit is contained in:
Thomas E. Dickey 1995-11-10 17:00:00 -05:00
parent fd823cc50a
commit 341e0c1996
42 changed files with 3371 additions and 1326 deletions

View File

@ -1,7 +1,7 @@
ANNOUNCING NCURSES 1.9.7
ANNOUNCING NCURSES 1.9.7A
Overview of ncurses 1.9.7
Overview of ncurses 1.9.7a
The ncurses library is a freeware emulation of System V Release 4.0
curses. It uses terminfo format, supports color and multiple
@ -82,6 +82,12 @@ Overview of ncurses 1.9.7
line-deletion for screen-line movements. This algorithm is more
powerful than the 4.4BSD curses quickch() routine.
* It is possible to generate the library with a list of pre-loaded
fallback entries linked to it so that it can serve those terminal
types even when no terminfo tree or termcap file is accessible
(this may be useful for support of screen-oriented programs that
must run in single-user mode).
* The tic(1)/captoinfo utility provided with ncurses has the ability
to translate many termcaps from the XENIX, IBM and AT&T extension
sets.
@ -149,7 +155,8 @@ Overview of ncurses 1.9.7
u386mon
System performance monitor for SVr4
nvi New vi alpha versions 1.1.50 and later use ncurses
nvi New vi alpha versions 1.50 are able to use ncurses versions
1.9.7 and later.
The ncurses distribution includes a selection of test programs.

75
INSTALL
View File

@ -49,14 +49,14 @@ INSTALLATION PROCEDURE:
If you want to put the terminal descriptions in, for example,
/usr/share/lib/terminfo, you can either make that a symbolic link to
/usr/lib/terminfo, or type `configure --with-datadir=/usr/share/lib/terminfo'.
/usr/lib/terminfo, or type `./configure --with-datadir=/usr/share/lib/terminfo'.
This is particularly useful if your system already has a terminfo database.
This option allows you to place ncurses' terminfo in an alternate location.
You can use TERMINFO to point to the appropriate directory.
2. Type `configure' to configure ncurses for your operating system and create
2. Type `./configure' to configure ncurses for your operating system and create
the Makefiles. Various configuration options are available to customize
the installation; use `configure --help' to list the available options.
the installation; use `./configure --help' to list the available options.
It will create your Makefiles. If your operating system is not supported,
read the PORTABILITY section in the file ncurses/README for information on
@ -76,7 +76,7 @@ INSTALLATION PROCEDURE:
If you do not specify any models, the normal and debug libraries will be
configured. This is equivalent to
configure --with-normal --with-debug
./configure --with-normal --with-debug
Rules for generating shared libraries are highly dependent upon the choice
of host system and compiler. We've been testing shared libraries on linux
@ -95,7 +95,26 @@ INSTALLATION PROCEDURE:
do), some test programs, and the panels and menus libraries.
Read the file test/README for details on the test programs.
4. IF YOU HAVE ROOT: You can type `make install' to install the libraries,
4. Run ncurses and several other test programs in the test directory to
verify that ncurses functions correctly before overwriting any system
files.
The ncurses program is designed specifically to test the ncurses library.
You can use it to verify that the screen highlights work correctly, that
cursor addressing and window scrolling works OK, etc.
5. If you are running SLS, Slackware, or any Linux distribution based on
them, you may already have an older version of ncurses installed. If so,
you must remove the old files from /usr/include and the old libraries
from /usr/lib before installing ncurses. Otherwise, you may have
compilation errors or linkage problems because you're picking up the old
files.
If you have BSD curses installed in your system and you accidentally
compile using its curses.h you'll end up with a large number of
undefined symbols at link time. _waddbytes is one of them.
6. IF YOU HAVE ROOT: You can type `make install' to install the libraries,
the programs, the terminfo database and the man pages. Alternately, you
can type `make install' in each directory you want to install. In the
top-level directory, you can do a partial install using these commands:
@ -156,26 +175,10 @@ INSTALLATION PROCEDURE:
directory. Note: this will go away next time you do `make install.data'
and you'll have to redo it.
9. Run ncurses and several other test programs (see the test directory).
The ncurses program is designed specifically to test the ncurses library.
You can use it to verify that the screen highlights work correctly, that
cursor addressing and window scrolling works OK, etc.
NOTES:
If you have SLS or anything based on it (slackware is OK) PLEASE
remove everything related to ncurses before re-installing it.
If you have BSD curses installed in your system and you accidentally
compile using its curses.h you'll end up with a large number of
undefined symbols at link time. _waddbytes is one of them.
The include files will normally be installed in /usr/include/ncurses.
To arrange for your programs to see them by default, copy or link them
to /usr/include from there.
IF YOU ARE A SYSTEM INTEGRATOR:
Configuration and Installation:
Configure with --prefix=/usr to make the install productions put
libraries and headers in the correct locations (overwriting any
previous curses libraries and headers). This will put the terminfo
@ -189,6 +192,32 @@ IF YOU ARE A SYSTEM INTEGRATOR:
that use raw termcap to query terminal characteristics will win
(providing you recompile and relink them!).
Keyboard Mapping:
Some Linux console keyboard mappings as of 1995 are sub-optimal; a
bit of tweaking would allow terminfo to make useful distinctions and
conform better to the ANSI/ECMA-48 standard. The following specific
things should be changed:
* Backspace should generate ^H, not ^?.
* Shift-tab should generate \E[Z, not ^I.
The terminfo master file assumes these mappings from version 9.11.3 up.
Here are the loadkeys -d mappings that will set these up:
keycode 14 = BackSpace BackSpace
alt keycode 14 = Meta_BackSpace
keycode 15 = Tab Tab
alt keycode 15 = Meta_Tab
shift keycode 15 = F26
string F26 ="\033[Z"
but this is a kluge that uses up the F26 function key binding when
it shouldn't. The compiled-in defaults in the keyboard driver should
be changed using the loadkeys -m option.
Naming the Console Terminal
In various Linuxes (and possibly elsewhere) there has been a practice
of designating the system console driver type as `console'. Please
do not do this any more! It complicates peoples' lives, because it

View File

@ -51,14 +51,13 @@
./include/curses.h.in
./include/edit_cfg.sh
./include/parametrized.sh
./include/progs.priv.h
./include/term_entry.h
./include/termcap.h.in
./include/tic.h
./include/unctrl.h.in
./install-sh
./man/Makefile.in
./man/MKterminfo.sh
./man/Makefile.in
./man/captoinfo.1m
./man/clear.1
./man/curs_addch.3x
@ -200,7 +199,6 @@
./ncurses/SigAction.h
./ncurses/alloc_entry.c
./ncurses/captoinfo.c
./ncurses/fallback.c
./ncurses/comp_error.c
./ncurses/comp_hash.c
./ncurses/comp_parse.c
@ -272,10 +270,10 @@
./ncurses/parse_entry.c
./ncurses/read_entry.c
./ncurses/read_termcap.c
./ncurses/write_entry.c
./ncurses/sigaction.c
./ncurses/strerror.c
./ncurses/vsscanf.c
./ncurses/write_entry.c
./panel/Makefile.in
./panel/modules
./panel/panel.c
@ -289,6 +287,7 @@
./progs/dump_entry.h
./progs/infocmp.c
./progs/modules
./progs/progs.priv.h
./progs/termsort.sh
./progs/toe.c
./progs/tput.c

3
NEWS
View File

@ -18,7 +18,8 @@ started working with Pavel Curtis' original work, pcurses, in 1992:
* added -h option to toe(1).
* added -R option to tic(1) and infocmp(1).
* added fallback-entry-list feature.
* added -i option to infocmp(1)
* added -i option to infocmp(1).
* do a better job at detecting if we're on SCO.
### ncurses-1.9.5 -> 1.9.6

2
TO-DO
View File

@ -29,7 +29,7 @@ LONGER-TERM TO-DO ITEMS:
1. Extended mouse support via gpm integration
We have mouse support under xterm now, implemented and documented. The
next step is to add code to lib_getch.c that can detect Alessandro Rubini's
next step is to add code to lib_mouse.c that can detect Alessandro Rubini's
GPM server and use it to implement the same interface.
2. Extended COSE conformance

View File

@ -5,10 +5,10 @@
<link rev=made href=mailto:esr@snark.thyrsus.com>
</HEAD>
<BODY>
<TITLE>Announcing ncurses 1.9.7</TITLE>
<H1>Announcing ncurses 1.9.7</H1>
<TITLE>Announcing ncurses 1.9.7a</TITLE>
<H1>Announcing ncurses 1.9.7a</H1>
<H2>Overview of ncurses 1.9.7</H2>
<H2>Overview of ncurses 1.9.7a</H2>
The ncurses library is a freeware emulation of System V Release 4.0 curses.
It uses terminfo format, supports color and multiple highlights and forms
@ -92,7 +92,7 @@ the 4.4BSD curses quickch() routine. <P>
<LI> It is possible to generate the library with a list of pre-loaded
fallback entries linked to it so that it can serve those terminal types even
when no terminfo tree or termcap file is accessible (this may be useful
for support of screen-oriented programs that must run in single-user mode).
for support of screen-oriented programs that must run in single-user mode). <P>
<LI> The tic(1)/captoinfo utility provided with ncurses has the
ability to translate many termcaps from the XENIX, IBM and
@ -154,7 +154,8 @@ including: <P>
<DT> u386mon
<DD> System performance monitor for SVr4
<DT> nvi
<DD> New vi alpha versions 1.1.50 and later use ncurses
<DD> New vi alpha versions 1.50 are able to use ncurses versions 1.9.7
and later.
</DL>
The ncurses distribution includes a selection of test programs.

View File

@ -92,7 +92,7 @@ the 4.4BSD curses quickch() routine. <P>
<LI> It is possible to generate the library with a list of pre-loaded
fallback entries linked to it so that it can serve those terminal types even
when no terminfo tree or termcap file is accessible (this may be useful
for support of screen-oriented programs that must run in single-user mode).
for support of screen-oriented programs that must run in single-user mode). <P>
<LI> The tic(1)/captoinfo utility provided with ncurses has the
ability to translate many termcaps from the XENIX, IBM and
@ -154,7 +154,8 @@ including: <P>
<DT> u386mon
<DD> System performance monitor for SVr4
<DT> nvi
<DD> New vi alpha versions 1.1.50 and later use ncurses
<DD> New vi alpha versions 1.50 are able to use ncurses versions 1.9.7
and later.
</DL>
The ncurses distribution includes a selection of test programs.

View File

@ -142,6 +142,7 @@ AC_CHECK_LIB(bsd, gettimeofday)dnl CLIX: bzero, select, gettimeofday
### Checks for header files.
AC_STDC_HEADERS
AC_HEADER_DIRENT
dnl These are some other potentially nonportable headers.
AC_CHECK_HEADERS( \
@ -189,6 +190,7 @@ getttynam \
setbuffer \
setvbuf \
sigaction \
strdup \
strerror \
usleep \
vsscanf \

10
dist.mk
View File

@ -15,10 +15,10 @@ SHELL = /bin/sh
# 1.9a, 1.9b, 1.9foobar, ... when the ncurses release version changes
# If a new ncurses has an incompatible application binary interface than
# previous one, the ABI version should be changed.
VERSION = 1.9.7
SHARED_ABI = 2.0
VERSION = 1.9.7a
SHARED_ABI = 2.1
dist: ANNOUNCE INTRO
dist: ANNOUNCE INTRO HACK
(cd ..; tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`; gzip ncurses-$(VERSION).tar)
distclean:
@ -31,7 +31,9 @@ announce.html: announce.html.in
sed 's,@VERSION@,$(VERSION),' <announce.html.in >announce.html
INTRO: misc/ncurses-intro.html
lynx -dump $^ > misc/ncurses-intro.doc
lynx -dump misc/ncurses-intro.html > misc/ncurses-intro.doc
HACK: misc/hackguide.html
lynx -dump misc/hackguide.html > misc/hackguide.doc
# Prepare distribution for version control
vcprepare:

View File

@ -1295,7 +1295,6 @@ static int IFN_Next_Word(FORM * form)
char *bp = Address_Of_Current_Position_In_Buffer(form);
char *s;
char *t;
bool again = FALSE;
/* We really need access to the data, so we have to synchronize */
Synchronize_Buffer(form);

View File

@ -21,12 +21,24 @@ typedef struct
#undef RETURN
static int reg_errno;
#define INIT register char *sp = instring; reg_errno=0;
static char *RegEx_Init(char *instring)
{
reg_errno = 0;
return instring;
}
static char *RegEx_Error(int code)
{
reg_errno = code;
return 0;
}
#define INIT register char *sp = RegEx_Init(instring);
#define GETC() (*sp++)
#define PEEKC() (*sp)
#define UNGETC(c) (--sp)
#define RETURN(c) return(c)
#define ERROR(c) reg_errno=(c)
#define ERROR(c) return RegEx_Error(c)
#include <regexp.h>

View File

@ -44,8 +44,8 @@ install.libs \
install.includes : term.h $(includedir)
$(INSTALL_DATA) term.h $(includedir)/term.h
$(INSTALL_DATA) curses.h $(includedir)/curses.h
$(INSTALL_DATA) $(srcdir)/unctrl.h $(includedir)/unctrl.h
$(INSTALL_DATA) $(srcdir)/termcap.h $(includedir)/termcap.h
$(INSTALL_DATA) unctrl.h $(includedir)/unctrl.h
$(INSTALL_DATA) termcap.h $(includedir)/termcap.h
@echo "Make sure you delete any old header files!"
$(includedir) :

View File

@ -464,7 +464,7 @@ extern int slk_attroff(attr_t);
* pseudo functions
*/
#define wgetstr(w, s) wgetnstr(w, s, -1)
#define getnstr(w, s, n) wgetnstr(stdscr, s, n)
#define getnstr(s, n) wgetnstr(stdscr, s, n)
#define setterm(term) setupterm(term, 1, (int *)0)

View File

@ -14,15 +14,20 @@
head=$1
caps=$2
tail=$3
echo '.\" DO NOT EDIT THIS FILE BY HAND!'
echo '.\" It is generated from terminfo.head, Caps, and terminfo.tail.'
cat <<'EOF'
'\" t
.\" DO NOT EDIT THIS FILE BY HAND!
.\" It is generated from terminfo.head, Caps, and terminfo.tail.
.\"
.\" Note: this must be run through tbl before nroff.
.\" The magic cookie on the first line triggers this under some man programs.
EOF
cat $head
sed -n <$caps "\
/%%-STOP-HERE-%%/q
/^#%/s///p
/^#/d
s/^/\\\s-1/
s/$/T}\\\s+1/
s/$/T}/
s/ [Y\-][B\-][C\-][G\-][E\-]\** / T{/
s/ bool / /p
s/ num / /p

View File

@ -50,7 +50,7 @@ install.man_db : terminfo.5
# We compose terminfo.5 from the real sources...
CAPLIST=$(srcdir)/../include/Caps
terminfo.5: terminfo.head $(CAPLIST) terminfo.tail Makefile MKterminfo.sh
sh MKterminfo.sh terminfo.head $(CAPLIST) terminfo.tail >terminfo.5
sh $(srcdir)/MKterminfo.sh $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5
clean mostlyclean:
rm -f terminfo.5

View File

@ -56,7 +56,7 @@ _________________________________________________________
\fBfield_type\fR form_field_validation(3X)
\fBfield_userptr\fR form_field_userptr(3X)
\fBform_driver\fR form_driver(3X)
\fBform_fields\fR form_fields(3X)
\fBform_fields\fR form_field(3X)
\fBform_init\fR form_hook(3X)
\fBform_opts\fR form_opts(3X)
\fBform_opts_off\fR form_opts(3X)
@ -91,7 +91,7 @@ _________________________________________________________
\fBset_field_userptr\fR form_field_userptr(3X)
\fBset_fieldtype_arg\fR form_fieldtype(3X)
\fBset_fieldtype_choice\fR form_fieldtype(3X)
\fBset_form_fields\fR form_fields(3X)
\fBset_form_fields\fR form_field(3X)
\fBset_form_init\fR form_hook(3X)
\fBset_form_opts\fR form_field_opts(3X)
\fBset_form_page\fR form_page(3X)

View File

@ -5,9 +5,9 @@
.SH SYNOPSIS
\fB#include <form.h>\fR
.br
int set_form_window(FORM *form, WINDOW *win);
int set_form_win(FORM *form, WINDOW *win);
.br
WINDOW *form_window(FORM *form);
WINDOW *form_win(FORM *form);
.br
int set_form_sub(FORM *form, WINDOW *sub);
.br

View File

@ -224,28 +224,30 @@ l l.
Action Meaning
=
RIS full reset
SC save cursor
RC restore cursor
LL home-down
RSR reset scroll region
DECPAM application keypad mode
DECPNM normal keypad mode
ISO DEC G0 enable DEC graphics for G0
ISO UK G0 enable UK chars for G0
ISO US G0 enable US chars for G0
ISO DEC G1 enable DEC graphics for G1
ISO UK G1 enable UK chars for G1
ISO US G1 enable US chars for G1
DECSC save cursor
DECRC restore cursor
DECPAM application keypad mode
DECPNM normal keypad mode
DECANSI enter ANSI mode
DEC G0 enable DEC graphics for G0
DEC UK G0 enable UK chars for G0
DEC US G0 enable US chars for G0
DEC G1 enable DEC graphics for G1
DEC UK G1 enable UK chars for G1
DEC US G1 enable US chars for G1
DECCKM application cursor keys
DECANM set VT52 mode
DECCOLM 132-column mode
DECSCLM smooth scroll
DECSCNM reverse video mode
DECOM origin mode
DECAWM wraparound mode
DECARM auto-repeat mode
DEC[+-]CKM application cursor keys
DEC[+-]ANM set VT52 mode
DEC[+-]COLM 132-column mode
DEC[+-]SCLM smooth scroll
DEC[+-]SCNM reverse video mode
DEC[+-]OM origin mode
DEC[+-]AWM wraparound mode
DEC[+-]ARM auto-repeat mode
.TE
.SH FILES
.TP 20
@ -263,8 +265,6 @@ The \fB-r\fR option's notion of `termcap' capabilities is BSD 4.4's. Older
versions may have a more restricted set.
.SH BUGS
The -F option of \fBinfocmp\fR(1m) should be a \fBtoe\fR(1m) mode.
The \fI-i\fR option isn't smart enough to recognize composite sequences.
.SH SEE ALSO
\fBinfocmp\fR(1m), \fBcaptoinfo\fR(1m), \fBinfotocap\fR(1m),
\fBtic\fR(1m), \fBtoe\fR(1m),

View File

@ -110,7 +110,7 @@ attributes.
Enable auto-margin (right-margin wraparound)
.TP 5
-m
Suppress color support
Mono mode - suppress color support
.TP 5
-na
No arrow keys - termcap ignores arrow keys which are actually there on the

View File

@ -1,6 +1,3 @@
'\" t
.\" Note: this must be run through tbl before nroff.
.\" The magic cookie on the first line triggers this under some man programs.
.TH TERMINFO 5 "" "" "File Formats"
.ds n 5
.ds d @TERMINFO@
@ -50,18 +47,19 @@ l l l.
\fBSuffix Meaning Example\fP
-\fInn\fP Number of lines on the screen aaa-60
-\fIn\fPp Number of pages of memory c100-4p
-am With auto. margins (usually default) vt100-am
-m Mono mode. Suppress color. ansi-m
-am With automargins (usually the default) vt100-am
-m Mono mode; suppress color ansi-m
-mc Magic cookie; spaces when highlighting wy30-mc
-na No arrow keys (leave them in local) c100-na
-nam Without automatic margins vt100-nam
-nl No status line. att4415-nl
-ns No status line. hp2626-ns
-nl No status line att4415-nl
-ns No status line hp2626-ns
-rv Reverse video c100-rv
-s Enable status line vt100-s
-vb Use visible bell instead of flash. wy370-vb
-w Wide mode (more than 80 columns) vt100-w
-vb Use visible bell instead of beep wy370-vb
-w Wide mode (> 80 columns, usually 132) vt100-w
.TE
For more on terminal naming conventions, see the \fBterm(7)\fR manual page.
.SS Capabilities
.\" Head of terminfo man page ends here
.ps -1

View File

@ -1,4 +1,5 @@
.\" Beginning of terminfo.tail file
.ps +1
.PP
.SS A Sample Entry
.PP

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,6 @@ else
fi
cat <<EOF
return((TERMTYPE *)NULL);
return((TERMTYPE *)0);
}
EOF

View File

@ -66,6 +66,7 @@ LIBRARIES = @LIBS_TO_MAKE@
AUTO_SRC = \
comp_captab.c \
fallback.c \
keys.tries \
lib_keyname.c \
names.c
@ -81,6 +82,9 @@ $(libdir) \
$(ticdir) :
$(srcdir)/../mkinstalldirs $@
fallback.c : MKfallback.sh
sh $(srcdir)/MKfallback.sh >$@
keys.tries: $(srcdir)/keys.list
$(AWK) -f $(srcdir)/MKkeys.awk $(srcdir)/keys.list > keys.tries

View File

@ -27,6 +27,7 @@
*/
#include <string.h>
#include "config.h"
#include "tic.h"
#include "hashsize.h"
@ -166,6 +167,18 @@ struct name_table_entry const *ptr;
* performance enhancement).
*/
#ifndef HAVE_STRDUP
static char *strdup (char *s)
{
char *p;
p = malloc((unsigned)(strlen(s)+1));
if (p)
strcpy(p,s);
return(p);
}
#endif /* not HAVE_STRDUP */
#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
#define typeCalloc(type,elts) (type *)calloc(sizeof(type),elts)
@ -235,10 +248,13 @@ int main(int argc, char **argv)
/*
* Read the table into our arrays.
*/
for (n = 0; (n < CAPTABSIZE) && gets(buffer); ) {
char **list = parse_columns(buffer);
for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin); ) {
char **list, *nl = strchr(buffer, '\n');
if (nl)
*nl = '\0';
list = parse_columns(buffer);
if (list == 0) /* blank or comment */
continue;
continue;
name_table[n].nte_link = -1; /* end-of-hash */
name_table[n].nte_name = strdup(list[column]);
if (!strcmp(list[2], "bool")) {

View File

@ -424,7 +424,10 @@ chtype ch, last_ch = '\0';
_nc_warning("Illegal ^ character - %s",
_tracechar((unsigned char)ch));
}
*(ptr++) = (char)(ch & 037);
if (ch == '?')
*(ptr++) = '\177';
else
*(ptr++) = (char)(ch & 037);
}
else if (ch == '\\') {
ch = c = next_char();

View File

@ -1,11 +0,0 @@
/*
* DO NOT EDIT THIS FILE BY HAND! It is generated by MKfallback.sh.
*/
#include "term.h"
const TERMTYPE *_nc_fallback(const char *name)
{
/* the fallback list is empty */
return((TERMTYPE *)NULL);
}

View File

@ -36,34 +36,36 @@ int y, startx, minx;
T(("wclrtobot(%p) called", win));
startx = win->_curx;
if (win->_flags & _NEED_WRAP)
startx++;
T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx));
for (y = win->_cury; y <= win->_maxy; y++) {
minx = _NOCHANGE;
end = &win->_line[y].text[win->_maxx];
minx = _NOCHANGE;
end = &win->_line[y].text[win->_maxx];
for (ptr = &win->_line[y].text[startx]; ptr <= end; ptr++) {
int blank = _nc_render(win, *ptr, BLANK);
for (ptr = &win->_line[y].text[startx]; ptr <= end; ptr++) {
int blank = _nc_render(win, *ptr, BLANK);
if (*ptr != blank) {
maxx = ptr;
if (minx == _NOCHANGE)
maxx = ptr;
if (minx == _NOCHANGE)
minx = ptr - win->_line[y].text;
*ptr = blank;
*ptr = blank;
}
}
}
if (minx != _NOCHANGE) {
if (minx != _NOCHANGE) {
if (win->_line[y].firstchar > minx
|| win->_line[y].firstchar == _NOCHANGE)
win->_line[y].firstchar = minx;
if (win->_line[y].lastchar < maxx - win->_line[y].text)
win->_line[y].lastchar = maxx - win->_line[y].text;
}
}
startx = 0;
startx = 0;
}
_nc_synchook(win);
return OK;

View File

@ -38,7 +38,8 @@ int y, x, minx;
y = win->_cury;
x = win->_curx;
if (y > win->_maxy
if (win->_flags & _NEED_WRAP
|| y > win->_maxy
|| x > win->_maxx)
return ERR;

View File

@ -98,6 +98,10 @@ wscrl(WINDOW *win, int n)
if (n == 0)
return OK;
if ((n > (win->_regbottom - win->_regtop)) ||
(-n > (win->_regbottom - win->_regtop)))
return ERR;
_nc_scroll_window(win, n, win->_regtop, win->_regbottom);
touchline(win, win->_regtop, win->_regbottom - win->_regtop + 1);

View File

@ -63,7 +63,7 @@ lib_vidattr lib $(srcdir) ../include/term.h
lib_window lib $(srcdir)
names lib .
read_entry lib $(srcdir) ../include/term.h $(INCDIR)/tic.h
fallback lib $(srcdir) ../include/term.h $(INCDIR)/tic.h
fallback lib . ../include/term.h $(INCDIR)/tic.h
read_termcap lib $(srcdir) ../include/term.h
write_entry progs $(srcdir) ../include/term.h $(INCDIR)/tic.h

View File

@ -318,8 +318,6 @@ int _nc_capcmp(const char *s, const char *t)
/* else *s == *t but one is not NUL, so continue */
s++, t++;
}
return(0);
}
/*

View File

@ -55,16 +55,19 @@ TERMINAL *cur_term;
* table.
*/
#define IS_NEG1(p) (((p)[0] == 0377) && ((p)[1] == 0377))
#define IS_NEG2(p) (((p)[0] == 0376) && ((p)[1] == 0377))
#define LOW_MSB(p) ((p)[0] + 256*(p)[1])
#undef BYTE
#define BYTE(p,n) (unsigned char)(p)[n]
#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
int _nc_read_file_entry(const char *filename, TERMTYPE *ptr)
/* return 1 if read, 0 if not found or garbled, -1 if database inaccessible */
{
int name_size, bool_count, num_count, str_count, str_size;
int i, fd, numread;
unsigned char buf[MAX_ENTRY_SIZE];
int name_size, bool_count, num_count, str_count, str_size;
int i, fd, numread;
char buf[MAX_ENTRY_SIZE];
if ((fd = open(filename, 0)) < 0)
{

View File

@ -25,7 +25,9 @@
* write_entry.c -- write a terminfo structure onto the file system
*/
#include <progs.priv.h>
#include <curses.priv.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>

View File

@ -89,6 +89,11 @@ static char *canonical_name(char *ptr, char *buf)
static int capcmp(const char *s, const char *t)
/* capability comparison function */
{
if (!s && !t)
return(0);
else if (!s || !t)
return(1);
if (ignorepads)
return(_nc_capcmp(s, t));
else
@ -301,49 +306,51 @@ static void compare_predicate(int type, int idx, const char *name)
***************************************************************************/
typedef struct {char *from; char *to;} assoc;
static const assoc dec_caps[] =
static const assoc std_caps[] =
{
/* FIXME: use ECMA-48 mnemonics here rather than the DEC ones */
"\033c", "RIS", /* full reset */
/* these are specified by X.364 and iBCS2 */
{"\033c", "RIS"}, /* full reset */
"\033=", "DECPAM", /* application keypad mode */
"\033>", "DECPNM", /* normal keypad mode */
"\0337", "DECSC", /* save cursor */
"\0338", "DECRC", /* restore cursor */
"\033(0", "DEC G0", /* enable DEC graphics for G0 */
"\033(A", "DEC UK G0", /* enable UK chars for G0 */
"\033(B", "DEC US G0", /* enable US chars for G0 */
"\033)0", "DEC G1", /* enable DEC graphics for G1 */
"\033)A", "DEC UK G1", /* enable UK chars for G1 */
"\033)B", "DEC US G1", /* enable US chars for G1 */
"\033[?1h", "DECCKM on", /* application cursor keys */
"\033[?2h", "DECANM on", /* set VT52 mode */
"\033[?3h", "DECCOLM on", /* 132-column mode */
"\033[?4h", "DECSCLM on", /* smooth scroll */
"\033[?5h", "DECSCNM on", /* reverse video mode */
"\033[?6h", "DECOM on", /* origin mode */
"\033[?7h", "DECAWM on", /* wraparound mode */
"\033[?8h", "DECARM on", /* auto-repeat mode */
"\033[?1l", "DECCKM off", /* application cursor keys */
"\033[?2l", "DECANM off", /* set VT52 mode */
"\033[?3l", "DECCOLM off", /* 132-column mode */
"\033[?4l", "DECSCLM off", /* smooth scroll */
"\033[?5l", "DECSCNM off", /* reverse video mode */
"\033[?6l", "DECOM off", /* origin mode */
"\033[?7l", "DECAWM off", /* wraparound mode */
"\033[?8l", "DECARM off", /* auto-repeat mode */
(char *)NULL,
{"\0337", "SC"}, /* save cursor */
{"\0338", "RC"}, /* restore cursor */
{"\033[r", "RSR"}, /* not an X.364 mnemonic */
/* this group is specified by ISO 2022 */
{"\033(0", "ISO DEC G0"}, /* enable DEC graphics for G0 */
{"\033(A", "ISO UK G0"}, /* enable UK chars for G0 */
{"\033(B", "ISO US G0"}, /* enable US chars for G0 */
{"\033)0", "ISO DEC G1"}, /* enable DEC graphics for G1 */
{"\033)A", "ISO UK G1"}, /* enable UK chars for G1 */
{"\033)B", "ISO US G1"}, /* enable US chars for G1 */
/* these are DEC private modes widely supported by emulators */
{"\033=", "DECPAM"}, /* application keypad mode */
{"\033>", "DECPNM"}, /* normal keypad mode */
{"\033<", "DECANSI"}, /* enter ANSI mode */
(char *)NULL
};
static const assoc private_modes[] =
/* DEC \E[ ... [hl] modes recognized by many emulators */
{
{"1", "CKM"}, /* application cursor keys */
{"2", "ANM"}, /* set VT52 mode */
{"3", "COLM"}, /* 132-column mode */
{"4", "SCLM"}, /* smooth scroll */
{"5", "SCNM"}, /* reverse video mode */
{"6", "OM"}, /* origin mode */
{"7", "AWM"}, /* wraparound mode */
{"8", "ARM"}, /* auto-repeat mode */
(char *)NULL
};
static void analyze_string(const char *name, const char *cap, TERMTYPE *tp)
{
char buf[MAX_TERMINFO_LENGTH];
char buf2[MAX_TERMINFO_LENGTH];
const char *sp;
const char *sp, *ep;
const assoc *ap;
if (cap == ABSENT_STRING || cap == CANCELLED_STRING)
@ -353,7 +360,7 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp)
buf[0] = '\0';
for (sp = cap; *sp; sp++)
{
int i, len;
int i, len = 0;
char *expansion = (char *)NULL;
/* first, check other capabilities in this entry */
@ -393,9 +400,9 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp)
}
}
/* now check the DEC capabilities */
/* now check the standard capabilities */
if (!expansion)
for (ap = dec_caps; ap->from; ap++)
for (ap = std_caps; ap->from; ap++)
{
len = strlen(ap->from);
@ -406,14 +413,52 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp)
}
}
/* now check for private-mode sequences */
if (!expansion
&& sp[0] == '\033' && sp[1] == '[' && sp[2] == '?'
&& (len = strspn(sp + 3, "0123456789;"))
&& ((sp[3 + len] == 'h') || (sp[3 + len] == 'l')))
{
char buf3[MAX_TERMINFO_LENGTH];
(void) strcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-");
(void) strncpy(buf3, sp + 3, len);
len += 4;
buf3[len] = '\0';
ep = strtok(buf3, ";");
do {
bool found = FALSE;
for (ap = private_modes; ap->from; ap++)
{
int tlen = strlen(ap->from);
if (strncmp(ap->from, ep, len) == 0)
{
(void) strcat(buf2, ap->to);
found = TRUE;
break;
}
}
if (!found)
(void) strcat(buf2, ep);
(void) strcat(buf2, ";");
} while
(ep = strtok((char *)NULL, ";"));
buf2[strlen(buf2) - 1] = '\0';
expansion = buf2;
}
/* now check for scroll region reset */
if (!expansion)
{
(void) sprintf(buf2, "\033[1;%dr", tp->Numbers[2]);
len = strlen(buf2);
if (strncmp(buf2, sp, len) == 0)
expansion = "DEC/ANSI scroll region reset";
}
expansion = "RSR";
}
/* now check for home-down */
if (!expansion)
@ -421,7 +466,7 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp)
(void) sprintf(buf2, "\033[%d;1H", tp->Numbers[2]);
len = strlen(buf2);
if (strncmp(buf2, sp, len) == 0)
expansion = "DEC/ANSI home-down";
expansion = "LL";
}
/* now look at the expansion we got, if any */
@ -448,7 +493,7 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp)
*
***************************************************************************/
static void file_comparison(int argc, char *argv[], int optind)
static void file_comparison(int argc, char *argv[])
{
/* someday we may allow comparisons on more files */
int filecount = 0;
@ -836,7 +881,6 @@ int main(int argc, char *argv[])
/* dump as C initializer for the terminal type */
if (initdump)
{
int i;
char *str;
int size;
@ -861,6 +905,9 @@ int main(int argc, char *argv[])
case CANCELLED_BOOLEAN:
str = "CANCELLED_BOOLEAN";
break;
default:
str = "?ERROR";
break;
}
(void) printf("/* %s */ %s,\n",
boolnames[i], str);
@ -901,7 +948,7 @@ int main(int argc, char *argv[])
(void) printf("/* %s */ %s,\n", strnames[i], str);
}
(void) printf("} /* size = %d */\n", size);
return;
exit(0);
}
/* analyze the init strings */
@ -916,7 +963,7 @@ int main(int argc, char *argv[])
analyze_string("rs2", reset_2string, &term[0]);
analyze_string("rs3", reset_3string, &term[0]);
#undef CUR
return;
exit(0);
}
/*
@ -981,7 +1028,7 @@ int main(int argc, char *argv[])
(void) fprintf(stderr,
"File comparison needs exactly two file arguments.\n");
else
file_comparison(argc, argv, optind);
file_comparison(argc, argv);
exit(0);
}

View File

@ -47,11 +47,28 @@
# endif
#endif
#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
#if HAVE_GETOPT_H
#include <getopt.h>
#else
/* 'getopt()' may be prototyped in <stdlib.h>, but declaring its
* variables doesn't hurt.
/* 'getopt()' may be prototyped in <stdlib.h>, but declaring its
* variables doesn't hurt.
*/
extern char *optarg;
extern int optind;

View File

@ -24,10 +24,10 @@
*
*/
#include <string.h>
#include <dirent.h>
#include <progs.priv.h>
#include <string.h>
#include "progs.priv.h"
#include "tic.h"
#include "term.h"
#include "dump_entry.h"
@ -148,12 +148,12 @@ int main (int argc, char *argv[])
else
{
char *explicit, *home, *eargv[3];
int i;
int j;
extern char *getenv(const char *);
i = 0;
j = 0;
if ((explicit = getenv("TERMINFO")) != (char *)NULL)
eargv[i++] = explicit;
eargv[j++] = explicit;
else
{
if ((home = getenv("HOME")) != (char *)NULL)
@ -162,13 +162,13 @@ int main (int argc, char *argv[])
(void) sprintf(personal, PRIVATE_INFO, home);
if (access(personal, F_OK) == 0)
eargv[i++] = personal;
eargv[j++] = personal;
}
eargv[i++] = TERMINFO;
eargv[j++] = TERMINFO;
}
eargv[i] = (char *)NULL;
eargv[j] = (char *)NULL;
typelist(i, eargv, header, deschook);
typelist(j, eargv, header, deschook);
}
exit(0);
@ -211,31 +211,37 @@ static void typelist(int eargc, char *eargv[],
while ((subdir = readdir(termdir)) != NULL)
{
size_t len = NAMLEN(subdir);
char buf[PATH_MAX];
char name_1[PATH_MAX];
DIR *entrydir;
struct dirent *entry;
if (!strcmp(subdir->d_name, ".")
|| !strcmp(subdir->d_name, ".."))
strncpy(name_1, subdir->d_name, len)[len] = '\0';
if (!strcmp(name_1, ".")
|| !strcmp(name_1, ".."))
continue;
(void) strcpy(buf, eargv[i]);
(void) strcat(buf, "/");
(void) strcat(buf, subdir->d_name);
(void) strcat(buf, name_1);
(void) strcat(buf, "/");
chdir(buf);
entrydir = opendir(".");
while ((entry = readdir(entrydir)) != NULL)
{
char name_2[PATH_MAX];
TERMTYPE lterm;
char *cn;
int status;
if (!strcmp(entry->d_name, ".")
|| !strcmp(entry->d_name, ".."))
len = NAMLEN(entry);
strncpy(name_2, entry->d_name, len)[len] = '\0';
if (!strcmp(name_2, ".")
|| !strcmp(name_2, ".."))
continue;
status = _nc_read_file_entry(entry->d_name, &lterm);
status = _nc_read_file_entry(name_2, &lterm);
if (status == -1)
{
(void) fprintf(stderr,
@ -247,13 +253,13 @@ static void typelist(int eargc, char *eargv[],
{
(void) fprintf(stderr,
"infocmp: couldn't open terminfo file %s.\n",
entry->d_name);
name_2);
return;
}
/* only visit things once, by primary name */
cn = _nc_first_name(lterm.term_names);
if (strcmp(cn, entry->d_name))
if (strcmp(cn, name_2))
continue;
/* apply the selected hook function */

View File

@ -128,6 +128,18 @@ CaselessCmp(char *a, char *b) /* strcasecmp isn't portable */
return LOWERCASE(*a) - LOWERCASE(*b);
}
#ifndef HAVE_STRDUP
static char *strdup (char *s)
{
char *p;
p = malloc((unsigned)(strlen(s)+1));
if (p)
strcpy(p,s);
return(p);
}
#endif /* not HAVE_STRDUP */
static void
err(const char *fmt, ...)
{
@ -545,11 +557,11 @@ found: if ((p = getenv("TERMCAP")) != NULL && *p != '/') {
#define CKILL CTRL('U')
#if defined(CLNEXT)
#undef CLNEXT
#define CLNEXT('v')
#define CLNEXT CTRL('v')
#endif
#if defined(CRPRNT)
#undef CRPRNT
#define CRPRNT('r')
#define CRPRNT CTRL('r')
#endif
#define CQUIT CTRL('\\')
#define CSTART CTRL('Q')

View File

@ -878,8 +878,6 @@ static WINDOW *w3;
static WINDOW *w4;
static WINDOW *w5;
#define nap(x) usleep(1000*x)
static unsigned long nap_msec = 1;
char *mod[] =
@ -909,7 +907,7 @@ wait_a_while(unsigned long msec)
if(nap_msec == 1)
getchar();
else
nap(nap_msec);
napms(nap_msec);
#endif
} /* end of wait_a_while */

View File

@ -3,6 +3,7 @@
* This is a test program for the PDCurses screen package for IBM PC type
* machines.
* This program was written by John Burnell (johnb@kea.am.dsir.govt.nz)
* esr changed the usleep calls to napms calls, 7 Nov 1995
*
*/
@ -168,7 +169,7 @@ scrollTest (WINDOW *win)
wrefresh (win);
scrollok(win, TRUE);
for (i = 1; i <= height; i++) {
usleep (250);
napms(250);
scroll(win);
wrefresh (win);
};
@ -180,7 +181,7 @@ scrollTest (WINDOW *win)
box(win, ACS_VLINE, ACS_HLINE);
wrefresh (win);
for (i = 1; i <= 5; i++) {
usleep (500);
napms(500);
scroll(win);
wrefresh (win);
};
@ -229,7 +230,7 @@ inputTest (WINDOW *win)
box(subWin, ACS_VLINE, ACS_HLINE);
mvwprintw (subWin, 1, 1, "Time = %d", i);
wrefresh(subWin);
usleep(1000);
napms(1000);
flushinp();
}
@ -237,7 +238,7 @@ inputTest (WINDOW *win)
werase(win);
flash();
wrefresh(win);
usleep(500);
napms(500);
mvwaddstr(win, 2, 1, "Press a key, followed by ENTER");
wmove(win, 9, 10);

View File

@ -36,10 +36,10 @@ int main(int argc, char *argv[])
FILE *fp;
char buf[BUFSIZ];
int i;
char **lptr;
char **lptr, **olptr;
#ifdef TRACE
trace(TRACE_CALLS);
trace(TRACE_UPDATE);
#endif
if (argc != 2) {
@ -101,22 +101,24 @@ char **lptr;
switch(c) {
case KEY_DOWN:
case 'n':
olptr = lptr;
for (i = 0; i < n; i++)
if (lptr + LINES < lines + MAXLINES && lptr[LINES + 1])
lptr++;
else
break;
wscrl(stdscr, i);
wscrl(stdscr, olptr - lptr);
break;
case KEY_UP:
case 'p':
olptr = lptr;
for (i = 0; i < n; i++)
if (lptr > lines)
lptr--;
else
break;
wscrl(stdscr, -i);
wscrl(stdscr, olptr - lptr);
break;
}
}