DragonFly submit List (threaded) for 2004-12
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
usr.bin/make 2nd try: Add U and L modifiers
This patch should work after patch-4.25 is installed.
Max
---------------------
PatchSet 329
Date: 2004/01/10 16:30:29
Author: ru
Log:
Moved the code for :U and :L modifiers where it belongs, so that
the fallback for SysV (now in POSIX) variable substitution works
for old_string arguments starting with 'U' or 'L'.
Members:
var.c:1.44->1.45
Index: var.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/var.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- var.c 6 Oct 2003 17:37:20 -0000 1.44
+++ var.c 10 Jan 2004 16:30:29 -0000 1.45
@@ -1160,38 +1160,6 @@
DEBUGF(VAR, ("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':
{
@@ -1494,6 +1462,22 @@
free(pattern.matches);
break;
}
+ 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 'O':
if (tstr[1] == endc || tstr[1] == ':') {
newStr = VarSortWords(str, SortIncreasing);
@@ -1518,6 +1502,22 @@
break;
}
/*FALLTHRU*/
+ 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 'H':
if (tstr[1] == endc || tstr[1] == ':') {
newStr = VarModify (str, VarHead, (void *)0);
---------------------
PatchSet 330
Date: 2004/01/12 10:35:46
Author: harti
Log:
Allow variable substitutions in SYSV variable substitutions like
$(SRC:.c=$O). This brings us closer to other makes.
Reviewed by: ru
Obtained from: NetBSD
Members:
var.c:1.45->1.46
Index: var.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/var.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- var.c 10 Jan 2004 16:30:29 -0000 1.45
+++ var.c 12 Jan 2004 10:35:46 -0000 1.46
@@ -1592,37 +1592,48 @@
* Now we break this sucker into the lhs and
* rhs. We must null terminate them of course.
*/
- for (cp = tstr; *cp != '='; cp++)
- continue;
- pattern.lhs = tstr;
- pattern.leftLen = cp - tstr;
- *cp++ = '\0';
+ cp = tstr;
- pattern.rhs = cp;
- cnt = 1;
- while (cnt) {
- if (*cp == endc)
- cnt--;
- else if (*cp == startc)
- cnt++;
- if (cnt)
- cp++;
+ delim = '=';
+ if ((pattern.lhs = VarGetPattern(ctxt,
+ err, &cp, delim, &pattern.flags, &pattern.leftLen,
+ NULL)) == NULL) {
+ /* was: goto cleanup */
+ *lengthPtr = cp - start + 1;
+ if (*freePtr)
+ free(str);
+ if (delim != '\0')
+ Fatal("Unclosed substitution for %s (%c missing)",
+ v->name, delim);
+ return (var_Error);
+ }
+
+ delim = endc;
+ if ((pattern.rhs = VarGetPattern(ctxt,
+ err, &cp, delim, NULL, &pattern.rightLen,
+ &pattern)) == NULL) {
+ /* was: goto cleanup */
+ *lengthPtr = cp - start + 1;
+ if (*freePtr)
+ free(str);
+ if (delim != '\0')
+ Fatal("Unclosed substitution for %s (%c missing)",
+ v->name, delim);
+ return (var_Error);
}
- pattern.rightLen = cp - pattern.rhs;
- *cp = '\0';
/*
* SYSV modifications happen through the whole
* string. Note the pattern is anchored at the end.
*/
+ termc = *--cp;
+ delim = '\0';
newStr = VarModify(str, VarSYSVMatch,
(void *)&pattern);
- /*
- * Restore the nulled characters
- */
- pattern.lhs[pattern.leftLen] = '=';
- pattern.rhs[pattern.rightLen] = endc;
+ free(pattern.lhs);
+ free(pattern.rhs);
+
termc = endc;
} else
#endif
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]