Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make ParseVErrorInternal: use .PARSEDIR and
details: https://anonhg.NetBSD.org/src/rev/3f6bd82bbafe
branches: trunk
changeset: 837799:3f6bd82bbafe
user: sjg <sjg%NetBSD.org@localhost>
date: Sat Dec 22 00:36:32 2018 +0000
description:
ParseVErrorInternal: use .PARSEDIR and
apply realpath(3) if not absolute,
and use .PARSEFILE for consitent results.
Reviewed by: christos
diffstat:
usr.bin/make/parse.c | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diffs (66 lines):
diff -r acb9832a1537 -r 3f6bd82bbafe usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Fri Dec 21 14:52:12 2018 +0000
+++ b/usr.bin/make/parse.c Sat Dec 22 00:36:32 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.230 2018/12/17 02:06:00 christos Exp $ */
+/* $NetBSD: parse.c,v 1.231 2018/12/22 00:36:32 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.230 2018/12/17 02:06:00 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.231 2018/12/22 00:36:32 sjg 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.230 2018/12/17 02:06:00 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.231 2018/12/22 00:36:32 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -676,21 +676,32 @@
if (cfname != NULL) {
(void)fprintf(f, "\"");
if (*cfname != '/' && strcmp(cfname, "(stdin)") != 0) {
- char *cp;
- const char *dir;
+ char *cp, *cp2;
+ const char *dir, *fname;
/*
* Nothing is more annoying than not knowing
* which Makefile is the culprit; we try ${.PARSEDIR}
- * first and if that's not absolute, we try ${.CURDIR}
+ * and apply realpath(3) if not absolute.
*/
dir = Var_Value(".PARSEDIR", VAR_GLOBAL, &cp);
- if (dir == NULL || *dir == '\0' || *dir != '/')
- dir = Var_Value(".CURDIR", VAR_GLOBAL, &cp);
if (dir == NULL)
dir = ".";
-
- (void)fprintf(f, "%s/%s", dir, cfname);
+ if (*dir != '/') {
+ dir = cp2 = realpath(dir, NULL);
+ free(cp);
+ cp = cp2; /* cp2 set to NULL by Var_Value */
+ }
+ fname = Var_Value(".PARSEFILE", VAR_GLOBAL, &cp2);
+ if (fname == NULL) {
+ if ((fname = strrchr(cfname, '/')))
+ fname++;
+ else
+ fname = cfname;
+ }
+ (void)fprintf(f, "%s/%s", dir, fname);
+ free(cp2);
+ free(cp);
} else
(void)fprintf(f, "%s", cfname);
Home |
Main Index |
Thread Index |
Old Index