summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/main.c')
-rw-r--r--usr.bin/make/main.c77
1 files changed, 39 insertions, 38 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 19f00b6..50941a8 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -133,6 +133,7 @@ static char *objdir; /* where we chdir'ed to */
static void
MFLAGS_append(char *flag, char *arg)
{
+
Var_Append(MAKEFLAGS, flag, VAR_GLOBAL);
if (arg != NULL)
Var_Append(MAKEFLAGS, arg, VAR_GLOBAL);
@@ -255,8 +256,8 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
}
case 'E':
p = emalloc(strlen(optarg) + 1);
- (void)strcpy(p, optarg);
- (void)Lst_AtEnd(envFirstVars, (void *)p);
+ strcpy(p, optarg);
+ Lst_AtEnd(envFirstVars, (void *)p);
MFLAGS_append("-E", optarg);
break;
case 'e':
@@ -264,7 +265,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
MFLAGS_append("-e", NULL);
break;
case 'f':
- (void)Lst_AtEnd(makefiles, (void *)optarg);
+ Lst_AtEnd(makefiles, (void *)optarg);
break;
case 'i':
ignoreErrors = TRUE;
@@ -347,7 +348,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
optind = 1; /* - */
goto rearg;
}
- (void)Lst_AtEnd(create, (void *)estrdup(*argv));
+ Lst_AtEnd(create, (void *)estrdup(*argv));
}
}
@@ -391,12 +392,12 @@ chdir_verify_path(char *path, char *obpath)
if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
if (chdir(path) == -1 || getcwd(obpath, MAXPATHLEN) == NULL) {
warn("warning: %s", path);
- return 0;
+ return (0);
}
- return obpath;
+ return (obpath);
}
- return 0;
+ return (0);
}
static void
@@ -498,7 +499,7 @@ main(int argc, char **argv)
if (getrlimit(RLIMIT_NOFILE, &rl) != -1 &&
rl.rlim_cur != rl.rlim_max) {
rl.rlim_cur = rl.rlim_max;
- (void) setrlimit(RLIMIT_NOFILE, &rl);
+ setrlimit(RLIMIT_NOFILE, &rl);
}
}
#endif
@@ -658,11 +659,11 @@ main(int argc, char **argv)
if (!(path = getenv("MAKEOBJDIR"))) {
path = _PATH_OBJDIR;
pathp = _PATH_OBJDIRPREFIX;
- (void) snprintf(mdpath, MAXPATHLEN, "%s.%s",
+ snprintf(mdpath, MAXPATHLEN, "%s.%s",
path, machine);
if (!(objdir = chdir_verify_path(mdpath, obpath)))
if (!(objdir=chdir_verify_path(path, obpath))) {
- (void) snprintf(mdpath, MAXPATHLEN,
+ snprintf(mdpath, MAXPATHLEN,
"%s%s", pathp, curdir);
if (!(objdir=chdir_verify_path(mdpath,
obpath)))
@@ -673,7 +674,7 @@ main(int argc, char **argv)
objdir = curdir;
}
else {
- (void) snprintf(mdpath, MAXPATHLEN, "%s%s", pathp, curdir);
+ snprintf(mdpath, MAXPATHLEN, "%s%s", pathp, curdir);
if (!(objdir = chdir_verify_path(mdpath, obpath)))
objdir = curdir;
}
@@ -701,7 +702,7 @@ main(int argc, char **argv)
Suff_Init();
DEFAULT = NULL;
- (void)time(&now);
+ time(&now);
/*
* Set up the .TARGETS variable to contain the list of targets to be
@@ -747,8 +748,8 @@ main(int argc, char **argv)
if (!noBuiltins) {
LstNode ln;
- sysMkPath = Lst_Init (FALSE);
- Dir_Expand (_PATH_DEFSYSMK, sysIncPath, sysMkPath);
+ sysMkPath = Lst_Init(FALSE);
+ Dir_Expand(_PATH_DEFSYSMK, sysIncPath, sysMkPath);
if (Lst_IsEmpty(sysMkPath))
Fatal("make: no system rules (%s).", _PATH_DEFSYSMK);
ln = Lst_Find(sysMkPath, (void *)NULL, ReadMakefile);
@@ -764,9 +765,9 @@ main(int argc, char **argv)
Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
} else if (!ReadMakefile("BSDmakefile", NULL))
if (!ReadMakefile("makefile", NULL))
- (void)ReadMakefile("Makefile", NULL);
+ ReadMakefile("Makefile", NULL);
- (void)ReadMakefile(".depend", NULL);
+ ReadMakefile(".depend", NULL);
/* Install all the flags into the MAKE envariable. */
if (((p = Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1)) != NULL) && *p)
@@ -802,7 +803,7 @@ main(int argc, char **argv)
*cp = savec;
path = cp + 1;
} while (savec == ':');
- (void)free(vpath);
+ free(vpath);
}
/*
@@ -825,7 +826,7 @@ main(int argc, char **argv)
if (expandVars) {
p1 = emalloc(strlen((char *)Lst_Datum(ln)) + 1 + 3);
/* This sprintf is safe, because of the malloc above */
- (void)sprintf(p1, "${%s}", (char *)Lst_Datum(ln));
+ sprintf(p1, "${%s}", (char *)Lst_Datum(ln));
value = Var_Subst(NULL, p1, VAR_GLOBAL, FALSE);
} else {
value = Var_Value((char *)Lst_Datum(ln),
@@ -889,9 +890,9 @@ main(int argc, char **argv)
Dir_End();
if (queryFlag && outOfDate)
- return(1);
+ return (1);
else
- return(0);
+ return (0);
}
/*-
@@ -923,7 +924,7 @@ ReadMakefile(void *p, void *q __unused)
/* if we've chdir'd, rebuild the path name */
if (curdir != objdir && *fname != '/') {
- (void)snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname);
+ snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname);
/*
* XXX The realpath stuff breaks relative includes
* XXX in some cases. The problem likely is in
@@ -969,7 +970,7 @@ ReadMakefile(void *p, void *q __unused)
if (!name)
name = Dir_FindFile(fname, sysIncPath);
if (!name || !(stream = fopen(name, "r")))
- return(FALSE);
+ return (FALSE);
MAKEFILE = fname = name;
/*
* set the MAKEFILE variable desired by System V fans -- the
@@ -980,9 +981,9 @@ found:
if (setMAKEFILE)
Var_Set("MAKEFILE", MAKEFILE, VAR_GLOBAL);
Parse_File(fname, stream);
- (void)fclose(stream);
+ fclose(stream);
}
- return(TRUE);
+ return (TRUE);
}
/*-
@@ -1038,17 +1039,17 @@ Cmd_Exec(char *cmd, char **error)
/*
* Close input side of pipe
*/
- (void) close(fds[0]);
+ close(fds[0]);
/*
* Duplicate the output stream to the shell's output, then
* shut the extra thing down. Note we don't fetch the error
* stream...why not? Why?
*/
- (void) dup2(fds[1], 1);
- (void) close(fds[1]);
+ dup2(fds[1], 1);
+ close(fds[1]);
- (void) execv(shellPath, args);
+ execv(shellPath, args);
_exit(1);
/*NOTREACHED*/
@@ -1060,34 +1061,34 @@ Cmd_Exec(char *cmd, char **error)
/*
* No need for the writing half
*/
- (void) close(fds[1]);
+ close(fds[1]);
- buf = Buf_Init (MAKE_BSIZE);
+ buf = Buf_Init(MAKE_BSIZE);
do {
char result[BUFSIZ];
cc = read(fds[0], result, sizeof(result));
if (cc > 0)
- Buf_AddBytes(buf, cc, (Byte *) result);
+ Buf_AddBytes(buf, cc, (Byte *)result);
}
while (cc > 0 || (cc == -1 && errno == EINTR));
/*
* Close the input side of the pipe.
*/
- (void) close(fds[0]);
+ close(fds[0]);
/*
* Wait for the process to exit.
*/
- while(((pid = wait(&status)) != cpid) && (pid >= 0))
+ while (((pid = wait(&status)) != cpid) && (pid >= 0))
continue;
if (cc == -1)
*error = "Error reading shell's output for \"%s\"";
- res = (char *)Buf_GetAll (buf, &cc);
- Buf_Destroy (buf, FALSE);
+ res = (char *)Buf_GetAll(buf, &cc);
+ Buf_Destroy(buf, FALSE);
if (status)
*error = "\"%s\" returned non-zero status";
@@ -1113,11 +1114,11 @@ Cmd_Exec(char *cmd, char **error)
}
break;
}
- return res;
+ return (res);
bad:
res = emalloc(1);
*res = '\0';
- return res;
+ return (res);
}
/*
@@ -1127,7 +1128,7 @@ bad:
static void
usage(void)
{
- (void)fprintf(stderr, "%s\n%s\n%s\n",
+ fprintf(stderr, "%s\n%s\n%s\n",
"usage: make [-BPSXeiknqrstv] [-C directory] [-D variable] [-d flags]",
" [-E variable] [-f makefile] [-I directory] [-j max_jobs]",
" [-m directory] [-V variable] [variable=value] [target ...]");
OpenPOWER on IntegriCloud