Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Allow MAKESYSPATH in the environment to overrid...



details:   https://anonhg.NetBSD.org/src/rev/bba345f5a1cd
branches:  trunk
changeset: 485505:bba345f5a1cd
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sat Apr 29 12:15:16 2000 +0000

description:
Allow MAKESYSPATH in the environment to override the default syspath.

diffstat:

 usr.bin/make/main.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (63 lines):

diff -r 4607fee46ce6 -r bba345f5a1cd usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Apr 29 09:47:01 2000 +0000
+++ b/usr.bin/make/main.c       Sat Apr 29 12:15:16 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.54 2000/04/20 11:23:26 sjg Exp $    */
+/*     $NetBSD: main.c,v 1.55 2000/04/29 12:15:16 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -39,7 +39,7 @@
  */
 
 #ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: main.c,v 1.54 2000/04/20 11:23:26 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.55 2000/04/29 12:15:16 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -51,7 +51,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.54 2000/04/20 11:23:26 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.55 2000/04/29 12:15:16 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -474,11 +474,12 @@
        char cdpath[MAXPATHLEN + 1];
        char *machine = getenv("MACHINE");
        char *machine_arch = getenv("MACHINE_ARCH");
+       char *syspath = getenv("MAKESYSPATH");
        Lst sysMkPath;                  /* Path of sys.mk */
        char *cp = NULL, *start;
                                        /* avoid faults on read-only strings */
-       static char syspath[] = _PATH_DEFSYSPATH;
-
+       static char defsyspath[] = _PATH_DEFSYSPATH;
+       
        if ((progname = strrchr(argv[0], '/')) != NULL)
                progname++;
        else
@@ -711,6 +712,11 @@
         * as dir1:...:dirn) to the system include path.
         */
        if (!mkIncPath) {
+               if (syspath == NULL || *syspath == '\0')
+                       syspath = defsyspath;
+               else
+                       syspath = strdup(syspath);
+           
                for (start = syspath; *start != '\0'; start = cp) {
                        for (cp = start; *cp != '\0' && *cp != ':'; cp++)
                                continue;
@@ -721,6 +727,8 @@
                                (void) Dir_AddDir(sysIncPath, start);
                        }
                }
+               if (syspath != defsyspath)
+                   free(syspath);
        }
 
        /*



Home | Main Index | Thread Index | Old Index