diff options
author | dchagin <dchagin@FreeBSD.org> | 2017-04-15 11:13:11 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2017-04-15 11:13:11 +0000 |
commit | 9878fb1e0f314058f4c30cc4c77722f00e17188a (patch) | |
tree | 2f0dd759511c9fea5ee93d228684a99622ed5e8e /contrib/tcsh/ed.screen.c | |
parent | 21382a2b98c257da842adc1f651f3e207dd235af (diff) | |
download | FreeBSD-src-9878fb1e0f314058f4c30cc4c77722f00e17188a.zip FreeBSD-src-9878fb1e0f314058f4c30cc4c77722f00e17188a.tar.gz |
MFC r315948:
Update tcsh to 6.20.00
MFC r315952:
Update tcsh to vendor git b605cb561d
Vendor changes:
1. PR/471: Daiki Ueno: Delay interpreting arginp until we've processed
our startup files (which can change the NLS environment).
2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar).
3. Fix out of bounds read (Brooks Davis)
(reproduce by starting tcsh and hitting tab at the prompt).
4. Don't play pointer tricks that are undefined in modern c
(Brooks Davis).
Diffstat (limited to 'contrib/tcsh/ed.screen.c')
-rw-r--r-- | contrib/tcsh/ed.screen.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/contrib/tcsh/ed.screen.c b/contrib/tcsh/ed.screen.c index 8bcbdac..2ef572c 100644 --- a/contrib/tcsh/ed.screen.c +++ b/contrib/tcsh/ed.screen.c @@ -1,4 +1,4 @@ -/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.78 2011/02/27 00:14:38 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.78 2011/02/27 00:14:38 christos Exp $") +RCSID("$tcsh: ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $") #include "ed.h" #include "tc.h" @@ -994,14 +994,14 @@ SetAttributes(Char atr) int highlighting = 0; void -StartHighlight() +StartHighlight(void) { (void) tputs(Str(T_mr), 1, PUTPURE); highlighting = 1; } void -StopHighlight() +StopHighlight(void) { (void) tputs(Str(T_me), 1, PUTPURE); highlighting = 0; @@ -1437,7 +1437,8 @@ GetTermCaps(void) if (i <= 0) { if (i == -1) { #if (SYSVREL == 0) || defined(IRIS3D) - xprintf(CGETS(7, 20, "%s: Cannot open /etc/termcap.\n"), progname); + xprintf(CGETS(7, 20, + "%s: The terminal database could not be opened.\n"), progname); } else if (i == 0) { #endif /* SYSVREL */ @@ -1563,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); @@ -1580,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 @@ -1625,21 +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; - Char buf[4]; + 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 - */ - termcap[TC_BUFSIZE - 1] = '\0'; - tsetenv(STRTERMCAP, termcap); + if (changed) { + /* + * Chop the termcap string at TC_BUFSIZE-1 characters to avoid + * core-dumps in the termcap routines + */ + termcap[TC_BUFSIZE - 1] = '\0'; + tsetenv(STRTERMCAP, termcap); + } } } #endif /* KNOWsize */ |