Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): trying to understand how DirExpandCurl...



details:   https://anonhg.NetBSD.org/src/rev/9093ac7b09a7
branches:  trunk
changeset: 936601:9093ac7b09a7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 31 17:41:35 2020 +0000

description:
make(1): trying to understand how DirExpandCurly works

diffstat:

 usr.bin/make/dir.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 35733405e6a5 -r 9093ac7b09a7 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Fri Jul 31 16:59:34 2020 +0000
+++ b/usr.bin/make/dir.c        Fri Jul 31 17:41:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.77 2020/07/31 16:59:34 rillig Exp $  */
+/*     $NetBSD: dir.c,v 1.78 2020/07/31 17:41:35 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.77 2020/07/31 16:59:34 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.78 2020/07/31 17:41:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.77 2020/07/31 16:59:34 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.78 2020/07/31 17:41:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -694,16 +694,20 @@
     for (end = start, bracelevel = 0; *end != '\0'; end++) {
        if (*end == '{') {
            bracelevel++;
-       } else if ((*end == '}') && (bracelevel-- == 0)) {
+       } else if (*end == '}' && bracelevel-- == 0) {
            break;
        }
     }
+    if (DEBUG(DIR))
+       fprintf(debug_file, "%s: word=\"%s\" start=\"%s\" end=\"%s\"\n",
+               __func__, word, start, end);
+
     if (*end == '\0') {
        Error("Unterminated {} clause \"%s\"", start);
        return;
-    } else {
-       end++;
     }
+
+    end++;
     otherLen = brace - word + strlen(end);
 
     for (cp = start; cp < end; cp++) {
@@ -733,6 +737,10 @@
            fileend += cp - start;
        }
        strcpy(fileend, end);
+       if (DEBUG(DIR))
+           fprintf(debug_file, "%s: \"%.*s\" + \"%.*s\" + \"%s\" = \"%s\"\n",
+               __func__, (int)(brace - word), word, (int)(cp - start), start,
+               end, file);
 
        /*
         * See if the result has any wildcards in it. If we find one, call



Home | Main Index | Thread Index | Old Index