Commit 8b971053 authored by Thomas Lange's avatar Thomas Lange

Imported Upstream version 6.20.00

parent eae08626
**/Makefile
!win32/msg/Makefile
atconfig
config.h
config.status
config_p.h
ed.defns.h
gethost
nls/*.cat
sh.err.h
tc.const.h
tc.defs.c
tcsh
tests/package.m4
tests/testsuite
41 V6.19.00 - 20150521
20. V6.20.00 - 20161124
19. Don't resize the screen if it did not change size.
18. V6.19.01 - 20161025
17. restore file description when cleaning up after eval:
repeat 99 time
16. PR/572: Fix $SHLVL issue when exec'ing subshells.
15. PR/403: Fix backquote expansion for multi-byte character sets.
14. Fix drawing issu with multi-line prompt (Kensuke Iwahashi/David Kaspar)
13. always send prusage to stdout.
12. PR/526: Fix double \\ printing from previous fix in history expansion.
11. Android updates from Corinna Vinschen
10. PR/526: Quote backslashes properly so they can be preserved in ``
expansions
9. Fix memory leak for paraml
8. Add notempty and ask values for the noclobber setting (Martin Tournoij)
7. more correct $wordchars for vimode (Luke Mewburn)
6. expose VImode in $vimode (Luke Mewburn)
5. display what the compiled in editor is in bindkey -d (Luke Mewburn)
4. run-fg-editor improvements and documentation (Luke Mewburn)
3. Fix parsing of 'if (cond)then' (Fridolin Pokorny)
2. PR/437: Fix handling of invalid unicode characters.
1. PR/451: Fix error messages containing %c to be always '%c'
41. V6.19.00 - 20150521
40. V6.18.05 - 20150510
39. fix reseting when interrupted inside an eval "eval sleep 10^C"
(paulo.cesar.pereira.de.andrade)
......
# $tcsh: Makefile.in,v 3.56 2014/07/24 22:52:13 christos Exp $
# $tcsh: Makefile.in,v 3.59 2015/08/24 20:09:04 kim Exp $
# Makefile.in 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
......@@ -415,8 +415,8 @@ AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
tests/testsuite.at aclocal.m4
TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \
tests/expr.at tests/lexical.at tests/mb-eucjp.at \
tests/mb-utf8.at tests/noexec.at tests/syntax.at tests/subst.at \
tests/variables.at tests/sh.dol.at
tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.at \
tests/subst.at tests/variables.at tests/sh.dol.at
VHSRCS=${PVSRCS} ${AVSRCS}
......@@ -449,7 +449,7 @@ pure:$(P) ${OBJS}
gethost: gethost.c sh.err.h tc.const.h sh.h
rm -f gethost
${CC_FOR_GETHOST} -o gethost ${CPPFLAGS} ${CFLAGS} $(srcdir)/gethost.c
${CC_FOR_GETHOST} -o gethost ${CPPFLAGS} $(srcdir)/gethost.c
tc.defs.c: gethost host.defs
@rm -f $@.tmp
......@@ -533,7 +533,7 @@ tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
${CPP} $(CPPFLAGS) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
$(srcdir)/tc.const.c | \
sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
sort >> $@.tmp
LC_COLLATE=C sort >> $@.tmp
@echo '#endif /* _h_tc_const */' >> $@.tmp
@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
......
#
# Create the HTML version of the manual page
#
CGI=tcsh.html/tcsh.cgi
tcsh.html/top.html: tcsh.man tcsh.man2html
perl tcsh.man2html -i
-rm -f tcsh.html/index.html
chmod -R a+rX tcsh.html
mv ${CGI} ${CGI}.bak
sed -e '1s,^.*$$,#!/usr/bin/perl,' < ${CGI}.bak > ${CGI}
chmod a+rx ${CGI}
rm -f ${CGI}.bak
clean:
-rm -rf tcsh.html
# $tcsh: Makefile.std,v 1.99 2014/07/07 20:34:58 christos Exp $
# $tcsh: Makefile.std,v 1.100 2015/08/24 20:09:04 kim Exp $
# Makefile.std 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
......@@ -425,7 +425,7 @@ tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
${CPP} $(INCLUDES) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
$(srcdir)/tc.const.c | grep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\) *\[ *\].*/extern Char \1[];/' | \
sort >> $@
LC_COLLATE=C sort >> $@
@echo '#endif /* _h_tc_const */' >> $@
csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
......
This is tcsh version 6.19.00. Tcsh is a version of the Berkeley
This is tcsh version 6.20.00. Tcsh is a version of the Berkeley
C-Shell, with the addition of: a command line editor, command and file
name completion, listing, etc. and a bunch of small additions to the
shell itself.
......
#
# $tcsh: complete.tcsh,v 1.55 2014/09/27 07:08:45 kim Exp $
# $tcsh: complete.tcsh,v 1.56 2015/07/03 16:52:47 christos Exp $
# example file using the new completion code
#
# Debian GNU/Linux
......@@ -1009,7 +1009,7 @@ complete ln c/--/"(backup directory force no-dereference \
c/-/"(b d F f i n S s V v -)"/ \
n/{-S,--suffix}/x:'<suffix>'/ \
n/{-V,--version-control}/"(t numbered nil existing \
never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
never simple)"/ n/-*/f/ N/-*/x:'<link_name>'/ \
p/1/f/ p/2/x:'<link_name>'/
complete touch c/--/"(date reference time help version)"/ \
c/-/"(a c d f m r t -)"/ \
......
This diff is collapsed.
......@@ -69,6 +69,9 @@
/* Define to 1 if you have the `mallinfo' function. */
#undef HAVE_MALLINFO
/* Define to 1 if you have the `mblen' function. */
#undef HAVE_MBLEN
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
#undef HAVE_MBRTOWC
......
......@@ -85,8 +85,7 @@
* also define _POSIX_C_SOURCE, which throws our code off.
*/
#define _BSD_SOURCE
#define _SVID_SOURCE
#define _DEFAULT_SOURCE
#define _POSIX_SOURCE
#define _XOPEN_SOURCE 500
#define _GNU_SOURCE
......@@ -101,7 +100,7 @@
/****************** local defines *********************/
#ifndef _PATH_TCSHELL
#define _PATH_TCSHELL "/system/bin/tcsh"
#define _PATH_TCSHELL "/system/xbin/tcsh"
#endif
#define ECHO_STYLE BOTH_ECHO
......
/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.50 2015/02/22 16:31:54 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.52 2016/04/16 15:44:18 christos Exp $ */
/*
* config_f.h -- configure various defines for tcsh
*
......@@ -38,6 +38,10 @@
#ifndef _h_config_f
#define _h_config_f
#ifdef HAVE_FEATURES_H
#include <features.h> /* for __GLIBC__ */
#endif
/*
* SHORT_STRINGS Use at least 16 bit characters instead of 8 bit chars
* This fixes up quoting problems and eases implementation
......@@ -135,7 +139,7 @@
* This can be much slower and no memory statistics will be
* provided.
*/
#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__CYGWIN__) || defined(__GLIBC__) || defined(__OpenBSD__) || defined(__APPLE__)
#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__CYGWIN__) || defined(__GLIBC__) || defined(__OpenBSD__) || defined(__APPLE__) || defined (__ANDROID__)
# define SYSMALLOC
#else
# undef SYSMALLOC
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for tcsh 6.19.00.
# Generated by GNU Autoconf 2.69 for tcsh 6.20.00.
#
# Report bugs to <http://bugs.gw.com/>.
#
......@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tcsh'
PACKAGE_TARNAME='tcsh'
PACKAGE_VERSION='6.19.00'
PACKAGE_STRING='tcsh 6.19.00'
PACKAGE_VERSION='6.20.00'
PACKAGE_STRING='tcsh 6.20.00'
PACKAGE_BUGREPORT='http://bugs.gw.com/'
PACKAGE_URL=''
......@@ -1250,7 +1250,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures tcsh 6.19.00 to adapt to many kinds of systems.
\`configure' configures tcsh 6.20.00 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1315,7 +1315,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of tcsh 6.19.00:";;
short | recursive ) echo "Configuration of tcsh 6.20.00:";;
esac
cat <<\_ACEOF
......@@ -1411,7 +1411,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
tcsh configure 6.19.00
tcsh configure 6.20.00
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2174,7 +2174,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by tcsh $as_me 6.19.00, which was
It was created by tcsh $as_me 6.20.00, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -4141,6 +4141,13 @@ if test "x$GCC" != xyes ; then
CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
fi
case "${host}" in
*-*-android*)
CFLAGS="${CFLAGS} -fPIE"
LDFLAGS="${LDFLAGS} -pie"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5
$as_echo_n "checking for library containing crypt... " >&6; }
if ${ac_cv_search_crypt+:} false; then :
......@@ -4307,6 +4314,10 @@ ac_res=$ac_cv_search_tgetent
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "unable to find the tgetent() function" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
......@@ -6565,7 +6576,7 @@ else
have_catgets=no
fi
for ac_func in dup2 getauthid getcwd gethostname getpwent getutent getutxent mallinfo memmove memset mkstemp nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth
for ac_func in dup2 getauthid getcwd gethostname getpwent getutent getutxent mallinfo mblen memmove memset mkstemp nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
......@@ -7339,7 +7350,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by tcsh $as_me 6.19.00, which was
This file was extended by tcsh $as_me 6.20.00, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -7405,7 +7416,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
tcsh config.status 6.19.00
tcsh config.status 6.20.00
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -7,10 +7,10 @@ dnl You'll also need a version of config.guess from a gnu package
dnl
dnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
dnl
dnl $tcsh: configure.ac,v 3.6 2015/05/21 21:38:12 christos Exp $
dnl $tcsh: configure.ac,v 3.10 2016/11/24 15:04:52 christos Exp $
AC_PREREQ([2.59])dnl Minimum Autoconf version required.
AC_INIT([tcsh], [6.19.00], [http://bugs.gw.com/])
AC_INIT([tcsh], [6.20.00], [http://bugs.gw.com/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([tc.vers.c])
AC_CONFIG_HEADERS([config.h])
......@@ -306,10 +306,20 @@ if test "x$GCC" != xyes ; then
CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
fi
dnl More recent Android requires PIEs
case "${host}" in
*-*-android*)
CFLAGS="${CFLAGS} -fPIE"
LDFLAGS="${LDFLAGS} -pie"
;;
esac
dnl Checks for libraries
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(getspnam, sec)
AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
AC_SEARCH_LIBS([tgetent], [termlib termcap curses ncurses], [], [
AC_MSG_ERROR([unable to find the tgetent() function])
])
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(connect, socket)
AC_SEARCH_LIBS(catgets, catgets)
......@@ -397,7 +407,7 @@ AC_INCLUDES_DEFAULT([])
AC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no])
AC_CHECK_FUNC([catgets], [have_catgets=yes], [have_catgets=no])
AC_CHECK_FUNCS([dup2 getauthid getcwd gethostname getpwent] dnl
[getutent getutxent mallinfo memmove memset mkstemp nice] dnl
[getutent getutxent mallinfo mblen memmove memset mkstemp nice] dnl
[nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth])
AC_FUNC_GETPGRP
AC_FUNC_MBRTOWC
......
......@@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "sh.h"
RCSID("$tcsh: dotlock.c,v 3.3 2014/03/09 00:11:54 christos Exp $");
RCSID("$tcsh: dotlock.c,v 3.4 2015/11/03 21:04:13 christos Exp $")
#include <stdio.h>
#ifndef O_SYNC
......
/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.99 2014/03/09 00:20:26 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.103 2015/08/19 14:29:55 christos Exp $ */
/*
* ed.chared.c: Character editing functions.
*/
......@@ -72,7 +72,7 @@
#include "sh.h"
RCSID("$tcsh: ed.chared.c,v 3.99 2014/03/09 00:20:26 christos Exp $")
RCSID("$tcsh: ed.chared.c,v 3.103 2015/08/19 14:29:55 christos Exp $")
#include "ed.h"
#include "tw.h"
......@@ -93,7 +93,7 @@ RCSID("$tcsh: ed.chared.c,v 3.99 2014/03/09 00:20:26 christos Exp $")
* from: Gert-Jan Vons <vons@cesar.crbca1.sinet.slb.com>
*/
#define C_CLASS_WHITE 1
#define C_CLASS_ALNUM 2
#define C_CLASS_WORD 2
#define C_CLASS_OTHER 3
static Char *InsertPos = InputBuf; /* Where insertion starts */
......@@ -290,7 +290,7 @@ c_preword(Char *p, Char *low, int n, Char *delim)
/*
* c_to_class() returns the class of the given character.
*
* This is used to make the c_prev_word() and c_next_word() functions
* This is used to make the c_prev_word(), c_next_word() and c_eword() functions
* work like vi's, which classify characters. A word is a sequence of
* characters belonging to the same class, classes being defined as
* follows:
......@@ -305,8 +305,8 @@ c_to_class(Char ch)
if (Isspace(ch))
return C_CLASS_WHITE;
if (Isdigit(ch) || Isalpha(ch) || ch == '_')
return C_CLASS_ALNUM;
if (isword(ch))
return C_CLASS_WORD;
return C_CLASS_OTHER;
}
......@@ -828,15 +828,24 @@ c_eword(Char *p, Char *high, int n)
p++;
while (n--) {
while ((p < high) && Isspace(*p))
p++;
int c_class;
if (isword(*p))
while ((p < high) && isword(*p))
p++;
else
while ((p < high) && !(Isspace(*p) || isword(*p)))
p++;
if (p >= high)
break;
/* scan until end of current word (may be all whitespace!) */
c_class = c_to_class(*p);
while ((p < high) && c_class == c_to_class(*p))
p++;
/* if this was a non_whitespace word, we're ready */
if (c_class != C_CLASS_WHITE)
continue;
/* otherwise, move to the end of the word just found */
c_class = c_to_class(*p);
while ((p < high) && c_class == c_to_class(*p))
p++;
}
p--;
......@@ -3025,7 +3034,7 @@ e_uppercase(Char c)
/*ARGSUSED*/
CCRETVAL
e_capitolcase(Char c)
e_capitalcase(Char c)
{
Char *cp, *end;
......@@ -3387,7 +3396,7 @@ e_stuff_char(Char c)
(void) Cookedmode();
(void) xwrite(SHIN, "\n", 1);
len = one_wctomb(buf, c & CHAR);
len = one_wctomb(buf, c);
for (i = 0; i < len; i++)
(void) ioctl(SHIN, TIOCSTI, (ioctl_t) &buf[i]);
......
/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.45 2008/10/17 20:25:00 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.46 2015/08/19 14:29:55 christos Exp $ */
/*
* ed.decls.h: Editor external definitions
*/
......@@ -142,7 +142,7 @@ extern CCRETVAL e_wordfwd (Char);
extern CCRETVAL v_wordbegnext (Char);
extern CCRETVAL e_uppercase (Char);
extern CCRETVAL e_lowercase (Char);
extern CCRETVAL e_capitolcase (Char);
extern CCRETVAL e_capitalcase (Char);
extern CCRETVAL e_cleardisp (Char);
extern CCRETVAL e_complete (Char);
extern CCRETVAL e_correct (Char);
......
/* $Header: /p/tcsh/cvsroot/tcsh/ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.defns.c,v 3.51 2016/02/14 15:44:18 christos Exp $ */
/*
* ed.defns.c: Editor function definitions and initialization
*/
......@@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $")
RCSID("$tcsh: ed.defns.c,v 3.51 2016/02/14 15:44:18 christos Exp $")
#include "ed.h"
......@@ -151,7 +151,7 @@ PFCmd CcFuncTbl[] = { /* table of available commands */
#define F_CASEUPPER 54
e_lowercase,
#define F_CASELOWER 55
e_capitolcase,
e_capitalcase,
#define F_CASECAPITAL 56
v_zero,
#define V_ZERO 57
......@@ -1801,27 +1801,27 @@ editinit(void)
void
CheckMaps(void)
{ /* check the size of the key maps */
int c1 = (NT_NUM_KEYS * sizeof(KEYCMD));
size_t c1 = NT_NUM_KEYS * sizeof(KEYCMD);
if ((sizeof(CcKeyMap)) != c1)
xprintf("CcKeyMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD)));
if (sizeof(CcKeyMap) != c1)
xprintf("CcKeyMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD));
if ((sizeof(CcAltMap)) != c1)
xprintf("CcAltMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcAltMap) / sizeof(KEYCMD)));
if (sizeof(CcAltMap) != c1)
xprintf("CcAltMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcAltMap) / sizeof(KEYCMD));
if ((sizeof(CcEmacsMap)) != c1)
xprintf("CcEmacsMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcEmacsMap) / sizeof(KEYCMD)));
if (sizeof(CcEmacsMap) != c1)
xprintf("CcEmacsMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcEmacsMap) / sizeof(KEYCMD));
if ((sizeof(CcViMap)) != c1)
xprintf("CcViMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcViMap) / sizeof(KEYCMD)));
if (sizeof(CcViMap) != c1)
xprintf("CcViMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcViMap) / sizeof(KEYCMD));
if ((sizeof(CcViCmdMap)) != c1)
xprintf("CcViCmdMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcViCmdMap) / sizeof(KEYCMD)));
if (sizeof(CcViCmdMap) != c1)
xprintf("CcViCmdMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcViCmdMap) / sizeof(KEYCMD));
}
#endif
......@@ -1889,6 +1889,9 @@ ed_InitVIMaps(void)
int i;
VImode = 1;
setNS(STRvimode);
update_wordchars();
ResetXmap();
for (i = 0; i < NT_NUM_KEYS; i++) {
CcKeyMap[i] = CcViMap[i];
......@@ -1910,6 +1913,10 @@ ed_InitEmacsMaps(void)
cstr.len = 2;
VImode = 0;
if (adrof(STRvimode))
unsetv(STRvimode);
update_wordchars();
ResetXmap();
for (i = 0; i < NT_NUM_KEYS; i++) {
CcKeyMap[i] = CcEmacsMap[i];
......
/* $Header: /p/tcsh/cvsroot/tcsh/ed.refresh.c,v 3.50 2015/05/04 15:31:13 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.refresh.c,v 3.51 2015/06/06 21:19:07 christos Exp $ */
/*
* ed.refresh.c: Lower level screen refreshing functions
*/
......@@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.refresh.c,v 3.50 2015/05/04 15:31:13 christos Exp $")
RCSID("$tcsh: ed.refresh.c,v 3.51 2015/06/06 21:19:07 christos Exp $")
#include "ed.h"
/* #define DEBUG_UPDATE */
......@@ -46,7 +46,7 @@ static int vcursor_h, vcursor_v;
static int rprompt_h, rprompt_v;
static int MakeLiteral (Char *, int, Char);
static int Draw (Char *, int);
static int Draw (Char *, int, int);
static void Vdraw (Char, int);
static void RefreshPromptpart (Char *);
static void update_line (Char *, Char *, int);
......@@ -159,15 +159,44 @@ static int MakeLiteral(Char *str, int len, Char addlit)
return i | LITERAL;
}
/* draw char at cp, expand tabs, ctl chars */
static int
Draw(Char *cp, int nocomb) /* draw char at cp, expand tabs, ctl chars */
Draw(Char *cp, int nocomb, int drawPrompt)
{
int w, i, lv, lh;
Char c, attr;
#ifdef WIDE_STRINGS
if (!drawPrompt) { /* draw command-line */
attr = 0;
c = *cp;
} else { /* draw prompt */
/* prompt with attributes(UNDER,BOLD,STANDOUT) */
if (*cp & (UNDER | BOLD | STANDOUT)) { /* *cp >= STANDOUT */
/* example)
* We can't distinguish whether (*cp=)0x02ffffff is
* U+02FFFFFF or U+00FFFFFF|STANDOUT.
* We handle as U+00FFFFFF|STANDOUT, only when drawing prompt. */
attr = (*cp & ATTRIBUTES);
/* ~(UNDER | BOLD | STANDOUT) = 0xf1ffffff */
c = *cp & ~(UNDER | BOLD | STANDOUT);
/* if c is ctrl code, we handle *cp as havnig no attributes */
if ((c < 0x20 && c >= 0) || c == 0x7f) {
attr = 0;
c = *cp;
}
} else { /* prompt without attributes */
attr = 0;
c = *cp;
}
}
#else
attr = *cp & ~CHAR;
c = *cp & CHAR;
w = NLSClassify(c, nocomb);
#endif
w = NLSClassify(c, nocomb, drawPrompt);
switch (w) {
case NLSCLASS_NL:
Vdraw('\0', 0); /* assure end of line */
......@@ -201,10 +230,11 @@ Draw(Char *cp, int nocomb) /* draw char at cp, expand tabs, ctl chars */
case NLSCLASS_ILLEGAL2:
case NLSCLASS_ILLEGAL3:
case NLSCLASS_ILLEGAL4:
Vdraw('\\' | attr, 1);
Vdraw('U' | attr, 1);
Vdraw('+' | attr, 1);
for (i = 8 * NLSCLASS_ILLEGAL_SIZE(w) - 4; i >= 0; i -= 4)
case NLSCLASS_ILLEGAL5:
Vdraw('\\', 1);
Vdraw('U', 1);
Vdraw('+', 1);
for (i = 16 + 4 * (-w-5); i >= 0; i -= 4)
Vdraw("0123456789ABCDEF"[(c >> i) & 15] | attr, 1);
break;
case 0:
......@@ -302,7 +332,7 @@ RefreshPromptpart(Char *buf)
}
}
else
cp += Draw(cp, cp == buf);
cp += Draw(cp, cp == buf, 1);
}
}
......@@ -354,7 +384,7 @@ Refresh(void)
cur_v = vcursor_v;
Cursor = cp;
}
cp += Draw(cp, cp == InputBuf);
cp += Draw(cp, cp == InputBuf, 0);
}
if (cur_h == -1) { /* if I haven't been set yet, I'm at the end */
......@@ -1126,7 +1156,7 @@ RefCursor(void)
cp++;
continue;
}
w = NLSClassify(*cp & CHAR, cp == Prompt);
w = NLSClassify(*cp & CHAR, cp == Prompt, 0);
cp++;
switch(w) {
case NLSCLASS_NL:
......@@ -1158,7 +1188,7 @@ RefCursor(void)
}
for (cp = InputBuf; cp < Cursor;) { /* do input buffer to Cursor */
w = NLSClassify(*cp & CHAR, cp == InputBuf);
w = NLSClassify(*cp & CHAR, cp == InputBuf, 0);
cp++;
switch(w) {
case NLSCLASS_NL:
......@@ -1251,7 +1281,7 @@ RefPlusOne(int l)
}
cp = Cursor - l;
c = *cp & CHAR;
w = NLSClassify(c, cp == InputBuf);
w = NLSClassify(c, cp == InputBuf, 0);
switch(w) {
case NLSCLASS_CTRL:
PutPlusOne('^', 1);
......
/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.81 2014/03/15 21:25:11 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $ */
/*
* ed.screen.c: Editor/termcap-curses interface
*/
......@@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.screen.c,v 3.81 2014/03/15 21:25:11 christos Exp $")
RCSID("$tcsh: ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $")
#include "ed.h"
#include "tc.h"
......@@ -1564,13 +1564,13 @@ GetSize(int *lins, int *cols)
#endif /* SIG_WINDOW */
#ifdef KNOWsize
static void
static int
UpdateVal(const Char *tag, int value, Char *termcap, Char *backup)
{
Char *ptr, *p;
if ((ptr = Strstr(termcap, tag)) == NULL) {
(void)Strcpy(backup, termcap);
return;
return 0;
} else {
size_t len = (ptr - termcap) + Strlen(tag);
(void)Strncpy(backup, termcap, len);
......@@ -1581,6 +1581,7 @@ UpdateVal(const Char *tag, int value, Char *termcap, Char *backup)
ptr = Strchr(ptr, ':');
if (ptr)
(void) Strcat(backup, ptr);
return 1;
}
}
#endif
......@@ -1626,20 +1627,23 @@ ChangeSize(int lins, int cols)
if ((tptr = getenv("TERMCAP")) != NULL) {
/* Leave 64 characters slop in case we enlarge the termcap string */
Char termcap[TC_BUFSIZE+64], backup[TC_BUFSIZE+64], *ptr;
int changed;
ptr = str2short(tptr);
(void) Strncpy(termcap, ptr, TC_BUFSIZE);
termcap[TC_BUFSIZE-1] = '\0';
UpdateVal(STRco, Val(T_co), termcap, backup);
UpdateVal(STRli, Val(T_li), termcap, backup);
changed = UpdateVal(STRco, Val(T_co), termcap, backup);
changed |= UpdateVal(STRli, Val(T_li), termcap, backup);
/*
* Chop the termcap string at TC_BUFSIZE-1 characters to avoid
* core-dumps in the termcap routines