Fix the code taken from FreeBSD 2 revisions back, which fixed

aliases, to actually do what it was supposed to do, and not just
come close by accident.   (How broken this was, while still seeming
to work perfectly most of the time was truly amazing!)

This corrects the behaviour of an alias defined with a blank char
as the last of its value, to correctly do an alias lookup on the
word that follows the alias.
This commit is contained in:
kre 2019-01-09 11:08:09 +00:00
parent 6046dde455
commit ed405f1d4e
1 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: input.c,v 1.65 2019/01/09 11:04:54 kre Exp $ */
/* $NetBSD: input.c,v 1.66 2019/01/09 11:08:09 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95";
#else
__RCSID("$NetBSD: input.c,v 1.65 2019/01/09 11:04:54 kre Exp $");
__RCSID("$NetBSD: input.c,v 1.66 2019/01/09 11:08:09 kre Exp $");
#endif
#endif /* not lint */
@ -433,8 +433,12 @@ popstring(void)
INTOFF;
if (sp->ap) {
if (parsenextc != sp->ap->val &&
(parsenextc[-1] == ' ' || parsenextc[-1] == '\t'))
int alen;
if (!quoteflag &&
(alen = strlen(sp->ap->val)) > 0 &&
(sp->ap->val[alen - 1] == ' ' ||
sp->ap->val[alen - 1] == '\t'))
checkkwd |= CHKALIAS;
sp->ap->flag &= ~ALIASINUSE;
}