summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorwill <will@FreeBSD.org>2000-10-09 04:53:36 +0000
committerwill <will@FreeBSD.org>2000-10-09 04:53:36 +0000
commitf8221971286cefd2c2ae491365898ac88c77bf95 (patch)
treea9fdd24981e788728d54aa7b8f51cb7ff662d19b /usr.bin/make
parentf64d032304ea928029587503826224422c0746d1 (diff)
downloadFreeBSD-src-f8221971286cefd2c2ae491365898ac88c77bf95.zip
FreeBSD-src-f8221971286cefd2c2ae491365898ac88c77bf95.tar.gz
Add :L and :U variable modifiers. These convert the variable's value to
all-lower or all-upper case characters, respectively. These were added to further reduce differences between NetBSD/OpenBSD and FreeBSD make(1) to propagate OpenPackages. PR: 19959 Submitted by: Gaspar Chilingarav <nm@web.am>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/make.14
-rw-r--r--usr.bin/make/var.c34
2 files changed, 38 insertions, 0 deletions
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index 85a53d5..5016bd3 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -628,6 +628,8 @@ potentially occur within each affected word.
Replaces each word in the variable with its suffix.
.It Cm H
Replaces each word in the variable with everything but the last component.
+.It Cm L
+Converts variable to lower-case letters.
.It Cm M Ns Ar pattern
Select only those words that match the rest of the modifier.
The standard shell wildcard characters
@@ -717,6 +719,8 @@ is the substring of
.Ar old_string
to be replaced in
.Ar new_string
+.It Cm U
+Converts variable to upper-case letters.
.El
.Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS
Directives, conditionals, and for loops reminiscent
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index c0df0a0..d4c825f 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1739,6 +1739,8 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
* (pathname minus the suffix).
* :lhs=rhs Like :S, but the rhs goes to the end of
* the invocation.
+ * :U Converts variable to upper-case.
+ * :L Converts variable to lower-case.
*/
if ((str != (char *)NULL) && haveModifier) {
/*
@@ -1753,6 +1755,38 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
printf("Applying :%c to \"%s\"\n", *tstr, str);
}
switch (*tstr) {
+ case 'U':
+ if (tstr[1] == endc || tstr[1] == ':') {
+ Buffer buf;
+ buf = Buf_Init(MAKE_BSIZE);
+ for (cp = str; *cp ; cp++)
+ Buf_AddByte(buf, (Byte) toupper(*cp));
+
+ Buf_AddByte(buf, (Byte) '\0');
+ newStr = (char *) Buf_GetAll(buf, (int *) NULL);
+ Buf_Destroy(buf, FALSE);
+
+ cp = tstr + 1;
+ termc = *cp;
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'L':
+ if (tstr[1] == endc || tstr[1] == ':') {
+ Buffer buf;
+ buf = Buf_Init(MAKE_BSIZE);
+ for (cp = str; *cp ; cp++)
+ Buf_AddByte(buf, (Byte) tolower(*cp));
+
+ Buf_AddByte(buf, (Byte) '\0');
+ newStr = (char *) Buf_GetAll(buf, (int *) NULL);
+ Buf_Destroy(buf, FALSE);
+
+ cp = tstr + 1;
+ termc = *cp;
+ break;
+ }
+ /* FALLTHROUGH */
case 'N':
case 'M':
{
OpenPOWER on IntegriCloud