diff options
-rw-r--r-- | usr.bin/make/compat.c | 29 | ||||
-rw-r--r-- | usr.bin/make/job.c | 23 | ||||
-rw-r--r-- | usr.bin/make/parse.c | 40 | ||||
-rw-r--r-- | usr.bin/make/suff.c | 6 |
4 files changed, 46 insertions, 52 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index a139c3cc437..d01d7ce2e6f 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat.c,v 1.24 2000/04/17 23:54:47 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.25 2000/06/10 01:26:36 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: compat.c,v 1.24 2000/04/17 23:54:47 espie Exp $"; +static char rcsid[] = "$OpenBSD: compat.c,v 1.25 2000/06/10 01:26:36 espie Exp $"; #endif #endif /* not lint */ @@ -122,7 +122,7 @@ CompatInterrupt (signo) if (signo == SIGINT) { gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); if (gn != NULL) { - Lst_ForEach(gn->commands, CompatRunCommand, gn); + Lst_Find(gn->commands, CompatRunCommand, gn); } } @@ -191,7 +191,7 @@ shellneed (av) * error, the node's made field is set to ERROR and creation stops. * * Results: - * 0 if the command succeeded, 1 if an error occurred. + * 1 if the command succeeded, 0 if an error occurred. * * Side Effects: * The node's 'made' field may be set to ERROR. @@ -245,7 +245,7 @@ CompatRunCommand (cmdp, gnp) if (*cmdStart == '\0') { free(cmdStart); Error("%s expands to empty string", cmd); - return(0); + return 1; } else { cmd = cmdStart; } @@ -253,10 +253,10 @@ CompatRunCommand (cmdp, gnp) if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { Lst_AtEnd(ENDNode->commands, cmdStart); - return(0); + return 1; } else if (strcmp(cmdStart, "...") == 0) { gn->type |= OP_SAVE_CMDS; - return(0); + return 1; } while ((*cmd == '@') || (*cmd == '-')) { @@ -293,9 +293,8 @@ CompatRunCommand (cmdp, gnp) * If we're not supposed to execute any commands, this is as far as * we go... */ - if (noExecute) { - return (0); - } + if (noExecute) + return 1; if (*cp != '\0') { /* @@ -321,7 +320,7 @@ CompatRunCommand (cmdp, gnp) case -1: /* handled internally */ free(bp); free(av); - return 0; + return 1; case 1: shargv[1] = (errCheck ? "-ec" : "-c"); shargv[2] = cmd; @@ -416,7 +415,7 @@ CompatRunCommand (cmdp, gnp) } } - return (status); + return !status; } /*- @@ -522,7 +521,7 @@ CompatMake (gnp, pgnp) */ if (!touchFlag) { curTarg = gn; - Lst_ForEach(gn->commands, CompatRunCommand, gn); + Lst_Find(gn->commands, CompatRunCommand, gn); curTarg = NULL; } else { Job_Touch (gn, gn->type & OP_SILENT); @@ -697,7 +696,7 @@ Compat_Run(targs) if (!queryFlag) { gn = Targ_FindNode(".BEGIN", TARG_NOCREATE); if (gn != NULL) { - Lst_ForEach(gn->commands, CompatRunCommand, gn); + Lst_Find(gn->commands, CompatRunCommand, gn); if (gn->made == ERROR) { printf("\n\nStop.\n"); exit(1); @@ -731,6 +730,6 @@ Compat_Run(targs) * If the user has defined a .END target, run its commands. */ if (errors == 0) { - Lst_ForEach(ENDNode->commands, CompatRunCommand, gn); + Lst_Find(ENDNode->commands, CompatRunCommand, gn); } } diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 68dd6df5bed..9a75dda2acd 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.25 2000/03/26 16:21:32 espie Exp $ */ +/* $OpenBSD: job.c,v 1.26 2000/06/10 01:26:36 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: job.c,v 1.25 2000/03/26 16:21:32 espie Exp $"; +static char rcsid[] = "$OpenBSD: job.c,v 1.26 2000/06/10 01:26:36 espie Exp $"; #endif #endif /* not lint */ @@ -500,7 +500,7 @@ JobCmpRmtID(job, rmtID) * This function is called from JobStart via Lst_ForEach. * * Results: - * Always 0, unless the command was "..." + * Always 1, unless the command was "..." * * Side Effects: * If the command begins with a '-' and the shell has no error control, @@ -537,9 +537,9 @@ JobPrintCommand(cmdp, jobp) if ((job->flags & JOB_IGNDOTS) == 0) { job->tailCmds = Lst_Succ(Lst_Member(job->node->commands, cmd)); - return 1; + return 0; } - return 0; + return 1; } #define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \ @@ -654,7 +654,7 @@ JobPrintCommand(cmdp, jobp) if (shutUp) { DBPRINTF("%s\n", commandShell->echoOn); } - return 0; + return 1; } /*- @@ -1763,9 +1763,7 @@ JobStart(gn, flags, previous) } else { LstNode ln = Lst_Next(gn->commands); - if ((ln == NULL) || - JobPrintCommand(Lst_Datum(ln), job)) - { + if ((ln == NULL) || !JobPrintCommand(Lst_Datum(ln), job)) { noExec = TRUE; Lst_Close(gn->commands); } @@ -1789,7 +1787,7 @@ JobStart(gn, flags, previous) * We can do all the commands at once. hooray for sanity */ numCommands = 0; - Lst_ForEach(gn->commands, JobPrintCommand, job); + Lst_Find(gn->commands, JobPrintCommand, job); /* * If we didn't print out any commands to the shell script, @@ -1814,9 +1812,8 @@ JobStart(gn, flags, previous) * not -- just let the user know they're bad and keep going. It * doesn't do any harm in this case and may do some good. */ - if (cmdsOK) { - Lst_ForEach(gn->commands, JobPrintCommand, job); - } + if (cmdsOK) + Lst_Find(gn->commands, JobPrintCommand, job); /* * Don't execute the shell, thank you. */ diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 8045284d392..a70335207e4 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.39 2000/04/17 23:54:47 espie Exp $ */ +/* $OpenBSD: parse.c,v 1.40 2000/06/10 01:26:37 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: parse.c,v 1.39 2000/04/17 23:54:47 espie Exp $"; +static char rcsid[] = "$OpenBSD: parse.c,v 1.40 2000/06/10 01:26:37 espie Exp $"; #endif #endif /* not lint */ @@ -457,7 +457,7 @@ ParseLinkSrc (pgnp, cgnp) * operators are incompatible, a major error is taken. * * Results: - * Always 0 + * 0 if a problem, 1 if ok. * * Side Effects: * The type field of the node is altered to reflect any new bits in @@ -478,10 +478,9 @@ ParseDoOp (gnp, opp) * the operator actually has some dependency information in it, complain. */ if (((op & OP_OPMASK) != (gn->type & OP_OPMASK)) && - !OP_NOP(gn->type) && !OP_NOP(op)) - { - Parse_Error (PARSE_FATAL, "Inconsistent operator for %s", gn->name); - return (1); + !OP_NOP(gn->type) && !OP_NOP(op)) { + Parse_Error(PARSE_FATAL, "Inconsistent operator for %s", gn->name); + return 0; } if ((op == OP_DOUBLEDEP) && ((gn->type & OP_OPMASK) == OP_DOUBLEDEP)) { @@ -523,7 +522,7 @@ ParseDoOp (gnp, opp) */ gn->type |= op; - return (0); + return 1; } /*- @@ -534,8 +533,8 @@ ParseDoOp (gnp, opp) * .WAIT directive. * * Results: - * Returns 1 if the two targets need to be ordered, 0 otherwise. - * If it returns 1, the search can stop + * Returns 0 if the two targets need to be ordered, 1 otherwise. + * If it returns 0, the search can stop * * Side Effects: * A dependency can be added between the two nodes. @@ -558,10 +557,10 @@ ParseAddDep(pp, sp) */ Lst_AtEnd(p->successors, s); Lst_AtEnd(s->preds, p); - return 0; + return 1; } else - return 1; + return 0; } @@ -596,7 +595,7 @@ ParseDoSrc (tOp, src, allsrc) if (keywd != -1) { int op = parseKeywords[keywd].op; if (op != 0) { - Lst_ForEach (targets, ParseDoOp, &op); + Lst_Find(targets, ParseDoOp, &op); return; } if (parseKeywords[keywd].spec == Wait) { @@ -676,9 +675,8 @@ ParseDoSrc (tOp, src, allsrc) gn->order = waiting; Lst_AtEnd(allsrc, gn); - if (waiting) { - Lst_ForEach(allsrc, ParseAddDep, gn); - } + if (waiting) + Lst_Find(allsrc, ParseAddDep, gn); } /*- @@ -689,7 +687,7 @@ ParseDoSrc (tOp, src, allsrc) * yet. * * Results: - * 0 if main not found yet, 1 if it is. + * 1 if main not found yet, 0 if it is. * * Side Effects: * mainNode is changed and Targ_SetMain is called. @@ -705,9 +703,9 @@ ParseFindMain(gnp, dummy) if ((gn->type & OP_NOTARGET) == 0) { mainNode = gn; Targ_SetMain(gn); - return (dummy ? 1 : 1); - } else { return (dummy ? 0 : 0); + } else { + return (dummy ? 1 : 1); } } @@ -1120,7 +1118,7 @@ ParseDoDependency (line) cp++; /* Advance beyond operator */ - Lst_ForEach (targets, ParseDoOp, &op); + Lst_Find(targets, ParseDoOp, &op); /* * Get to the first source @@ -1303,7 +1301,7 @@ ParseDoDependency (line) * the first dependency line that is actually a real target * (i.e. isn't a .USE or .EXEC rule) to be made. */ - Lst_ForEach(targets, ParseFindMain, NULL); + Lst_Find(targets, ParseFindMain, NULL); } /* diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 95a8d7d799d..53b85cb3fba 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.25 2000/03/26 16:21:33 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.26 2000/06/10 01:26:37 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else -static char rcsid[] = "$OpenBSD: suff.c,v 1.25 2000/03/26 16:21:33 espie Exp $"; +static char rcsid[] = "$OpenBSD: suff.c,v 1.26 2000/06/10 01:26:37 espie Exp $"; #endif #endif /* not lint */ @@ -1064,7 +1064,7 @@ SuffAddLevel (l, targ) * Free all src structures in list that don't have a reference count * * Results: - * Ture if an src was removed + * True if an src was removed * * Side Effects: * The memory is free'd. |