Module Name:    src
Committed By:   christos
Date:           Sun Nov  6 19:46:56 UTC 2011

Modified Files:
        src/usr.bin/make: parse.c

Log Message:
add debugging for parsedir and parsefile


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.179 src/usr.bin/make/parse.c:1.180
--- src/usr.bin/make/parse.c:1.179	Wed Aug 31 12:24:57 2011
+++ src/usr.bin/make/parse.c	Sun Nov  6 14:46:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.179 2011/08/31 16:24:57 plunky Exp $	*/
+/*	$NetBSD: parse.c,v 1.180 2011/11/06 19:46:56 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.179 2011/08/31 16:24:57 plunky Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.180 2011/11/06 19:46:56 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.179 2011/08/31 16:24:57 plunky Exp $");
+__RCSID("$NetBSD: parse.c,v 1.180 2011/11/06 19:46:56 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2213,23 +2213,27 @@ ParseDoInclude(char *line)
 static void
 ParseSetParseFile(const char *filename)
 {
-    char *slash;
-    char *dirname;
+    char *slash, *dirname;
+    const char *pd, *pf;
     int len;
 
     slash = strrchr(filename, '/');
     if (slash == NULL) {
-	Var_Set(".PARSEDIR", curdir, VAR_GLOBAL, 0);
-	Var_Set(".PARSEFILE", filename, VAR_GLOBAL, 0);
+	Var_Set(".PARSEDIR", pd = curdir, VAR_GLOBAL, 0);
+	Var_Set(".PARSEFILE", pf = filename, VAR_GLOBAL, 0);
+	dirname= NULL;
     } else {
 	len = slash - filename;
 	dirname = bmake_malloc(len + 1);
 	memcpy(dirname, filename, len);
-	dirname[len] = 0;
-	Var_Set(".PARSEDIR", dirname, VAR_GLOBAL, 0);
-	Var_Set(".PARSEFILE", slash+1, VAR_GLOBAL, 0);
-	free(dirname);
+	dirname[len] = '\0';
+	Var_Set(".PARSEDIR", pd = dirname, VAR_GLOBAL, 0);
+	Var_Set(".PARSEFILE", pf = slash + 1, VAR_GLOBAL, 0);
     }
+    if (DEBUG(PARSE))
+	fprintf(debug_file, "ParseSetParseFile: ${.PARSEDIR} = `%s' "
+	    "${.PARSEFILE} = `%s'\n", pd, pf);
+    free(dirname);
 }
 
 /*

Reply via email to