Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh Fix the code taken from FreeBSD 2 revisions back, whi...
details: https://anonhg.NetBSD.org/src/rev/7457787c6109
branches: trunk
changeset: 995901:7457787c6109
user: kre <kre%NetBSD.org@localhost>
date: Wed Jan 09 11:08:09 2019 +0000
description:
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.
diffstat:
bin/sh/input.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (33 lines):
diff -r d00f5f8c5e70 -r 7457787c6109 bin/sh/input.c
--- a/bin/sh/input.c Wed Jan 09 11:04:54 2019 +0000
+++ b/bin/sh/input.c Wed Jan 09 11:08:09 2019 +0000
@@ -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 @@
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;
}
Home |
Main Index |
Thread Index |
Old Index