make(1): fix bug in :E modifier, introduced in r1.239 today
That case was not covered by the tests before.
This commit is contained in:
parent
abc8b07393
commit
839d614315
@ -7,8 +7,8 @@ path_/usr/xbin=/opt/xbin/
|
|||||||
paths=/bin /tmp / /no/such/dir /opt/xbin
|
paths=/bin /tmp / /no/such/dir /opt/xbin
|
||||||
PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN
|
PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN
|
||||||
The answer is 42
|
The answer is 42
|
||||||
head of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b . . conf.d
|
head of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b . . conf.d'
|
||||||
tail of 'a/b/c def archive.tar.gz conf.d/file' is 'c def archive.tar.gz file
|
tail of 'a/b/c def archive.tar.gz conf.d/file' is 'c def archive.tar.gz file'
|
||||||
suffix of 'a/b/c def archive.tar.gz conf.d/file' is 'gz d/file
|
suffix of 'a/b/c def archive.tar.gz conf.d/file' is 'gz d/file'
|
||||||
root of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b/c def archive.tar conf
|
root of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b/c def archive.tar conf'
|
||||||
exit status 0
|
exit status 0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $Id: modmisc.mk,v 1.5 2020/07/03 15:41:37 rillig Exp $
|
# $Id: modmisc.mk,v 1.6 2020/07/03 18:41:50 rillig Exp $
|
||||||
#
|
#
|
||||||
# miscellaneous modifier tests
|
# miscellaneous modifier tests
|
||||||
|
|
||||||
@ -37,9 +37,9 @@ modvarloop:
|
|||||||
@echo "paths=${paths}"
|
@echo "paths=${paths}"
|
||||||
@echo "PATHS=${paths:tu}"
|
@echo "PATHS=${paths:tu}"
|
||||||
|
|
||||||
PATHNAMES= a/b/c def archive.tar.gz conf.d/file
|
PATHNAMES= a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
|
||||||
mod-HTE:
|
mod-HTE:
|
||||||
@echo "head of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}
|
@echo "dirname of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}"'"
|
||||||
@echo "tail of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}
|
@echo "basename of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}"'"
|
||||||
@echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}
|
@echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}"'"
|
||||||
@echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}
|
@echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}"'"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: var.c,v 1.242 2020/07/03 17:48:47 rillig Exp $ */
|
/* $NetBSD: var.c,v 1.243 2020/07/03 18:41:50 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: var.c,v 1.242 2020/07/03 17:48:47 rillig Exp $";
|
static char rcsid[] = "$NetBSD: var.c,v 1.243 2020/07/03 18:41:50 rillig Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: var.c,v 1.242 2020/07/03 17:48:47 rillig Exp $");
|
__RCSID("$NetBSD: var.c,v 1.243 2020/07/03 18:41:50 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@ -1202,7 +1202,7 @@ VarTail(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the filename suffix of the given word to the buffer. */
|
/* Add the filename suffix of the given word to the buffer, if it exists. */
|
||||||
static Boolean
|
static Boolean
|
||||||
VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||||
char *word, Boolean addSpace, Buffer *buf,
|
char *word, Boolean addSpace, Buffer *buf,
|
||||||
@ -1210,7 +1210,7 @@ VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
|||||||
{
|
{
|
||||||
const char *dot = strrchr(word, '.');
|
const char *dot = strrchr(word, '.');
|
||||||
if (dot == NULL)
|
if (dot == NULL)
|
||||||
return FALSE;
|
return addSpace;
|
||||||
|
|
||||||
if (addSpace && vpstate->varSpace)
|
if (addSpace && vpstate->varSpace)
|
||||||
Buf_AddByte(buf, vpstate->varSpace);
|
Buf_AddByte(buf, vpstate->varSpace);
|
||||||
|
Loading…
Reference in New Issue
Block a user