Fixed snake game.
Fixed newline bug in libcurses. File /etc/termcap replaced by small version. Five TERM types supported: ansi - simple generic display; xterm - common for most modern terminal emulators; linux - for Linux console; cons25 - for BSD console; vt100 - for DEC VT100 terminal emulators. Terminal type xterm set by default.
This commit is contained in:
1
etc/.gitignore
vendored
1
etc/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
phones
|
||||
remote
|
||||
termcap
|
||||
termcap.full
|
||||
|
||||
16
etc/ttys
16
etc/ttys
@@ -1,16 +1,16 @@
|
||||
#
|
||||
# name getty type status comments
|
||||
#
|
||||
console "/libexec/getty std.default" vt100 on secure #special
|
||||
console "/libexec/getty std.default" xterm on secure #special
|
||||
|
||||
# Enable some of these for additional logins. Do NOT enable the same one as the
|
||||
# console port, or strange things will happen. You can turn off the console port
|
||||
# if you would rather use the getty on the real tty - it's up to you.
|
||||
|
||||
tty0 "/libexec/getty std.default" vt100 off secure
|
||||
tty1 "/libexec/getty std.default" vt100 off secure
|
||||
tty2 "/libexec/getty std.default" vt100 off secure
|
||||
tty3 "/libexec/getty std.default" vt100 off secure
|
||||
tty4 "/libexec/getty std.default" vt100 off secure
|
||||
tty5 "/libexec/getty std.default" vt100 off secure
|
||||
ttyUSB0 "/libexec/getty std.default" vt100 off secure
|
||||
tty0 "/libexec/getty std.default" xterm off secure
|
||||
tty1 "/libexec/getty std.default" xterm off secure
|
||||
tty2 "/libexec/getty std.default" xterm off secure
|
||||
tty3 "/libexec/getty std.default" xterm off secure
|
||||
tty4 "/libexec/getty std.default" xterm off secure
|
||||
tty5 "/libexec/getty std.default" xterm off secure
|
||||
ttyUSB0 "/libexec/getty std.default" xterm off secure
|
||||
|
||||
@@ -270,7 +270,25 @@ struct point *sp;
|
||||
while(sp->line-- >= LINES)putchar('\n');
|
||||
return;
|
||||
}
|
||||
|
||||
if (sp->line == cursor.line) {
|
||||
if (sp->col == cursor.col)
|
||||
return;
|
||||
if (sp->col == cursor.col-1) {
|
||||
bs();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (sp->line == cursor.line+1) {
|
||||
if (sp->col == cursor.col) {
|
||||
down();
|
||||
return;
|
||||
}
|
||||
if (sp->col == cursor.col-1) {
|
||||
down();
|
||||
bs();
|
||||
return;
|
||||
}
|
||||
}
|
||||
char *cmstr = tgoto(CM, sp->col, sp->line);
|
||||
putpad(cmstr);
|
||||
cursor.line = sp->line;
|
||||
@@ -281,9 +299,9 @@ void
|
||||
pch(c)
|
||||
{
|
||||
outch(c);
|
||||
if (++cursor.col >= COLUMNS && AM) {
|
||||
cursor.col = 0;
|
||||
++cursor.line;
|
||||
if (++cursor.col >= COLUMNS) {
|
||||
cursor.col = -1;
|
||||
cursor.line = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +333,8 @@ char *s;
|
||||
outch(CTRL('g'));
|
||||
break;
|
||||
default:
|
||||
if (s[0] < ' ')break;
|
||||
if (s[0] < ' ')
|
||||
break;
|
||||
pch(s[0]);
|
||||
}
|
||||
s++;
|
||||
@@ -357,19 +376,10 @@ char ch;
|
||||
|
||||
p.col = ps->col + 1;
|
||||
p.line = ps->line + 1;
|
||||
if (
|
||||
(p.col >= 0) &&
|
||||
(p.line >= 0) &&
|
||||
(
|
||||
(
|
||||
(p.line < LINES) &&
|
||||
(p.col < COLUMNS)
|
||||
) ||
|
||||
(
|
||||
(p.col == COLUMNS) &&
|
||||
(p.line < LINES-1)
|
||||
)
|
||||
)) {
|
||||
if (p.col < 0 || p.line < 0)
|
||||
return;
|
||||
if ((p.line < LINES && p.col < COLUMNS) ||
|
||||
(p.col == COLUMNS && p.line < LINES-1)) {
|
||||
move(&p);
|
||||
pch(ch);
|
||||
}
|
||||
@@ -467,7 +477,6 @@ getcap()
|
||||
lcnt = LINES;
|
||||
ccnt = COLUMNS - 1;
|
||||
|
||||
AM = tgetflag("am");
|
||||
BW = tgetflag("bw");
|
||||
|
||||
ND = tgetstr("nd", &ap);
|
||||
|
||||
@@ -31,7 +31,7 @@ char *CL, *UP, *DO, *ND, *BS,
|
||||
int LINES, COLUMNS; /* physical screen size. */
|
||||
int lcnt, ccnt; /* user's idea of screen size */
|
||||
char xBC, PC;
|
||||
int AM, BW;
|
||||
int BW;
|
||||
char tbuf[1024], tcapbuf[128];
|
||||
int Klength; /* length of KX strings */
|
||||
int chunk; /* amount of money given at a time */
|
||||
|
||||
@@ -109,6 +109,8 @@ zap()
|
||||
SE = UE;
|
||||
}
|
||||
}
|
||||
if (DO && !NL)
|
||||
NL = DO;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
2
src/libtermlib/termcap/.gitignore
vendored
2
src/libtermlib/termcap/.gitignore
vendored
@@ -1 +1 @@
|
||||
termcap
|
||||
termcap.full
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
#
|
||||
DESTDIR = ../../..
|
||||
|
||||
termcap: reorder termcap.src
|
||||
termcap.full: reorder termcap.src
|
||||
ex - termcap.src < reorder
|
||||
|
||||
install: termcap
|
||||
install -c -m 444 termcap ${DESTDIR}/etc/termcap
|
||||
install: termcap.small termcap.full
|
||||
install -c -m 444 termcap.small ${DESTDIR}/etc/termcap
|
||||
install -c -m 444 termcap.full ${DESTDIR}/etc/termcap.full
|
||||
|
||||
tabset: FRC
|
||||
rm -fr ${DESTDIR}/usr/share/tabset
|
||||
@@ -24,6 +25,6 @@ tabset: FRC
|
||||
install -c -m 444 tabset/* ${DESTDIR}/usr/share/tabset
|
||||
|
||||
clean:
|
||||
rm -f termcap
|
||||
rm -f termcap.full
|
||||
|
||||
FRC:
|
||||
|
||||
@@ -36,5 +36,5 @@ $r termcap.local
|
||||
/|h19-g|/;.,/^[^ ]/-m9
|
||||
/|5620|/;.,/^[^ ]/-m9
|
||||
/^s/;.,/^#/-m9
|
||||
w! termcap
|
||||
w! termcap.full
|
||||
q
|
||||
|
||||
100
src/libtermlib/termcap/termcap.small
Normal file
100
src/libtermlib/termcap/termcap.small
Normal file
@@ -0,0 +1,100 @@
|
||||
# Copyright (c) 1980, 1985, 1989 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed by the University of
|
||||
# California, Berkeley and its contributors.
|
||||
# 4. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)termcap.src 5.88 (Berkeley) 4/30/91
|
||||
# $FreeBSD$
|
||||
#
|
||||
cons25|ans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[7m:mb=2\E[5m:me=2\E[m:\
|
||||
:is=\E>\E[?1;3;4;5l\E[?7;8h\E[1;24r\E[24;1H:\
|
||||
:if=/usr/share/tabset/vt100:nw=2\EE:ho=\E[H:\
|
||||
:as=2\E(0:ae=2\E(B:\
|
||||
:ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||:\
|
||||
:rs=\E>\E[?1;3;4;5l\E[?7;8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
|
||||
:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=\177:\
|
||||
:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOt:\
|
||||
:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:@8=\EOM:\
|
||||
:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:pt:sr=2*\EM:xn:\
|
||||
:sc=2\E7:rc=2\E8:cs=5\E[%i%d;%dr:UP=2\E[%dA:DO=2\E[%dB:RI=2\E[%dC:\
|
||||
:LE=2\E[%dD:ct=2\E[3g:st=2\EH:ta=^I:ms:bl=^G:cr=^M:eo:it#8:\
|
||||
:RA=\E[?7l:SA=\E[?7h:po=\E[5i:pf=\E[4i:
|
||||
|
||||
# $XTermId: termcap,v 1.78 2009/11/09 00:24:26 tom Exp $
|
||||
#
|
||||
xterm|linux|modern xterm:\
|
||||
:@7=\EOF:@8=\EOM:F1=\E[23~:F2=\E[24~:K2=\EOE:Km=\E[M:\
|
||||
:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\
|
||||
:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kI=\E[2~:\
|
||||
:kN=\E[6~:kP=\E[5~:kd=\EOB:kh=\EOH:kl=\EOD:kr=\EOC:ku=\EOA:\
|
||||
:tc=xterm-basic:
|
||||
#
|
||||
# This chunk is used for building the VT220/Sun/PC keyboard variants.
|
||||
xterm-basic|modern xterm common:\
|
||||
:am:bs:km:mi:ms:ut:xn:AX:\
|
||||
:Co#8:co#80:kn#12:li#24:pa#64:\
|
||||
:AB=\E[4%dm:AF=\E[3%dm:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\
|
||||
:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=\E(B:al=\E[L:\
|
||||
:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
|
||||
:cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:\
|
||||
:ei=\E[4l:ho=\E[H:im=\E[4h:is=\E[!p\E[?3;4l\E[4l\E>:\
|
||||
:kD=\E[3~:kb=^H:ke=\E[?1l\E>:ks=\E[?1h\E=:le=^H:md=\E[1m:\
|
||||
:me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:op=\E[39;49m:\
|
||||
:rc=\E8:rs=\E[!p\E[?3;4l\E[4l\E>:sc=\E7:se=\E[27m:sf=^J:\
|
||||
:so=\E[7m:sr=\EM:st=\EH:\
|
||||
:ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h:
|
||||
#
|
||||
# This should work for the commonly used "color xterm" variations (XFree86
|
||||
# xterm, color_xterm, nxterm, rxvt). Note that it does not set 'bce', so for
|
||||
# XFree86 and rxvt, some applications that use colors will be less efficient,
|
||||
# and in a few special cases (with "smart" optimization) the wrong color will
|
||||
# be painted in spots.
|
||||
xterm-color|generic "ANSI" color xterm:\
|
||||
:Co#8:NC@:pa#64:\
|
||||
:AB=\E[4%dm:AF=\E[3%dm:ac=:op=\E[m:tc=xterm-r6:
|
||||
Reference in New Issue
Block a user