Offical fixes to allow longer lines in the history and tweak expand_lex()

useage.
This commit is contained in:
David E. O'Brien 2000-06-10 22:20:53 +00:00
parent d9a02933d5
commit b2be84b199
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/tcsh/dist/; revision=61524
svn path=/vendor/tcsh/6.09.01-20000610/; revision=61526; tag=vendor/tcsh/6.09.01-20000610
4 changed files with 30 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $Header: /src/pub/tcsh/ed.chared.c,v 3.59 1999/08/13 16:34:57 christos Exp $ */
/* $Header: /src/pub/tcsh/ed.chared.c,v 3.60 2000/06/10 22:07:55 kim Exp $ */
/*
* ed.chared.c: Character editing functions.
*/
@ -76,7 +76,7 @@
#include "sh.h"
RCSID("$Id: ed.chared.c,v 3.59 1999/08/13 16:34:57 christos Exp $")
RCSID("$Id: ed.chared.c,v 3.60 2000/06/10 22:07:55 kim Exp $")
#include "ed.h"
#include "tw.h"
@ -959,7 +959,7 @@ c_get_histline()
CurrentHistLit = 1;
}
else {
(void) sprlex(InputBuf, sizeof(InputBuf), &hp->Hlex);
(void) sprlex(InputBuf, sizeof(InputBuf) / sizeof(Char), &hp->Hlex);
CurrentHistLit = 0;
}
LastChar = InputBuf + Strlen(InputBuf);
@ -1704,7 +1704,7 @@ e_toggle_hist(c)
}
}
else {
(void) sprlex(InputBuf, sizeof(InputBuf), &hp->Hlex);
(void) sprlex(InputBuf, sizeof(InputBuf) / sizeof(Char), &hp->Hlex);
CurrentHistLit = 0;
}
@ -1855,9 +1855,11 @@ e_up_search_hist(c)
while (hp != NULL) {
Char sbuf[INBUFSIZE], *hl;
if (hp->histline == NULL) {
hp->histline = Strsave(sprlex(sbuf, sizeof(sbuf), &hp->Hlex));
hp->histline = Strsave(sprlex(sbuf, sizeof(sbuf) / sizeof(Char),
&hp->Hlex));
}
hl = HistLit ? hp->histline : sprlex(sbuf, sizeof(sbuf), &hp->Hlex);
hl = HistLit ? hp->histline : sprlex(sbuf, sizeof(sbuf) / sizeof(Char),
&hp->Hlex);
#ifdef SDEBUG
xprintf("Comparing with \"%S\"\n", hl);
#endif
@ -1908,9 +1910,11 @@ e_down_search_hist(c)
for (h = 1; h < Hist_num && hp; h++) {
Char sbuf[INBUFSIZE], *hl;
if (hp->histline == NULL) {
hp->histline = Strsave(sprlex(sbuf, sizeof(sbuf), &hp->Hlex));
hp->histline = Strsave(sprlex(sbuf, sizeof(sbuf) / sizeof(Char),
&hp->Hlex));
}
hl = HistLit ? hp->histline : sprlex(sbuf, sizeof(sbuf), &hp->Hlex);
hl = HistLit ? hp->histline : sprlex(sbuf, sizeof(sbuf) / sizeof(Char),
&hp->Hlex);
#ifdef SDEBUG
xprintf("Comparing with \"%S\"\n", hl);
#endif

View File

@ -1,4 +1,4 @@
/* $Header: /src/pub/tcsh/sh.h,v 3.87 2000/01/14 22:57:28 christos Exp $ */
/* $Header: /src/pub/tcsh/sh.h,v 3.88 2000/06/10 22:06:27 kim Exp $ */
/*
* sh.h: Catch it all globals and includes file!
*/
@ -121,12 +121,12 @@ typedef int sigret_t;
* MAILINTVL How often to mailcheck; more often is more expensive
*/
#ifdef BUFSIZE
# if BUFSIZE < 1024
# if BUFSIZE < 4096
# undef BUFSIZE
# define BUFSIZE 1024 /* buffer size should be no less than this */
# define BUFSIZE 4096 /* buffer size should be no less than this */
# endif
#else
# define BUFSIZE 1024
# define BUFSIZE 4096
#endif /* BUFSIZE */
#define FORKSLEEP 10 /* delay loop on non-interactive fork failure */

View File

@ -1,4 +1,4 @@
/* $Header: /src/pub/tcsh/sh.hist.c,v 3.26 1999/02/06 15:01:23 christos Exp $ */
/* $Header: /src/pub/tcsh/sh.hist.c,v 3.27 2000/06/10 22:07:56 kim Exp $ */
/*
* sh.hist.c: Shell history expansions and substitutions
*/
@ -36,7 +36,7 @@
*/
#include "sh.h"
RCSID("$Id: sh.hist.c,v 3.26 1999/02/06 15:01:23 christos Exp $")
RCSID("$Id: sh.hist.c,v 3.27 2000/06/10 22:07:56 kim Exp $")
#include "tc.h"
@ -376,7 +376,7 @@ fmthist(fmt, ptr, buf, bufsiz)
else {
Char ibuf[INBUFSIZE], *ip;
char *p;
(void) sprlex(ibuf, sizeof(ibuf), &hp->Hlex);
(void) sprlex(ibuf, sizeof(ibuf) / sizeof(Char), &hp->Hlex);
for (p = buf, ip = ibuf; (*p++ = (CHAR & *ip++)) != '\0'; )
continue;
}

View File

@ -1,4 +1,4 @@
/* $Header: /src/pub/tcsh/tc.func.c,v 3.87 1999/08/14 21:24:13 christos Exp $ */
/* $Header: /src/pub/tcsh/tc.func.c,v 3.88 2000/06/10 22:05:39 kim Exp $ */
/*
* tc.func.c: New tcsh builtins.
*/
@ -36,7 +36,7 @@
*/
#include "sh.h"
RCSID("$Id: tc.func.c,v 3.87 1999/08/14 21:24:13 christos Exp $")
RCSID("$Id: tc.func.c,v 3.88 2000/06/10 22:05:39 kim Exp $")
#include "ed.h"
#include "ed.defns.h" /* for the function names */
@ -90,12 +90,15 @@ static void getremotehost __P((void));
*/
/*
* expand_lex: Take the given lex and put an expanded version of it in the
* string buf. First guy in lex list is ignored; last guy is ^J which we
* ignore Only take lex'es from position from to position to inclusive Note:
* csh sometimes sets bit 8 in characters which causes all kinds of problems
* if we don't mask it here. Note: excl's in lexes have been un-back-slashed
* and must be re-back-slashed
* expand_lex: Take the given lex and put an expanded version of it in
* the string buf. First guy in lex list is ignored; last guy is ^J
* which we ignore. Only take lex'es from position 'from' to position
* 'to' inclusive
*
* Note: csh sometimes sets bit 8 in characters which causes all kinds
* of problems if we don't mask it here. Note: excl's in lexes have been
* un-back-slashed and must be re-back-slashed
*
* (PWP: NOTE: this returns a pointer to the END of the string expanded
* (in other words, where the NUL is).)
*/