Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Remove Check_Cwd - it is no longer needed.
details: https://anonhg.NetBSD.org/src/rev/7306792ce17a
branches: trunk
changeset: 784317:7306792ce17a
user: sjg <sjg%NetBSD.org@localhost>
date: Fri Jan 25 02:01:10 2013 +0000
description:
Remove Check_Cwd - it is no longer needed.
diffstat:
usr.bin/make/compat.c | 7 +-
usr.bin/make/job.c | 16 +---
usr.bin/make/main.c | 193 +-------------------------------------------------
3 files changed, 9 insertions(+), 207 deletions(-)
diffs (truncated from 326 to 300 lines):
diff -r eed46f027097 -r 7306792ce17a usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Fri Jan 25 00:06:05 2013 +0000
+++ b/usr.bin/make/compat.c Fri Jan 25 02:01:10 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.90 2012/10/07 19:17:31 sjg Exp $ */
+/* $NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.90 2012/10/07 19:17:31 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: compat.c,v 1.90 2012/10/07 19:17:31 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -374,7 +374,6 @@
Fatal("Could not fork");
}
if (cpid == 0) {
- Check_Cwd(av);
Var_ExportVars();
#ifdef USE_META
if (useMeta) {
diff -r eed46f027097 -r 7306792ce17a usr.bin/make/job.c
--- a/usr.bin/make/job.c Fri Jan 25 00:06:05 2013 +0000
+++ b/usr.bin/make/job.c Fri Jan 25 02:01:10 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.163 2012/07/03 21:03:40 sjg Exp $ */
+/* $NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.163 2012/07/03 21:03:40 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: job.c,v 1.163 2012/07/03 21:03:40 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -675,7 +675,6 @@
char *escCmd = NULL; /* Command with quotes/backticks escaped */
char *cmd = (char *)cmdp;
Job *job = (Job *)jobp;
- char *cp, *tmp;
int i, j;
noSpecials = NoExecute(job->node);
@@ -847,11 +846,6 @@
job->flags |= JOB_TRACED;
}
- if ((cp = Check_Cwd_Cmd(cmd)) != NULL) {
- DBPRINTF("test -d %s && ", cp);
- DBPRINTF("cd %s\n", cp);
- }
-
DBPRINTF(cmdTemplate, cmd);
free(cmdStart);
if (escCmd)
@@ -871,10 +865,6 @@
if (shutUp && commandShell->hasEchoCtl) {
DBPRINTF("%s\n", commandShell->echoOn);
}
- if (cp != NULL) {
- DBPRINTF("test -d %s && ", cp);
- DBPRINTF("cd %s\n", Var_Value(".OBJDIR", VAR_GLOBAL, &tmp));
- }
return 0;
}
diff -r eed46f027097 -r 7306792ce17a usr.bin/make/main.c
--- a/usr.bin/make/main.c Fri Jan 25 00:06:05 2013 +0000
+++ b/usr.bin/make/main.c Fri Jan 25 02:01:10 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.203 2012/08/31 07:00:36 sjg Exp $ */
+/* $NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.203 2012/08/31 07:00:36 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.203 2012/08/31 07:00:36 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -176,7 +176,6 @@
Boolean doing_depend; /* Set while reading .depend */
static Boolean jobsRunning; /* TRUE if the jobs might be running */
static const char * tracefile;
-static char * Check_Cwd_av(int, char **, int);
static void MainParseArgs(int, char **);
static int ReadMakefile(const void *, const void *);
static void usage(void) MAKE_ATTR_DEAD;
@@ -1165,8 +1164,6 @@
jp_0, jp_1, maxJobs, maxJobTokens, compatMake);
Main_ExportMAKEFLAGS(TRUE); /* initial export */
-
- Check_Cwd_av(0, NULL, 0); /* initialize it */
/*
@@ -1384,190 +1381,6 @@
}
-/*
- * If MAKEOBJDIRPREFIX is in use, make ends up not in .CURDIR
- * in situations that would not arrise with ./obj (links or not).
- * This tends to break things like:
- *
- * build:
- * ${MAKE} includes
- *
- * This function spots when ${.MAKE:T} or ${.MAKE} is a command (as
- * opposed to an argument) in a command line and if so returns
- * ${.CURDIR} so caller can chdir() so that the assumptions made by
- * the Makefile hold true.
- *
- * If ${.MAKE} does not contain any '/', then ${.MAKE:T} is skipped.
- *
- * The chdir() only happens in the child process, and does nothing if
- * MAKEOBJDIRPREFIX and MAKEOBJDIR are not in the environment so it
- * should not break anything. Also if NOCHECKMAKECHDIR is set we
- * do nothing - to ensure historic semantics can be retained.
- */
-static int Check_Cwd_Off = 0;
-
-static char *
-Check_Cwd_av(int ac, char **av, int copy)
-{
- static char *make[4];
- static char *cur_dir = NULL;
- char **mp;
- char *cp;
- int is_cmd, next_cmd;
- int i;
- int n;
-
- if (Check_Cwd_Off) {
- if (DEBUG(CWD))
- fprintf(debug_file, "check_cwd: check is off.\n");
- return NULL;
- }
-
- if (make[0] == NULL) {
- if (Var_Exists("NOCHECKMAKECHDIR", VAR_GLOBAL)) {
- Check_Cwd_Off = 1;
- if (DEBUG(CWD))
- fprintf(debug_file, "check_cwd: turning check off.\n");
- return NULL;
- }
-
- make[1] = Var_Value(".MAKE", VAR_GLOBAL, &cp);
- if ((make[0] = strrchr(make[1], '/')) == NULL) {
- make[0] = make[1];
- make[1] = NULL;
- } else
- ++make[0];
- make[2] = NULL;
- cur_dir = Var_Value(".CURDIR", VAR_GLOBAL, &cp);
- }
- if (ac == 0 || av == NULL) {
- if (DEBUG(CWD))
- fprintf(debug_file, "check_cwd: empty command.\n");
- return NULL; /* initialization only */
- }
-
- if (getenv("MAKEOBJDIR") == NULL &&
- getenv("MAKEOBJDIRPREFIX") == NULL) {
- if (DEBUG(CWD))
- fprintf(debug_file, "check_cwd: no obj dirs.\n");
- return NULL;
- }
-
-
- next_cmd = 1;
- for (i = 0; i < ac; ++i) {
- is_cmd = next_cmd;
-
- n = strlen(av[i]);
- cp = &(av[i])[n - 1];
- if (strspn(av[i], "|&;") == (size_t)n) {
- next_cmd = 1;
- continue;
- } else if (*cp == ';' || *cp == '&' || *cp == '|' || *cp == ')') {
- next_cmd = 1;
- if (copy) {
- do {
- *cp-- = '\0';
- } while (*cp == ';' || *cp == '&' || *cp == '|' ||
- *cp == ')' || *cp == '}') ;
- } else {
- /*
- * XXX this should not happen.
- */
- fprintf(stderr, "%s: WARNING: raw arg ends in shell meta '%s'\n",
- progname, av[i]);
- }
- } else
- next_cmd = 0;
-
- cp = av[i];
- if (*cp == ';' || *cp == '&' || *cp == '|')
- is_cmd = 1;
-
- if (DEBUG(CWD))
- fprintf(debug_file, "av[%d] == %s '%s'",
- i, (is_cmd) ? "cmd" : "arg", av[i]);
- if (is_cmd != 0) {
- if (*cp == '(' || *cp == '{' ||
- *cp == ';' || *cp == '&' || *cp == '|') {
- do {
- ++cp;
- } while (*cp == '(' || *cp == '{' ||
- *cp == ';' || *cp == '&' || *cp == '|');
- if (*cp == '\0') {
- next_cmd = 1;
- continue;
- }
- }
- if (strcmp(cp, "cd") == 0 || strcmp(cp, "chdir") == 0) {
- if (DEBUG(CWD))
- fprintf(debug_file, " == cd, done.\n");
- return NULL;
- }
- for (mp = make; *mp != NULL; ++mp) {
- n = strlen(*mp);
- if (strcmp(cp, *mp) == 0) {
- if (DEBUG(CWD))
- fprintf(debug_file, " %s == '%s', chdir(%s)\n",
- cp, *mp, cur_dir);
- return cur_dir;
- }
- }
- }
- if (DEBUG(CWD))
- fprintf(debug_file, "\n");
- }
- return NULL;
-}
-
-char *
-Check_Cwd_Cmd(const char *cmd)
-{
- char *cp, *bp;
- char **av;
- int ac;
-
- if (Check_Cwd_Off)
- return NULL;
-
- if (cmd) {
- av = brk_string(cmd, &ac, TRUE, &bp);
- if (DEBUG(CWD))
- fprintf(debug_file, "splitting: '%s' -> %d words\n",
- cmd, ac);
- } else {
- ac = 0;
- av = NULL;
- bp = NULL;
- }
- cp = Check_Cwd_av(ac, av, 1);
- if (bp)
- free(bp);
- if (av)
- free(av);
Home |
Main Index |
Thread Index |
Old Index