diff options
| author | Will Andrews <will@FreeBSD.org> | 2000-10-09 04:53:36 +0000 |
|---|---|---|
| committer | Will Andrews <will@FreeBSD.org> | 2000-10-09 04:53:36 +0000 |
| commit | 28323ac07e5f141e2e16264683331d317c7e55ab (patch) | |
| tree | 1033688be495318792307f2e6c3acefa983d28d9 /usr.bin/make | |
| parent | 2694d8d14727b4ce0852382fee7e9940e27651d5 (diff) | |
Notes
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/make.1 | 4 | ||||
| -rw-r--r-- | usr.bin/make/var.c | 34 |
2 files changed, 38 insertions, 0 deletions
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1 index 85a53d5e09998..5016bd333ff21 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 c0df0a086b004..d4c825fd61c94 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': { |
