File tcsh-6.20.00-postcmd.patch of Package tcsh.19070
https://bugs.astron.com/view.php?id=74#c3238
This is the upstream fix backported from tcsh-6.21.00
Avoid trouble with e.g.
alias postcmd false
set counter=1
while ($counter > )
@ counter--
echo $counter
end
and similar scriptlets, maybe there is a better solution to
protect dowhile(), nevertheless this works.
---
tcsh-6.20.00/sh.lex.c | 4 +++-
tcsh-6.20.00/tc.func.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
--- tcsh-6.20.00/sh.lex.c
+++ tcsh-6.20.00/sh.lex.c 2019-05-09 05:35:56.696918508 +0000
@@ -142,6 +142,7 @@ static time_t a2time_t (Char *);
* special parsing rules apply for source -h
*/
extern int enterhist;
+extern int postcmd_active;
int
lex(struct wordent *hp)
@@ -153,7 +154,8 @@ lex(struct wordent *hp)
histvalid = 0;
histline.len = 0;
- btell(&lineloc);
+ if (!postcmd_active)
+ btell(&lineloc);
hp->next = hp->prev = hp;
hp->word = STRNULL;
hadhist = 0;
--- tcsh-6.20.00/tc.func.c
+++ tcsh-6.20.00/tc.func.c 2019-05-09 05:38:14.310299504 +0000
@@ -57,7 +57,7 @@ extern time_t t_period;
extern int just_signaled;
static int precmd_active = 0;
static int jobcmd_active = 0; /* GrP */
-static int postcmd_active = 0;
+int postcmd_active = 0;
static int periodic_active = 0;
static int cwdcmd_active = 0; /* PWP: for cwd_cmd */
static int beepcmd_active = 0;