diff options
| author | christos <christos@NetBSD.org> | 2005-02-16 15:11:52 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2005-02-16 15:11:52 +0000 |
| commit | 63fca1366091cde6fda073e3035fdec3873df243 (patch) | |
| tree | cc821e5d3f62046819e5c7eda1d86d105b220cf5 /usr.bin/make | |
| parent | da725d663a4307983bcdd44787459e29854695fc (diff) | |
PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes]
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/arch.c | 66 | ||||
| -rw-r--r-- | usr.bin/make/buf.c | 10 | ||||
| -rw-r--r-- | usr.bin/make/compat.c | 46 | ||||
| -rw-r--r-- | usr.bin/make/cond.c | 34 | ||||
| -rw-r--r-- | usr.bin/make/dir.c | 150 | ||||
| -rw-r--r-- | usr.bin/make/for.c | 8 | ||||
| -rw-r--r-- | usr.bin/make/hash.c | 8 | ||||
| -rw-r--r-- | usr.bin/make/job.c | 16 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstAtEnd.c | 10 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstAtFront.c | 10 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstDeQueue.c | 10 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstDupl.c | 12 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstEnQueue.c | 8 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstFind.c | 8 | ||||
| -rw-r--r-- | usr.bin/make/lst.lib/lstInt.h | 4 | ||||
| -rw-r--r-- | usr.bin/make/main.c | 12 | ||||
| -rw-r--r-- | usr.bin/make/make.c | 114 | ||||
| -rw-r--r-- | usr.bin/make/parse.c | 168 | ||||
| -rw-r--r-- | usr.bin/make/str.c | 8 | ||||
| -rw-r--r-- | usr.bin/make/suff.c | 178 | ||||
| -rw-r--r-- | usr.bin/make/targ.c | 74 | ||||
| -rw-r--r-- | usr.bin/make/util.c | 8 | ||||
| -rw-r--r-- | usr.bin/make/var.c | 124 |
23 files changed, 543 insertions, 543 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 34ae9750a31..c13a86db0e3 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.43 2004/10/30 20:49:05 dsl Exp $ */ +/* $NetBSD: arch.c,v 1.44 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.43 2004/10/30 20:49:05 dsl Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.44 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.43 2004/10/30 20:49:05 dsl Exp $"); +__RCSID("$NetBSD: arch.c,v 1.44 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -411,7 +411,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) snprintf(nameBuf, sz, "%s(%s)", libName, member); free(member); - gn = Targ_FindNode (nameBuf, TARG_CREATE); + gn = Targ_FindNode(nameBuf, TARG_CREATE); if (gn == NILGNODE) { free(nameBuf); return (FAILURE); @@ -424,7 +424,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) * end of the provided list. */ gn->type |= OP_ARCHV; - (void) Lst_AtEnd (nodeLst, (ClientData)gn); + (void) Lst_AtEnd(nodeLst, (ClientData)gn); } } Lst_Destroy(members, NOFREE); @@ -433,7 +433,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) size_t sz = strlen(libName) + strlen(memName) + 3; nameBuf = emalloc(sz); snprintf(nameBuf, sz, "%s(%s)", libName, memName); - gn = Targ_FindNode (nameBuf, TARG_CREATE); + gn = Targ_FindNode(nameBuf, TARG_CREATE); free(nameBuf); if (gn == NILGNODE) { return (FAILURE); @@ -446,7 +446,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) * provided list. */ gn->type |= OP_ARCHV; - (void) Lst_AtEnd (nodeLst, (ClientData)gn); + (void) Lst_AtEnd(nodeLst, (ClientData)gn); } } if (doSubst) { @@ -549,11 +549,11 @@ ArchStatMember(char *archive, char *member, Boolean hash) member = cp + 1; } - ln = Lst_Find (archives, (ClientData) archive, ArchFindArchive); + ln = Lst_Find(archives, (ClientData) archive, ArchFindArchive); if (ln != NILLNODE) { - ar = (Arch *) Lst_Datum (ln); + ar = (Arch *) Lst_Datum(ln); - he = Hash_FindEntry (&ar->members, member); + he = Hash_FindEntry(&ar->members, member); if (he != (Hash_Entry *) NULL) { return ((struct ar_hdr *) Hash_GetValue (he)); @@ -567,7 +567,7 @@ ArchStatMember(char *archive, char *member, Boolean hash) strncpy(copy, member, AR_MAX_NAME_LEN); copy[AR_MAX_NAME_LEN] = '\0'; } - if ((he = Hash_FindEntry (&ar->members, copy)) != NULL) + if ((he = Hash_FindEntry(&ar->members, copy)) != NULL) return ((struct ar_hdr *) Hash_GetValue (he)); return ((struct ar_hdr *) NULL); } @@ -612,11 +612,11 @@ ArchStatMember(char *archive, char *member, Boolean hash) return ((struct ar_hdr *) NULL); } - ar = (Arch *)emalloc (sizeof (Arch)); - ar->name = estrdup (archive); + ar = emalloc(sizeof(Arch)); + ar->name = estrdup(archive); ar->fnametab = NULL; ar->fnamesize = 0; - Hash_InitTable (&ar->members, -1); + Hash_InitTable(&ar->members, -1); memName[AR_MAX_NAME_LEN] = '\0'; while (fread ((char *)&arh, sizeof (struct ar_hdr), 1, arch) == 1) { @@ -687,7 +687,7 @@ ArchStatMember(char *archive, char *member, Boolean hash) } #endif - he = Hash_CreateEntry (&ar->members, memName, (Boolean *)NULL); + he = Hash_CreateEntry(&ar->members, memName, (Boolean *)NULL); Hash_SetValue (he, (ClientData)emalloc (sizeof (struct ar_hdr))); memcpy ((Address)Hash_GetValue (he), (Address)&arh, sizeof (struct ar_hdr)); @@ -697,13 +697,13 @@ ArchStatMember(char *archive, char *member, Boolean hash) fclose (arch); - (void) Lst_AtEnd (archives, (ClientData) ar); + (void) Lst_AtEnd(archives, (ClientData) ar); /* * Now that the archive has been read and cached, we can look into * the hash table to find the desired member's header. */ - he = Hash_FindEntry (&ar->members, member); + he = Hash_FindEntry(&ar->members, member); if (he != (Hash_Entry *) NULL) { return ((struct ar_hdr *) Hash_GetValue (he)); @@ -713,7 +713,7 @@ ArchStatMember(char *archive, char *member, Boolean hash) badarch: fclose (arch); - Hash_DeleteTable (&ar->members); + Hash_DeleteTable(&ar->members); if (ar->fnametab) free(ar->fnametab); free ((Address)ar); @@ -997,8 +997,8 @@ Arch_Touch(GNode *gn) struct ar_hdr arh; /* Current header describing member */ char *p1, *p2; - arch = ArchFindMember(Var_Value (ARCHIVE, gn, &p1), - Var_Value (MEMBER, gn, &p2), + arch = ArchFindMember(Var_Value(ARCHIVE, gn, &p1), + Var_Value(MEMBER, gn, &p2), &arh, "r+"); if (p1) free(p1); @@ -1042,7 +1042,7 @@ Arch_TouchLib(GNode *gn) struct ar_hdr arh; /* Header describing table of contents */ struct utimbuf times; /* Times for utime() call */ - arch = ArchFindMember (gn->path, UNCONST(RANLIBMAG), &arh, "r+"); + arch = ArchFindMember(gn->path, UNCONST(RANLIBMAG), &arh, "r+"); snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now); if (arch != (FILE *) NULL) { @@ -1079,8 +1079,8 @@ Arch_MTime(GNode *gn) time_t modTime; /* Modification time as an integer */ char *p1, *p2; - arhPtr = ArchStatMember (Var_Value (ARCHIVE, gn, &p1), - Var_Value (MEMBER, gn, &p2), + arhPtr = ArchStatMember(Var_Value(ARCHIVE, gn, &p1), + Var_Value(MEMBER, gn, &p2), TRUE); if (p1) free(p1); @@ -1119,12 +1119,12 @@ Arch_MemMTime(GNode *gn) char *nameStart, *nameEnd; - if (Lst_Open (gn->parents) != SUCCESS) { + if (Lst_Open(gn->parents) != SUCCESS) { gn->mtime = 0; return (0); } - while ((ln = Lst_Next (gn->parents)) != NILLNODE) { - pgn = (GNode *) Lst_Datum (ln); + while ((ln = Lst_Next(gn->parents)) != NILLNODE) { + pgn = (GNode *) Lst_Datum(ln); if (pgn->type & OP_ARCHV) { /* @@ -1151,7 +1151,7 @@ Arch_MemMTime(GNode *gn) } } - Lst_Close (gn->parents); + Lst_Close(gn->parents); return (gn->mtime); } @@ -1186,17 +1186,17 @@ Arch_FindLib(GNode *gn, Lst path) char *libName; /* file name for archive */ size_t sz = strlen(gn->name) + 6 - 2; - libName = (char *)emalloc(sz); + libName = emalloc(sz); snprintf(libName, sz, "lib%s.a", &gn->name[2]); - gn->path = Dir_FindFile (libName, path); + gn->path = Dir_FindFile(libName, path); free (libName); #ifdef LIBRARIES - Var_Set (TARGET, gn->name, gn, 0); + Var_Set(TARGET, gn->name, gn, 0); #else - Var_Set (TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn, 0); + Var_Set(TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn, 0); #endif /* LIBRARIES */ } @@ -1256,7 +1256,7 @@ Arch_LibOODate(GNode *gn) struct ar_hdr *arhPtr; /* Header for __.SYMDEF */ int modTimeTOC; /* The table-of-contents's mod time */ - arhPtr = ArchStatMember (gn->path, UNCONST(RANLIBMAG), FALSE); + arhPtr = ArchStatMember(gn->path, UNCONST(RANLIBMAG), FALSE); if (arhPtr != (struct ar_hdr *)NULL) { modTimeTOC = (int) strtol(arhPtr->ar_date, NULL, 10); @@ -1297,7 +1297,7 @@ Arch_LibOODate(GNode *gn) void Arch_Init(void) { - archives = Lst_Init (FALSE); + archives = Lst_Init(FALSE); } diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index d51d6922efd..63ab48a505c 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.15 2004/05/07 00:04:38 ross Exp $ */ +/* $NetBSD: buf.c,v 1.16 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.15 2004/05/07 00:04:38 ross Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.16 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.15 2004/05/07 00:04:38 ross Exp $"); +__RCSID("$NetBSD: buf.c,v 1.16 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -267,13 +267,13 @@ Buf_Init(int size) { Buffer bp; /* New Buffer */ - bp = (Buffer)emalloc(sizeof(*bp)); + bp = emalloc(sizeof(*bp)); if (size <= 0) { size = BUF_DEF_SIZE; } bp->left = bp->size = size; - bp->buffer = (Byte *)emalloc(size); + bp->buffer = emalloc(size); bp->inPtr = bp->outPtr = bp->buffer; *bp->inPtr = 0; diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index 11d399653cf..38f3f4a3939 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.55 2004/07/01 04:39:30 jmc Exp $ */ +/* $NetBSD: compat.c,v 1.56 2005/02/16 15:11:52 christos 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.55 2004/07/01 04:39:30 jmc Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.56 2005/02/16 15:11:52 christos 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.55 2004/07/01 04:39:30 jmc Exp $"); +__RCSID("$NetBSD: compat.c,v 1.56 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -162,7 +162,7 @@ CompatInterrupt(int signo) if ((curTarg != NILGNODE) && !Targ_Precious (curTarg)) { char *p1; - char *file = Var_Value (TARGET, curTarg, &p1); + char *file = Var_Value(TARGET, curTarg, &p1); if (!noExecute && eunlink(file) != -1) { Error("*** %s removed", file); @@ -236,8 +236,8 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) errCheck = !(gn->type & OP_IGNORE); doIt = FALSE; - cmdNode = Lst_Member (gn->commands, (ClientData)cmd); - cmdStart = Var_Subst (NULL, cmd, gn, FALSE); + cmdNode = Lst_Member(gn->commands, (ClientData)cmd); + cmdStart = Var_Subst(NULL, cmd, gn, FALSE); /* * brk_string will return an argv with a NULL in av[0], thus causing @@ -253,7 +253,7 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) } else { cmd = cmdStart; } - Lst_Replace (cmdNode, (ClientData)cmdStart); + Lst_Replace(cmdNode, (ClientData)cmdStart); if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { (void)Lst_AtEnd(ENDNode->commands, (ClientData)cmdStart); @@ -359,7 +359,7 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) free(av); free(bp); } - Lst_Replace (cmdNode, (ClientData) NULL); + Lst_Replace(cmdNode, (ClientData) NULL); /* * The child is off and running. Now all we can do is wait... @@ -422,7 +422,7 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) } break; } else { - Fatal ("error in wait: %d: %s", retstat, strerror(errno)); + Fatal("error in wait: %d: %s", retstat, strerror(errno)); /*NOTREACHED*/ } } @@ -466,17 +466,17 @@ CompatMake(ClientData gnp, ClientData pgnp) gn->flags |= REMAKE; gn->made = BEINGMADE; if ((gn->type & OP_MADE) == 0) - Suff_FindDeps (gn); - Lst_ForEach (gn->children, CompatMake, (ClientData)gn); + Suff_FindDeps(gn); + Lst_ForEach(gn->children, CompatMake, (ClientData)gn); if ((gn->flags & REMAKE) == 0) { gn->made = ABORTED; pgn->flags &= ~REMAKE; goto cohorts; } - if (Lst_Member (gn->iParents, pgn) != NILLNODE) { + if (Lst_Member(gn->iParents, pgn) != NILLNODE) { char *p1; - Var_Set (IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); + Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); if (p1) free(p1); } @@ -519,24 +519,24 @@ CompatMake(ClientData gnp, ClientData pgnp) * Alter our type to tell if errors should be ignored or things * should not be printed so CompatRunCommand knows what to do. */ - if (Targ_Ignore (gn)) { + if (Targ_Ignore(gn)) { gn->type |= OP_IGNORE; } - if (Targ_Silent (gn)) { + if (Targ_Silent(gn)) { gn->type |= OP_SILENT; } - if (Job_CheckCommands (gn, Fatal)) { + if (Job_CheckCommands(gn, Fatal)) { /* * Our commands are ok, but we still have to worry about the -t * flag... */ if (!touchFlag || (gn->type & OP_MAKE)) { curTarg = gn; - Lst_ForEach (gn->commands, CompatRunCommand, (ClientData)gn); + Lst_ForEach(gn->commands, CompatRunCommand, (ClientData)gn); curTarg = NILGNODE; } else { - Job_Touch (gn, gn->type & OP_SILENT); + Job_Touch(gn, gn->type & OP_SILENT); } } else { gn->made = ERROR; @@ -568,9 +568,9 @@ CompatMake(ClientData gnp, ClientData pgnp) */ pgn->flags &= ~REMAKE; } else { - if (Lst_Member (gn->iParents, pgn) != NILLNODE) { + if (Lst_Member(gn->iParents, pgn) != NILLNODE) { char *p1; - Var_Set (IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); + Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); if (p1) free(p1); } @@ -597,7 +597,7 @@ CompatMake(ClientData gnp, ClientData pgnp) } cohorts: - Lst_ForEach (gn->cohorts, CompatMake, pgnp); + Lst_ForEach(gn->cohorts, CompatMake, pgnp); return (0); } @@ -672,8 +672,8 @@ Compat_Run(Lst targs) */ errors = 0; while (!Lst_IsEmpty (targs)) { - gn = (GNode *) Lst_DeQueue (targs); - CompatMake (gn, gn); + gn = (GNode *) Lst_DeQueue(targs); + CompatMake(gn, gn); if (gn->made == UPTODATE) { printf ("`%s' is up to date.\n", gn->name); diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index ac29e8000b4..1639039ab97 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.24 2004/05/07 00:04:38 ross Exp $ */ +/* $NetBSD: cond.c,v 1.25 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: cond.c,v 1.24 2004/05/07 00:04:38 ross Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.25 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.24 2004/05/07 00:04:38 ross Exp $"); +__RCSID("$NetBSD: cond.c,v 1.25 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -292,7 +292,7 @@ CondGetArg(char **linePtr, char **argPtr, const char *func, Boolean parens) cp++; } if (parens && *cp != ')') { - Parse_Error (PARSE_WARNING, "Missing closing parenthesis for %s()", + Parse_Error(PARSE_WARNING, "Missing closing parenthesis for %s()", func); return (0); } else if (parens) { @@ -327,7 +327,7 @@ CondDoDefined(int argLen, char *arg) Boolean result; arg[argLen] = '\0'; - if (Var_Value (arg, VAR_CMD, &p1) != (char *)NULL) { + if (Var_Value(arg, VAR_CMD, &p1) != (char *)NULL) { result = TRUE; } else { result = FALSE; @@ -378,7 +378,7 @@ CondDoMake(int argLen, char *arg) Boolean result; arg[argLen] = '\0'; - if (Lst_Find (create, (ClientData)arg, CondStrMatch) == NILLNODE) { + if (Lst_Find(create, (ClientData)arg, CondStrMatch) == NILLNODE) { result = FALSE; } else { result = TRUE; @@ -849,7 +849,7 @@ error: */ evalProc = CondDoDefined; condExpr += 7; - arglen = CondGetArg (&condExpr, &arg, "defined", TRUE); + arglen = CondGetArg(&condExpr, &arg, "defined", TRUE); if (arglen == 0) { condExpr -= 7; goto use_default; @@ -862,7 +862,7 @@ error: */ evalProc = CondDoMake; condExpr += 4; - arglen = CondGetArg (&condExpr, &arg, "make", TRUE); + arglen = CondGetArg(&condExpr, &arg, "make", TRUE); if (arglen == 0) { condExpr -= 4; goto use_default; @@ -1074,7 +1074,7 @@ CondF(Boolean doEval) /* * F -> T */ - CondPushBack (o); + CondPushBack(o); } } return (l); @@ -1121,7 +1121,7 @@ CondE(Boolean doEval) /* * E -> F */ - CondPushBack (o); + CondPushBack(o); } } return (l); @@ -1176,7 +1176,7 @@ Cond_EvalExpression(int dosetup, char *line, Boolean *value, int eprint) case Err: err: if (eprint) - Parse_Error (PARSE_FATAL, "Malformed conditional (%s)", + Parse_Error(PARSE_FATAL, "Malformed conditional (%s)", line); return (COND_INVALID); default: @@ -1247,7 +1247,7 @@ Cond_Eval(char *line) return (COND_SKIP); } else { if (condTop == MAXIF) { - Parse_Error (level, "if-less endif"); + Parse_Error(level, "if-less endif"); return (COND_INVALID); } else { skipLine = FALSE; @@ -1277,12 +1277,12 @@ Cond_Eval(char *line) */ if (isElse && (line[0] == 's') && (line[1] == 'e')) { if (finalElse[condTop][skipIfLevel]) { - Parse_Error (PARSE_WARNING, "extra else"); + Parse_Error(PARSE_WARNING, "extra else"); } else { finalElse[condTop][skipIfLevel] = TRUE; } if (condTop == MAXIF) { - Parse_Error (level, "if-less else"); + Parse_Error(level, "if-less else"); return (COND_INVALID); } else if (skipIfLevel == 0) { value = !condStack[condTop]; @@ -1298,7 +1298,7 @@ Cond_Eval(char *line) } else { if (isElse) { if (condTop == MAXIF) { - Parse_Error (level, "if-less elif"); + Parse_Error(level, "if-less elif"); return (COND_INVALID); } else if (skipIfLevel != 0) { /* @@ -1316,7 +1316,7 @@ Cond_Eval(char *line) */ skipIfLevel += 1; if (skipIfLevel >= MAXIF) { - Parse_Error (PARSE_FATAL, "Too many nested if's. %d max.", MAXIF); + Parse_Error(PARSE_FATAL, "Too many nested if's. %d max.", MAXIF); return (COND_INVALID); } finalElse[condTop][skipIfLevel] = FALSE; @@ -1353,7 +1353,7 @@ Cond_Eval(char *line) * This is the one case where we can definitely proclaim a fatal * error. If we don't, we're hosed. */ - Parse_Error (PARSE_FATAL, "Too many nested if's. %d max.", MAXIF); + Parse_Error(PARSE_FATAL, "Too many nested if's. %d max.", MAXIF); return (COND_INVALID); } else { condStack[condTop] = value; diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 3bb581e2701..b77bd80d7a0 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.44 2004/12/29 00:43:02 christos Exp $ */ +/* $NetBSD: dir.c,v 1.45 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.44 2004/12/29 00:43:02 christos Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.45 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.44 2004/12/29 00:43:02 christos Exp $"); +__RCSID("$NetBSD: dir.c,v 1.45 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -268,26 +268,26 @@ static char *DirLookupAbs(Path *, const char *, const char *); *----------------------------------------------------------------------- */ void -Dir_Init (const char *cdname) +Dir_Init(const char *cdname) { - dirSearchPath = Lst_Init (FALSE); - openDirectories = Lst_Init (FALSE); + dirSearchPath = Lst_Init(FALSE); + openDirectories = Lst_Init(FALSE); Hash_InitTable(&mtimes, 0); Dir_InitCur(cdname); - dotLast = (Path *) emalloc (sizeof (Path)); + dotLast = emalloc(sizeof(Path)); dotLast->refCount = 1; dotLast->hits = 0; dotLast->name = estrdup(".DOTLAST"); - Hash_InitTable (&dotLast->files, -1); + Hash_InitTable(&dotLast->files, -1); } /* * Called by Dir_Init() and whenever .CURDIR is assigned to. */ void -Dir_InitCur (const char *cdname) +Dir_InitCur(const char *cdname) { Path *p; @@ -329,11 +329,11 @@ Dir_InitDot(void) LstNode ln; /* Remove old entry from openDirectories, but do not destroy. */ - ln = Lst_Member (openDirectories, (ClientData)dot); - (void) Lst_Remove (openDirectories, ln); + ln = Lst_Member(openDirectories, (ClientData)dot); + (void) Lst_Remove(openDirectories, ln); } - dot = Dir_AddDir (NULL, "."); + dot = Dir_AddDir(NULL, "."); if (dot == NULL) { Error("Cannot open `.' (%s)", strerror(errno)); @@ -386,7 +386,7 @@ Dir_End(void) * This is the simplest way to deal with the effect of .DOTLAST. */ void -Dir_SetPATH (void) +Dir_SetPATH(void) { LstNode ln; /* a list element */ Path *p; @@ -394,9 +394,9 @@ Dir_SetPATH (void) Var_Delete(".PATH", VAR_GLOBAL); - if (Lst_Open (dirSearchPath) == SUCCESS) { - if ((ln = Lst_First (dirSearchPath)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + if (Lst_Open(dirSearchPath) == SUCCESS) { + if ((ln = Lst_First(dirSearchPath)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); if (p == dotLast) { hasLastDot = TRUE; Var_Append(".PATH", dotLast->name, VAR_GLOBAL); @@ -410,8 +410,8 @@ Dir_SetPATH (void) Var_Append(".PATH", cur->name, VAR_GLOBAL); } - while ((ln = Lst_Next (dirSearchPath)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + while ((ln = Lst_Next(dirSearchPath)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); if (p == dotLast) continue; if (p == dot && hasLastDot) @@ -869,10 +869,10 @@ DirLookup(Path *p, const char *name __unused, const char *cp, printf(" %s ...\n", p->name); } - if (Hash_FindEntry (&p->files, cp) == (Hash_Entry *)NULL) + if (Hash_FindEntry(&p->files, cp) == (Hash_Entry *)NULL) return NULL; - file = str_concat (p->name, cp, STR_ADDSLASH); + file = str_concat(p->name, cp, STR_ADDSLASH); if (DEBUG(DIR)) { printf(" returning %s\n", file); } @@ -904,7 +904,7 @@ DirLookupSubdir(Path *p, const char *name) char *file; /* the current filename to check */ if (p != dot) { - file = str_concat (p->name, name, STR_ADDSLASH); + file = str_concat(p->name, name, STR_ADDSLASH); } else { /* * Checking in dot -- DON'T put a leading ./ on the thing. @@ -973,7 +973,7 @@ DirLookupAbs(Path *p, const char *name, const char *cp) return NULL; } - if (Hash_FindEntry (&p->files, cp) == (Hash_Entry *)NULL) { + if (Hash_FindEntry(&p->files, cp) == (Hash_Entry *)NULL) { if (DEBUG(DIR)) { printf(" must be here but isn't -- returning\n"); } @@ -986,7 +986,7 @@ DirLookupAbs(Path *p, const char *name, const char *cp) if (DEBUG(DIR)) { printf(" returning %s\n", name); } - return (estrdup (name)); + return (estrdup(name)); } /*- @@ -1006,22 +1006,22 @@ static char * DirFindDot(Boolean hasSlash __unused, const char *name, const char *cp) { - if (Hash_FindEntry (&dot->files, cp) != (Hash_Entry *)NULL) { + if (Hash_FindEntry(&dot->files, cp) != (Hash_Entry *)NULL) { if (DEBUG(DIR)) { printf(" in '.'\n"); } hits += 1; dot->hits += 1; - return (estrdup (name)); + return (estrdup(name)); } if (cur && - Hash_FindEntry (&cur->files, cp) != (Hash_Entry *)NULL) { + Hash_FindEntry(&cur->files, cp) != (Hash_Entry *)NULL) { if (DEBUG(DIR)) { printf(" in ${.CURDIR} = %s\n", cur->name); } hits += 1; cur->hits += 1; - return str_concat (cur->name, cp, STR_ADDSLASH); + return str_concat(cur->name, cp, STR_ADDSLASH); } return NULL; @@ -1078,7 +1078,7 @@ Dir_FindFile(const char *name, Lst path) printf("Searching for %s ...", name); } - if (Lst_Open (path) == FAILURE) { + if (Lst_Open(path) == FAILURE) { if (DEBUG(DIR)) { printf("couldn't open path, file not found\n"); } @@ -1086,8 +1086,8 @@ Dir_FindFile(const char *name, Lst path) return ((char *) NULL); } - if ((ln = Lst_First (path)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + if ((ln = Lst_First(path)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); if (p == dotLast) { hasLastDot = TRUE; if (DEBUG(DIR)) @@ -1120,27 +1120,27 @@ Dir_FindFile(const char *name, Lst path) */ if (!hasLastDot && (file = DirFindDot(hasSlash, name, cp)) != NULL) { - Lst_Close (path); + Lst_Close(path); return file; } - while ((ln = Lst_Next (path)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + while ((ln = Lst_Next(path)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); if (p == dotLast) continue; if ((file = DirLookup(p, name, cp, hasSlash)) != NULL) { - Lst_Close (path); + Lst_Close(path); return file; } } if (hasLastDot && (file = DirFindDot(hasSlash, name, cp)) != NULL) { - Lst_Close (path); + Lst_Close(path); return file; } } - Lst_Close (path); + Lst_Close(path); /* * We didn't find the file on any directory in the search path. @@ -1181,9 +1181,9 @@ Dir_FindFile(const char *name, Lst path) return file; } - (void) Lst_Open (path); - while ((ln = Lst_Next (path)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + (void) Lst_Open(path); + while ((ln = Lst_Next(path)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); if (p == dotLast) continue; if (p == dot) { @@ -1192,11 +1192,11 @@ Dir_FindFile(const char *name, Lst path) checkedDot = TRUE; } if ((file = DirLookupSubdir(p, name)) != NULL) { - Lst_Close (path); + Lst_Close(path); return file; } } - Lst_Close (path); + Lst_Close(path); if (hasLastDot) { if (dot && !checkedDot) { @@ -1237,17 +1237,17 @@ Dir_FindFile(const char *name, Lst path) if (!hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL) return *file?file:NULL; - (void) Lst_Open (path); - while ((ln = Lst_Next (path)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + (void) Lst_Open(path); + while ((ln = Lst_Next(path)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); if (p == dotLast) continue; if ((file = DirLookupAbs(p, name, cp)) != NULL) { - Lst_Close (path); + Lst_Close(path); return *file?file:NULL; } } - Lst_Close (path); + Lst_Close(path); if (hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL) return *file?file:NULL; @@ -1272,19 +1272,19 @@ Dir_FindFile(const char *name, Lst path) */ #ifdef notdef cp[-1] = '\0'; - (void) Dir_AddDir (path, name); + (void) Dir_AddDir(path, name); cp[-1] = '/'; bigmisses += 1; - ln = Lst_Last (path); + ln = Lst_Last(path); if (ln == NILLNODE) { return ((char *) NULL); } else { - p = (Path *) Lst_Datum (ln); + p = (Path *) Lst_Datum(ln); } - if (Hash_FindEntry (&p->files, cp) != (Hash_Entry *)NULL) { - return (estrdup (name)); + if (Hash_FindEntry(&p->files, cp) != (Hash_Entry *)NULL) { + return (estrdup(name)); } else { return ((char *) NULL); } @@ -1307,7 +1307,7 @@ Dir_FindFile(const char *name, Lst path) name); } Hash_SetValue(entry, (long)stb.st_mtime); - return (estrdup (name)); + return (estrdup(name)); } else { if (DEBUG(DIR)) { printf(" failed. Returning NULL\n"); @@ -1422,7 +1422,7 @@ Dir_MTime(GNode *gn) Hash_Entry *entry; if (gn->type & OP_ARCHV) { - return Arch_MTime (gn); + return Arch_MTime(gn); } else if (gn->type & OP_PHONY) { gn->mtime = 0; return 0; @@ -1430,7 +1430,7 @@ Dir_MTime(GNode *gn) if (gn->type & OP_NOPATH) fullName = NULL; else - fullName = Dir_FindFile (gn->name, Suff_FindPath(gn)); + fullName = Dir_FindFile(gn->name, Suff_FindPath(gn)); } else { fullName = gn->path; } @@ -1456,7 +1456,7 @@ Dir_MTime(GNode *gn) if (gn->type & OP_MEMBER) { if (fullName != gn->path) free(fullName); - return Arch_MemMTime (gn); + return Arch_MemMTime(gn); } else { stb.st_mtime = 0; } @@ -1498,7 +1498,7 @@ Dir_AddDir(Lst path, const char *name) struct dirent *dp; /* entry in directory */ if (strcmp(name, ".DOTLAST") == 0) { - ln = Lst_Find (path, (ClientData)UNCONST(name), DirFindName); + ln = Lst_Find(path, (ClientData)UNCONST(name), DirFindName); if (ln != NILLNODE) return (Path *) Lst_Datum(ln); else { @@ -1508,7 +1508,7 @@ Dir_AddDir(Lst path, const char *name) } if (path) - ln = Lst_Find (openDirectories, (ClientData)UNCONST(name), DirFindName); + ln = Lst_Find(openDirectories, (ClientData)UNCONST(name), DirFindName); if (ln != NILLNODE) { p = (Path *)Lst_Datum (ln); if (Lst_Member(path, (ClientData)p) == NILLNODE) { @@ -1522,11 +1522,11 @@ Dir_AddDir(Lst path, const char *name) } if ((d = opendir (name)) != (DIR *) NULL) { - p = (Path *) emalloc (sizeof (Path)); - p->name = estrdup (name); + p = emalloc(sizeof(Path)); + p->name = estrdup(name); p->hits = 0; p->refCount = 1; - Hash_InitTable (&p->files, -1); + Hash_InitTable(&p->files, -1); while ((dp = readdir (d)) != (struct dirent *) NULL) { #if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */ @@ -1604,17 +1604,17 @@ Dir_MakeFlags(const char *flag, Lst path) LstNode ln; /* the node of the current directory */ Path *p; /* the structure describing the current directory */ - str = estrdup (""); + str = estrdup(""); - if (Lst_Open (path) == SUCCESS) { - while ((ln = Lst_Next (path)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); - s2 = str_concat (flag, p->name, 0); - str = str_concat (s1 = str, s2, STR_ADDSPACE); + if (Lst_Open(path) == SUCCESS) { + while ((ln = Lst_Next(path)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); + s2 = str_concat(flag, p->name, 0); + str = str_concat(s1 = str, s2, STR_ADDSPACE); free(s1); free(s2); } - Lst_Close (path); + Lst_Close(path); } return (str); @@ -1647,10 +1647,10 @@ Dir_Destroy(ClientData pp) if (p->refCount == 0) { LstNode ln; - ln = Lst_Member (openDirectories, (ClientData)p); - (void) Lst_Remove (openDirectories, ln); + ln = Lst_Member(openDirectories, (ClientData)p); + (void) Lst_Remove(openDirectories, ln); - Hash_DeleteTable (&p->files); + Hash_DeleteTable(&p->files); free((Address)p->name); free((Address)p); } @@ -1730,12 +1730,12 @@ Dir_PrintDirectories(void) (hits+bigmisses+nearmisses ? hits * 100 / (hits + bigmisses + nearmisses) : 0)); printf ("# %-20s referenced\thits\n", "directory"); - if (Lst_Open (openDirectories) == SUCCESS) { - while ((ln = Lst_Next (openDirectories)) != NILLNODE) { - p = (Path *) Lst_Datum (ln); + if (Lst_Open(openDirectories) == SUCCESS) { + while ((ln = Lst_Next(openDirectories)) != NILLNODE) { + p = (Path *) Lst_Datum(ln); printf ("# %-20s %10d\t%4d\n", p->name, p->refCount, p->hits); } - Lst_Close (openDirectories); + Lst_Close(openDirectories); } } @@ -1749,5 +1749,5 @@ DirPrintDir(ClientData p, ClientData dummy) void Dir_PrintPath(Lst path) { - Lst_ForEach (path, DirPrintDir, (ClientData)0); + Lst_ForEach(path, DirPrintDir, (ClientData)0); } diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index c76a9dd3ecb..5a471ad8e08 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.17 2004/05/07 00:04:38 ross Exp $ */ +/* $NetBSD: for.c,v 1.18 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -30,14 +30,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: for.c,v 1.17 2004/05/07 00:04:38 ross Exp $"; +static char rcsid[] = "$NetBSD: for.c,v 1.18 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: for.c,v 1.17 2004/05/07 00:04:38 ross Exp $"); +__RCSID("$NetBSD: for.c,v 1.18 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -269,7 +269,7 @@ For_Eval(char *line) if (DEBUG(FOR)) (void) fprintf(stderr, "For: end for %d\n", forLevel); if (--forLevel < 0) { - Parse_Error (level, "for-less endfor"); + Parse_Error(level, "for-less endfor"); return 0; } } diff --git a/usr.bin/make/hash.c b/usr.bin/make/hash.c index 2cc3f893759..309142dcd8d 100644 --- a/usr.bin/make/hash.c +++ b/usr.bin/make/hash.c @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.13 2004/05/07 00:04:38 ross Exp $ */ +/* $NetBSD: hash.c,v 1.14 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: hash.c,v 1.13 2004/05/07 00:04:38 ross Exp $"; +static char rcsid[] = "$NetBSD: hash.c,v 1.14 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: hash.c,v 1.13 2004/05/07 00:04:38 ross Exp $"); +__RCSID("$NetBSD: hash.c,v 1.14 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -287,7 +287,7 @@ Hash_CreateEntry(Hash_Table *t, const char *key, Boolean *newPtr) */ if (t->numEntries >= rebuildLimit * t->size) RebuildTable(t); - e = (Hash_Entry *) emalloc(sizeof(*e) + keylen); + e = emalloc(sizeof(*e) + keylen); hp = &t->bucketPtr[h & t->mask]; e->next = *hp; *hp = e; diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index d7083e6f3e9..346e400e69b 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.88 2005/01/31 22:41:43 christos Exp $ */ +/* $NetBSD: job.c,v 1.89 2005/02/16 15:11:52 christos 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.88 2005/01/31 22:41:43 christos Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.89 2005/02/16 15:11:52 christos 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.88 2005/01/31 22:41:43 christos Exp $"); +__RCSID("$NetBSD: job.c,v 1.89 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -737,7 +737,7 @@ JobPrintCommand(ClientData cmdp, ClientData jobp) if (!commandShell->hasErrCtl) { /* Worst that could happen is every char needs escaping. */ - escCmd = (char *) emalloc((strlen(cmd) * 2) + 1); + escCmd = emalloc((strlen(cmd) * 2) + 1); for (i = 0, j= 0; cmd[i] != '\0'; i++, j++) { if (cmd[i] == '$' || cmd[i] == '`' || cmd[i] == '\\' || cmd[i] == '"') @@ -1924,7 +1924,7 @@ JobStart(GNode *gn, int flags, Job *previous) previous->flags &= ~(JOB_FIRST|JOB_IGNERR|JOB_SILENT|JOB_REMOTE); job = previous; } else { - job = (Job *) emalloc(sizeof(Job)); + job = emalloc(sizeof(Job)); if (job == NULL) { Punt("JobStart out of memory"); } @@ -2580,7 +2580,7 @@ Job_CatchOutput(void) * NOTE: IT IS THE RESPONSIBILITY OF Rmt_Wait TO CALL Job_CatchChildren * IN A TIMELY FASHION TO CATCH ANY LOCALLY RUNNING JOBS THAT EXIT. * It may use the variable nLocal to determine if it needs to call - * Job_CatchChildren (if nLocal is 0, there's nothing for which to + * Job_CatchChildren(if nLocal is 0, there's nothing for which to * wait...) */ while (nJobs != 0 && pnJobs == nJobs) { @@ -3013,7 +3013,7 @@ Job_ParseShell(char *line) } commandShell = sh; } else { - commandShell = (Shell *) emalloc(sizeof(Shell)); + commandShell = emalloc(sizeof(Shell)); *commandShell = newShell; } } @@ -3528,7 +3528,7 @@ Job_ServerStart(int maxproc) char jobarg[64]; if (pipe(job_pipe) < 0) - Fatal ("error in pipe: %s", strerror(errno)); + Fatal("error in pipe: %s", strerror(errno)); /* * We mark the input side of the pipe non-blocking; we poll(2) the diff --git a/usr.bin/make/lst.lib/lstAtEnd.c b/usr.bin/make/lst.lib/lstAtEnd.c index e2871a9359f..e98bbb9d53d 100644 --- a/usr.bin/make/lst.lib/lstAtEnd.c +++ b/usr.bin/make/lst.lib/lstAtEnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: lstAtEnd.c,v 1.10 2004/05/07 00:04:41 ross Exp $ */ +/* $NetBSD: lstAtEnd.c,v 1.11 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -33,14 +33,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lstAtEnd.c,v 1.10 2004/05/07 00:04:41 ross Exp $"; +static char rcsid[] = "$NetBSD: lstAtEnd.c,v 1.11 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lstAtEnd.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: lstAtEnd.c,v 1.10 2004/05/07 00:04:41 ross Exp $"); +__RCSID("$NetBSD: lstAtEnd.c,v 1.11 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -74,6 +74,6 @@ Lst_AtEnd(Lst l, ClientData d) { LstNode end; - end = Lst_Last (l); - return (Lst_Append (l, end, d)); + end = Lst_Last(l); + return (Lst_Append(l, end, d)); } diff --git a/usr.bin/make/lst.lib/lstAtFront.c b/usr.bin/make/lst.lib/lstAtFront.c index 014c79fc86d..0f0fae287e8 100644 --- a/usr.bin/make/lst.lib/lstAtFront.c +++ b/usr.bin/make/lst.lib/lstAtFront.c @@ -1,4 +1,4 @@ -/* $NetBSD: lstAtFront.c,v 1.10 2004/05/07 00:04:41 ross Exp $ */ +/* $NetBSD: lstAtFront.c,v 1.11 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -33,14 +33,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lstAtFront.c,v 1.10 2004/05/07 00:04:41 ross Exp $"; +static char rcsid[] = "$NetBSD: lstAtFront.c,v 1.11 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lstAtFront.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: lstAtFront.c,v 1.10 2004/05/07 00:04:41 ross Exp $"); +__RCSID("$NetBSD: lstAtFront.c,v 1.11 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -71,6 +71,6 @@ Lst_AtFront(Lst l, ClientData d) { LstNode front; - front = Lst_First (l); - return (Lst_Insert (l, front, d)); + front = Lst_First(l); + return (Lst_Insert(l, front, d)); } diff --git a/usr.bin/make/lst.lib/lstDeQueue.c b/usr.bin/make/lst.lib/lstDeQueue.c index d4aa893bccd..ed1c57d4bec 100644 --- a/usr.bin/make/lst.lib/lstDeQueue.c +++ b/usr.bin/make/lst.lib/lstDeQueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: lstDeQueue.c,v 1.10 2004/05/07 00:04:41 ross Exp $ */ +/* $NetBSD: lstDeQueue.c,v 1.11 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -33,14 +33,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lstDeQueue.c,v 1.10 2004/05/07 00:04:41 ross Exp $"; +static char rcsid[] = "$NetBSD: lstDeQueue.c,v 1.11 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lstDeQueue.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: lstDeQueue.c,v 1.10 2004/05/07 00:04:41 ross Exp $"); +__RCSID("$NetBSD: lstDeQueue.c,v 1.11 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -72,13 +72,13 @@ Lst_DeQueue(Lst l) ClientData rd; ListNode tln; - tln = (ListNode) Lst_First (l); + tln = (ListNode) Lst_First(l); if (tln == NilListNode) { return ((ClientData) NIL); } rd = tln->datum; - if (Lst_Remove (l, (LstNode)tln) == FAILURE) { + if (Lst_Remove(l, (LstNode)tln) == FAILURE) { return ((ClientData) NIL); } else { return (rd); diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c index 82b7a93f168..82f08a15899 100644 --- a/usr.bin/make/lst.lib/lstDupl.c +++ b/usr.bin/make/lst.lib/lstDupl.c @@ -1,4 +1,4 @@ -/* $NetBSD: lstDupl.c,v 1.11 2004/05/07 00:04:41 ross Exp $ */ +/* $NetBSD: lstDupl.c,v 1.12 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -33,14 +33,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lstDupl.c,v 1.11 2004/05/07 00:04:41 ross Exp $"; +static char rcsid[] = "$NetBSD: lstDupl.c,v 1.12 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lstDupl.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: lstDupl.c,v 1.11 2004/05/07 00:04:41 ross Exp $"); +__RCSID("$NetBSD: lstDupl.c,v 1.12 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -81,7 +81,7 @@ Lst_Duplicate(Lst l, ClientData (*copyProc)(ClientData)) return (NILLST); } - nl = Lst_Init (list->isCirc); + nl = Lst_Init(list->isCirc); if (nl == NILLST) { return (NILLST); } @@ -89,10 +89,10 @@ Lst_Duplicate(Lst l, ClientData (*copyProc)(ClientData)) ln = list->firstPtr; while (ln != NilListNode) { if (copyProc != NOCOPY) { - if (Lst_AtEnd (nl, (*copyProc) (ln->datum)) == FAILURE) { + if (Lst_AtEnd(nl, (*copyProc) (ln->datum)) == FAILURE) { return (NILLST); } - } else if (Lst_AtEnd (nl, ln->datum) == FAILURE) { + } else if (Lst_AtEnd(nl, ln->datum) == FAILURE) { return (NILLST); } diff --git a/usr.bin/make/lst.lib/lstEnQueue.c b/usr.bin/make/lst.lib/lstEnQueue.c index 077132621a7..d6f9519ddc5 100644 --- a/usr.bin/make/lst.lib/lstEnQueue.c +++ b/usr.bin/make/lst.lib/lstEnQueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: lstEnQueue.c,v 1.10 2004/05/07 00:04:41 ross Exp $ */ +/* $NetBSD: lstEnQueue.c,v 1.11 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -33,14 +33,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lstEnQueue.c,v 1.10 2004/05/07 00:04:41 ross Exp $"; +static char rcsid[] = "$NetBSD: lstEnQueue.c,v 1.11 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lstEnQueue.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: lstEnQueue.c,v 1.10 2004/05/07 00:04:41 ross Exp $"); +__RCSID("$NetBSD: lstEnQueue.c,v 1.11 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -73,6 +73,6 @@ Lst_EnQueue(Lst l, ClientData d) return (FAILURE); } - return (Lst_Append (l, Lst_Last(l), d)); + return (Lst_Append(l, Lst_Last(l), d)); } diff --git a/usr.bin/make/lst.lib/lstFind.c b/usr.bin/make/lst.lib/lstFind.c index 52a0d5eba34..95a94691ec4 100644 --- a/usr.bin/make/lst.lib/lstFind.c +++ b/usr.bin/make/lst.lib/lstFind.c @@ -1,4 +1,4 @@ -/* $NetBSD: lstFind.c,v 1.11 2004/05/07 00:04:41 ross Exp $ */ +/* $NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -33,14 +33,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lstFind.c,v 1.11 2004/05/07 00:04:41 ross Exp $"; +static char rcsid[] = "$NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lstFind.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: lstFind.c,v 1.11 2004/05/07 00:04:41 ross Exp $"); +__RCSID("$NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -69,6 +69,6 @@ __RCSID("$NetBSD: lstFind.c,v 1.11 2004/05/07 00:04:41 ross Exp $"); LstNode Lst_Find(Lst l, ClientData d, int (*cProc)(ClientData, ClientData)) { - return (Lst_FindFrom (l, Lst_First(l), d, cProc)); + return (Lst_FindFrom(l, Lst_First(l), d, cProc)); } diff --git a/usr.bin/make/lst.lib/lstInt.h b/usr.bin/make/lst.lib/lstInt.h index 512f0276d23..840807ffad1 100644 --- a/usr.bin/make/lst.lib/lstInt.h +++ b/usr.bin/make/lst.lib/lstInt.h @@ -1,4 +1,4 @@ -/* $NetBSD: lstInt.h,v 1.10 2004/05/06 23:15:46 ross Exp $ */ +/* $NetBSD: lstInt.h,v 1.11 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -86,7 +86,7 @@ typedef struct { * PAlloc (var, ptype) -- * Allocate a pointer-typedef structure 'ptype' into the variable 'var' */ -#define PAlloc(var,ptype) var = (ptype) emalloc (sizeof (*var)) +#define PAlloc(var,ptype) var = (ptype) emalloc(sizeof (*var)) /* * LstValid (l) -- diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 5bceac79b0a..762765b1e24 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.105 2004/07/13 11:59:12 wiz Exp $ */ +/* $NetBSD: main.c,v 1.106 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.105 2004/07/13 11:59:12 wiz Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.106 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.105 2004/07/13 11:59:12 wiz Exp $"); +__RCSID("$NetBSD: main.c,v 1.106 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -895,7 +895,7 @@ main(int argc, char **argv) if (!noBuiltins) { LstNode ln; - sysMkPath = Lst_Init (FALSE); + sysMkPath = Lst_Init(FALSE); Dir_Expand(_PATH_DEFSYSMK, Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath, sysMkPath); @@ -1395,7 +1395,7 @@ Cmd_Exec(const char *cmd, const char **err) */ (void) close(fds[1]); - buf = Buf_Init (MAKE_BSIZE); + buf = Buf_Init(MAKE_BSIZE); do { char result[BUFSIZ]; @@ -1417,7 +1417,7 @@ Cmd_Exec(const char *cmd, const char **err) continue; res = (char *)Buf_GetAll (buf, &cc); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); if (cc == 0) *err = "Couldn't read shell's output for \"%s\""; diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 5d07cff76b1..b056553376e 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.55 2004/07/01 20:38:09 jmc Exp $ */ +/* $NetBSD: make.c,v 1.56 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: make.c,v 1.55 2004/07/01 20:38:09 jmc Exp $"; +static char rcsid[] = "$NetBSD: make.c,v 1.56 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: make.c,v 1.55 2004/07/01 20:38:09 jmc Exp $"); +__RCSID("$NetBSD: make.c,v 1.56 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -208,7 +208,7 @@ Make_OODate(GNode *gn) * doesn't depend on their modification time... */ if ((gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC)) == 0) { - (void) Dir_MTime (gn); + (void) Dir_MTime(gn); if (DEBUG(MAKE)) { if (gn->mtime != 0) { printf ("modified %s...", Targ_FmtTime(gn->mtime)); @@ -251,7 +251,7 @@ Make_OODate(GNode *gn) * always out of date if no children and :: target * or non-existent. */ - oodate = (gn->mtime == 0 || Arch_LibOODate (gn) || + oodate = (gn->mtime == 0 || Arch_LibOODate(gn) || (gn->cmtime == 0 && (gn->type & OP_DOUBLEDEP))); } else if (gn->type & OP_JOIN) { /* @@ -325,7 +325,7 @@ Make_OODate(GNode *gn) * thinking they're out-of-date. */ if (!oodate) { - Lst_ForEach (gn->parents, MakeTimeStamp, (ClientData)gn); + Lst_ForEach(gn->parents, MakeTimeStamp, (ClientData)gn); } return (oodate); @@ -434,20 +434,20 @@ Make_HandleUse(GNode *cgn, GNode *pgn) * prepend the child's commands to the parent. */ Lst cmds = pgn->commands; - pgn->commands = Lst_Duplicate (cgn->commands, NOCOPY); - (void) Lst_Concat (pgn->commands, cmds, LST_CONCNEW); - Lst_Destroy (cmds, NOFREE); + pgn->commands = Lst_Duplicate(cgn->commands, NOCOPY); + (void) Lst_Concat(pgn->commands, cmds, LST_CONCNEW); + Lst_Destroy(cmds, NOFREE); } else { /* * .USE or target has no commands -- * append the child's commands to the parent. */ - (void) Lst_Concat (pgn->commands, cgn->commands, LST_CONCNEW); + (void) Lst_Concat(pgn->commands, cgn->commands, LST_CONCNEW); } } - if (Lst_Open (cgn->children) == SUCCESS) { - while ((ln = Lst_Next (cgn->children)) != NILLNODE) { + if (Lst_Open(cgn->children) == SUCCESS) { + while ((ln = Lst_Next(cgn->children)) != NILLNODE) { GNode *tgn, *gn = (GNode *)Lst_Datum (ln); /* @@ -470,11 +470,11 @@ Make_HandleUse(GNode *cgn, GNode *pgn) gn = tgn; } - (void) Lst_AtEnd (pgn->children, gn); - (void) Lst_AtEnd (gn->parents, pgn); + (void) Lst_AtEnd(pgn->children, gn); + (void) Lst_AtEnd(gn->parents, pgn); pgn->unmade += 1; } - Lst_Close (cgn->children); + Lst_Close(cgn->children); } pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_USEBEFORE|OP_TRANSFORM); @@ -525,7 +525,7 @@ MakeHandleUse(ClientData cgnp, ClientData pgnp) * children the parent has. This is used by Make_Run to decide * whether to queue the parent or examine its children... */ - if ((ln = Lst_Member (pgn->children, (ClientData) cgn)) != NILLNODE) { + if ((ln = Lst_Member(pgn->children, (ClientData) cgn)) != NILLNODE) { Lst_Remove(pgn->children, ln); pgn->unmade--; } @@ -665,7 +665,7 @@ Make_Update(GNode *cgn) Lst parents; GNode *centurion; - cname = Var_Value (TARGET, cgn, &p1); + cname = Var_Value(TARGET, cgn, &p1); if (p1) free(p1); @@ -687,14 +687,14 @@ Make_Update(GNode *cgn) Punt("%s: cohort has parents", cgn->name); centurion->unmade_cohorts -= 1; if (centurion->unmade_cohorts < 0) - Error ("Graph cycles through centurion %s", centurion->name); + Error("Graph cycles through centurion %s", centurion->name); parents = centurion->parents; } else { centurion = cgn; parents = cgn->parents; } - if (Lst_Open (parents) == SUCCESS) { - while ((ln = Lst_Next (parents)) != NILLNODE) { + if (Lst_Open(parents) == SUCCESS) { + while ((ln = Lst_Next(parents)) != NILLNODE) { pgn = (GNode *)Lst_Datum (ln); if (mtime == 0) pgn->flags |= FORCE; @@ -728,10 +728,10 @@ Make_Update(GNode *cgn) */ (void)Lst_EnQueue (toBeMade, (ClientData)pgn); } else if (pgn->unmade < 0) { - Error ("Graph cycles through %s", pgn->name); + Error("Graph cycles through %s", pgn->name); } } - Lst_Close (parents); + Lst_Close(parents); } /* * Deal with successor nodes. If any is marked for making and has an unmade @@ -755,20 +755,20 @@ Make_Update(GNode *cgn) * Set the .PREFIX and .IMPSRC variables for all the implied parents * of this node. */ - if (Lst_Open (cgn->iParents) == SUCCESS) { + if (Lst_Open(cgn->iParents) == SUCCESS) { char *cpref = Var_Value(PREFIX, cgn, &p1); - while ((ln = Lst_Next (cgn->iParents)) != NILLNODE) { + while ((ln = Lst_Next(cgn->iParents)) != NILLNODE) { pgn = (GNode *)Lst_Datum (ln); if (pgn->flags & REMAKE) { - Var_Set (IMPSRC, cname, pgn, 0); + Var_Set(IMPSRC, cname, pgn, 0); if (cpref != NULL) - Var_Set (PREFIX, cpref, pgn, 0); + Var_Set(PREFIX, cpref, pgn, 0); } } if (p1) free(p1); - Lst_Close (cgn->iParents); + Lst_Close(cgn->iParents); } } @@ -825,16 +825,16 @@ MakeAddAllSrc(ClientData cgnp, ClientData pgnp) char *p1 = NULL, *p2 = NULL; if (cgn->type & OP_ARCHV) - child = Var_Value (MEMBER, cgn, &p1); + child = Var_Value(MEMBER, cgn, &p1); else child = cgn->path ? cgn->path : cgn->name; if (cgn->type & OP_JOIN) { - allsrc = Var_Value (ALLSRC, cgn, &p2); + allsrc = Var_Value(ALLSRC, cgn, &p2); } else { allsrc = child; } if (allsrc != NULL) - Var_Append (ALLSRC, allsrc, pgn); + Var_Append(ALLSRC, allsrc, pgn); if (p2) free(p2); if (pgn->type & OP_JOIN) { @@ -893,19 +893,19 @@ MakeAddAllSrc(ClientData cgnp, ClientData pgnp) void Make_DoAllVar(GNode *gn) { - Lst_ForEach (gn->children, MakeUnmark, (ClientData) gn); - Lst_ForEach (gn->children, MakeAddAllSrc, (ClientData) gn); + Lst_ForEach(gn->children, MakeUnmark, (ClientData) gn); + Lst_ForEach(gn->children, MakeAddAllSrc, (ClientData) gn); if (!Var_Exists (OODATE, gn)) { - Var_Set (OODATE, "", gn, 0); + Var_Set(OODATE, "", gn, 0); } if (!Var_Exists (ALLSRC, gn)) { - Var_Set (ALLSRC, "", gn, 0); + Var_Set(ALLSRC, "", gn, 0); } if (gn->type & OP_JOIN) { char *p1; - Var_Set (TARGET, Var_Value (ALLSRC, gn, &p1), gn, 0); + Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn, 0); if (p1) free(p1); } @@ -933,7 +933,7 @@ MakeStartJobs(void) GNode *gn; while (!Lst_IsEmpty (toBeMade)) { - gn = (GNode *) Lst_DeQueue (toBeMade); + gn = (GNode *) Lst_DeQueue(toBeMade); if (DEBUG(MAKE)) { printf ("Examining %s...", gn->name); } @@ -972,15 +972,15 @@ MakeStartJobs(void) } numNodes--; - if (Make_OODate (gn)) { + if (Make_OODate(gn)) { if (DEBUG(MAKE)) { printf ("out-of-date\n"); } if (queryFlag) { return (TRUE); } - Make_DoAllVar (gn); - Job_Make (gn); + Make_DoAllVar(gn); + Job_Make(gn); } else { if (DEBUG(MAKE)) { printf ("up-to-date\n"); @@ -993,10 +993,10 @@ MakeStartJobs(void) * value for .TARGET when building up the context variables * of its parent(s)... */ - Make_DoAllVar (gn); + Make_DoAllVar(gn); } Job_TokenReturn(); - Make_Update (gn); + Make_Update(gn); } } return (FALSE); @@ -1082,7 +1082,7 @@ Make_ExpandUse(Lst targs) Lst examine; /* List of targets to examine */ Lst ntargs; /* List of new targets to be made */ - ntargs = Lst_Init (FALSE); + ntargs = Lst_Init(FALSE); examine = Lst_Duplicate(targs, NOCOPY); numNodes = 0; @@ -1096,12 +1096,12 @@ Make_ExpandUse(Lst targs) * and go on about our business. */ while (!Lst_IsEmpty (examine)) { - gn = (GNode *) Lst_DeQueue (examine); + gn = (GNode *) Lst_DeQueue(examine); if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) { Lst new; - new = Lst_Duplicate (gn->cohorts, NOCOPY); - Lst_Concat (new, examine, LST_CONCLINK); + new = Lst_Duplicate(gn->cohorts, NOCOPY); + Lst_Concat(new, examine, LST_CONCLINK); examine = new; } @@ -1123,36 +1123,36 @@ Make_ExpandUse(Lst targs) continue; *eoa = '\0'; *eon = '\0'; - Var_Set (MEMBER, eoa + 1, gn, 0); - Var_Set (ARCHIVE, gn->name, gn, 0); + Var_Set(MEMBER, eoa + 1, gn, 0); + Var_Set(ARCHIVE, gn->name, gn, 0); *eoa = '('; *eon = ')'; } (void)Dir_MTime(gn); - Var_Set (TARGET, gn->path ? gn->path : gn->name, gn, 0); - Lst_ForEach (gn->children, MakeUnmark, (ClientData)gn); - Lst_ForEach (gn->children, MakeHandleUse, (ClientData)gn); + Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0); + Lst_ForEach(gn->children, MakeUnmark, (ClientData)gn); + Lst_ForEach(gn->children, MakeHandleUse, (ClientData)gn); if ((gn->type & OP_MADE) == 0) - Suff_FindDeps (gn); + Suff_FindDeps(gn); else { /* Pretend we made all this node's children */ - Lst_ForEach (gn->children, MakeFindChild, (ClientData)gn); + Lst_ForEach(gn->children, MakeFindChild, (ClientData)gn); if (gn->unmade != 0) printf("Warning: %s still has %d unmade children\n", gn->name, gn->unmade); } if (gn->unmade != 0) { - Lst_ForEach (gn->children, MakeAddChild, (ClientData)examine); + Lst_ForEach(gn->children, MakeAddChild, (ClientData)examine); } else { (void)Lst_EnQueue (ntargs, (ClientData)gn); } } } - Lst_Destroy (examine, NOFREE); + Lst_Destroy(examine, NOFREE); return ntargs; } @@ -1185,7 +1185,7 @@ Make_Run(Lst targs) { int errors; /* Number of errors the Job module reports */ - toBeMade = Make_ExpandUse (targs); + toBeMade = Make_ExpandUse(targs); if (queryFlag) { /* @@ -1216,8 +1216,8 @@ Make_Run(Lst targs) * keepgoing flag was given. */ while (!Lst_IsEmpty(toBeMade) || !Job_Empty ()) { - Job_CatchOutput (); - Job_CatchChildren (!usePipes); + Job_CatchOutput(); + Job_CatchChildren(!usePipes); (void)MakeStartJobs(); } diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index d499420dd22..dc91b3b6ce7 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.96 2004/05/07 00:04:40 ross Exp $ */ +/* $NetBSD: parse.c,v 1.97 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.96 2004/05/07 00:04:40 ross Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.97 2005/02/16 15:11:52 christos 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.96 2004/05/07 00:04:40 ross Exp $"); +__RCSID("$NetBSD: parse.c,v 1.97 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -510,7 +510,7 @@ ParseLinkSrc(ClientData pgnp, ClientData cgnp) GNode *cgn = (GNode *) cgnp; if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (pgn->cohorts)) - pgn = (GNode *) Lst_Datum (Lst_Last (pgn->cohorts)); + pgn = (GNode *) Lst_Datum(Lst_Last(pgn->cohorts)); (void)Lst_AtEnd (pgn->children, (ClientData)cgn); if (specType == Not) (void)Lst_AtEnd (cgn->parents, (ClientData)pgn); @@ -551,7 +551,7 @@ ParseDoOp(ClientData gnp, ClientData opp) 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); + Parse_Error(PARSE_FATAL, "Inconsistent operator for %s", gn->name); return (1); } @@ -691,7 +691,7 @@ ParseDoSpecialSrc(ClientData tp, ClientData sp) * other targets. This is the bit of ParseDoSrc which is relevant. * The main difference is we don't link the resolved src to all targets. */ - gn = Targ_FindNode (cp, TARG_CREATE); + gn = Targ_FindNode(cp, TARG_CREATE); if (ss->op) { gn->type |= ss->op; } else { @@ -739,7 +739,7 @@ ParseDoSrc(int tOp, char *src, Lst allsrc, Boolean resolve) if (keywd != -1) { int op = parseKeywords[keywd].op; if (op != 0) { - Lst_ForEach (targets, ParseDoOp, (ClientData)&op); + Lst_ForEach(targets, ParseDoOp, (ClientData)&op); return; } if (parseKeywords[keywd].spec == Wait) { @@ -759,7 +759,7 @@ ParseDoSrc(int tOp, char *src, Lst allsrc, Boolean resolve) * invoked if the user didn't specify a target on the command * line. This is to allow #ifmake's to succeed, or something... */ - (void) Lst_AtEnd (create, (ClientData)estrdup(src)); + (void) Lst_AtEnd(create, (ClientData)estrdup(src)); /* * Add the name to the .TARGETS variable as well, so the user cna * employ that, if desired. @@ -809,11 +809,11 @@ ParseDoSrc(int tOp, char *src, Lst allsrc, Boolean resolve) Lst_ForEach(targets, ParseDoSpecialSrc, (ClientData)&ss); return; } - gn = Targ_FindNode (src, TARG_CREATE); + gn = Targ_FindNode(src, TARG_CREATE); if (tOp) { gn->type |= tOp; } else { - Lst_ForEach (targets, ParseLinkSrc, (ClientData)gn); + Lst_ForEach(targets, ParseLinkSrc, (ClientData)gn); } break; } @@ -999,8 +999,8 @@ ParseDoDependency(char *line) * went well and FAILURE if there was an error in the * specification. On error, line should remain untouched. */ - if (Arch_ParseArchive (&line, targets, VAR_CMD) != SUCCESS) { - Parse_Error (PARSE_FATAL, + if (Arch_ParseArchive(&line, targets, VAR_CMD) != SUCCESS) { + Parse_Error(PARSE_FATAL, "Error in archive specification: \"%s\"", line); return; } else { @@ -1018,10 +1018,10 @@ ParseDoDependency(char *line) if ((strncmp(line, "<<<<<<", 6) == 0) || (strncmp(line, "======", 6) == 0) || (strncmp(line, ">>>>>>", 6) == 0)) - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Makefile appears to contain unresolved cvs/rcs/??? merge conflicts"); else - Parse_Error (PARSE_FATAL, "Need an operator"); + Parse_Error(PARSE_FATAL, "Need an operator"); return; } *cp = '\0'; @@ -1121,9 +1121,9 @@ ParseDoDependency(char *line) Lst path; specType = ExPath; - path = Suff_GetPath (&line[5]); + path = Suff_GetPath(&line[5]); if (path == NILLST) { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Suffix '%s' not defined (yet)", &line[5]); return; @@ -1165,9 +1165,9 @@ ParseDoDependency(char *line) char *targName = (char *)Lst_DeQueue(curTargs); if (!Suff_IsTransform (targName)) { - gn = Targ_FindNode (targName, TARG_CREATE); + gn = Targ_FindNode(targName, TARG_CREATE); } else { - gn = Suff_AddTransform (targName); + gn = Suff_AddTransform(targName); } (void)Lst_AtEnd (targets, (ClientData)gn); @@ -1244,13 +1244,13 @@ ParseDoDependency(char *line) op = OP_DEPENDS; } } else { - Parse_Error (PARSE_FATAL, "Missing dependency operator"); + Parse_Error(PARSE_FATAL, "Missing dependency operator"); return; } cp++; /* Advance beyond operator */ - Lst_ForEach (targets, ParseDoOp, (ClientData)&op); + Lst_ForEach(targets, ParseDoOp, (ClientData)&op); /* * Get to the first source @@ -1272,7 +1272,7 @@ ParseDoDependency(char *line) if (!*line) { switch (specType) { case Suffixes: - Suff_ClearSuffixes (); + Suff_ClearSuffixes(); break; case Precious: allPrecious = TRUE; @@ -1301,11 +1301,11 @@ ParseDoDependency(char *line) * set the initial character to a null-character so the loop to * get sources won't get anything */ - Main_ParseArgLine (line); + Main_ParseArgLine(line); *line = '\0'; } else if (specType == ExShell) { - if (Job_ParseShell (line) != SUCCESS) { - Parse_Error (PARSE_FATAL, "improper shell specification"); + if (Job_ParseShell(line) != SUCCESS) { + Parse_Error(PARSE_FATAL, "improper shell specification"); return; } *line = '\0'; @@ -1355,19 +1355,19 @@ ParseDoDependency(char *line) *cp = '\0'; switch (specType) { case Suffixes: - Suff_AddSuffix (line, &mainNode); + Suff_AddSuffix(line, &mainNode); break; case ExPath: Lst_ForEach(paths, ParseAddDir, (ClientData)line); break; case Includes: - Suff_AddInclude (line); + Suff_AddInclude(line); break; case Libs: - Suff_AddLib (line); + Suff_AddLib(line); break; case Null: - Suff_SetNull (line); + Suff_SetNull(line); break; case ExObjdir: Main_SetObjdir(line); @@ -1416,18 +1416,18 @@ ParseDoDependency(char *line) } if (*cp == LPAREN) { - sources = Lst_Init (FALSE); - if (Arch_ParseArchive (&line, sources, VAR_CMD) != SUCCESS) { - Parse_Error (PARSE_FATAL, + sources = Lst_Init(FALSE); + if (Arch_ParseArchive(&line, sources, VAR_CMD) != SUCCESS) { + Parse_Error(PARSE_FATAL, "Error in source archive spec \"%s\"", line); return; } while (!Lst_IsEmpty (sources)) { - gn = (GNode *) Lst_DeQueue (sources); - ParseDoSrc (tOp, gn->name, curSrcs, hasWait); + gn = (GNode *) Lst_DeQueue(sources); + ParseDoSrc(tOp, gn->name, curSrcs, hasWait); } - Lst_Destroy (sources, NOFREE); + Lst_Destroy(sources, NOFREE); cp = line; } else { if (*cp) { @@ -1435,7 +1435,7 @@ ParseDoDependency(char *line) cp += 1; } - ParseDoSrc (tOp, line, curSrcs, hasWait); + ParseDoSrc(tOp, line, curSrcs, hasWait); } while (*cp && isspace ((unsigned char)*cp)) { cp++; @@ -1451,7 +1451,7 @@ ParseDoDependency(char *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, (ClientData)0); + Lst_ForEach(targets, ParseFindMain, (ClientData)0); } /* @@ -1675,7 +1675,7 @@ Parse_DoVar(char *line, GNode *ctxt) } if (type == VAR_APPEND) { - Var_Append (line, cp, ctxt); + Var_Append(line, cp, ctxt); } else if (type == VAR_SUBST) { /* * Allow variables in the old value to be undefined, but leave their @@ -1766,7 +1766,7 @@ ParseAddCmd(ClientData gnp, ClientData cmd) GNode *gn = (GNode *) gnp; /* if target already supplied, ignore commands */ if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) - gn = (GNode *) Lst_Datum (Lst_Last (gn->cohorts)); + gn = (GNode *) Lst_Datum(Lst_Last(gn->cohorts)); if (!(gn->type & OP_HAS_COMMANDS)) { (void)Lst_AtEnd(gn->commands, cmd); ParseMark(gn); @@ -1774,15 +1774,15 @@ ParseAddCmd(ClientData gnp, ClientData cmd) #ifdef notyet /* XXX: We cannot do this until we fix the tree */ (void)Lst_AtEnd(gn->commands, cmd); - Parse_Error (PARSE_WARNING, + Parse_Error(PARSE_WARNING, "overriding commands for target \"%s\"; " "previous commands defined at %s: %d ignored", gn->name, gn->fname, gn->lineno); #else - Parse_Error (PARSE_WARNING, + Parse_Error(PARSE_WARNING, "duplicate script for target \"%s\" ignored", gn->name); - ParseErrorInternal (gn->fname, gn->lineno, PARSE_WARNING, + ParseErrorInternal(gn->fname, gn->lineno, PARSE_WARNING, "using previous script for \"%s\" defined here", gn->name); #endif @@ -1838,7 +1838,7 @@ ParseHasCommands(ClientData gnp) void Parse_AddIncludeDir(char *dir) { - (void) Dir_AddDir (parseIncPath, dir); + (void) Dir_AddDir(parseIncPath, dir); } /*- @@ -1878,7 +1878,7 @@ ParseDoInclude(char *line) } if ((*file != '"') && (*file != '<')) { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, ".include filename must be delimited by '\"' or '<'"); return; } @@ -1904,7 +1904,7 @@ ParseDoInclude(char *line) } if (*cp != endc) { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Unclosed %cinclude filename. '%c' expected", '.', endc); return; @@ -1915,7 +1915,7 @@ ParseDoInclude(char *line) * Substitute for any variables in the file name before trying to * find the thing. */ - file = Var_Subst (NULL, file, VAR_CMD, FALSE); + file = Var_Subst(NULL, file, VAR_CMD, FALSE); /* * Now we know the file's name and its search path, we attempt to @@ -1945,8 +1945,8 @@ ParseDoInclude(char *line) if (file[0] == '/') newName = estrdup(file); else - newName = str_concat (Fname, file, STR_ADDSLASH); - fullname = Dir_FindFile (newName, parseIncPath); + newName = str_concat(Fname, file, STR_ADDSLASH); + fullname = Dir_FindFile(newName, parseIncPath); if (fullname == (char *)NULL) { fullname = Dir_FindFile(newName, dirSearchPath); } @@ -1963,7 +1963,7 @@ ParseDoInclude(char *line) * then on the .PATH search path, if not found in a -I directory. * XXX: Suffix specific? */ - fullname = Dir_FindFile (file, parseIncPath); + fullname = Dir_FindFile(file, parseIncPath); if (fullname == (char *)NULL) { fullname = Dir_FindFile(file, dirSearchPath); } @@ -1981,7 +1981,7 @@ ParseDoInclude(char *line) if (fullname == (char *) NULL) { *cp = endc; if (!silent) - Parse_Error (PARSE_FATAL, "Could not find %s", file); + Parse_Error(PARSE_FATAL, "Could not find %s", file); return; } @@ -1994,11 +1994,11 @@ ParseDoInclude(char *line) * is placed on a list with other IFile structures. The list makes * a very nice stack to track how we got here... */ - oldFile = (IFile *) emalloc (sizeof (IFile)); + oldFile = emalloc(sizeof(IFile)); memcpy(oldFile, &curFile, sizeof (IFile)); - (void) Lst_AtFront (includes, (ClientData)oldFile); + (void) Lst_AtFront(includes, (ClientData)oldFile); /* * Once the previous state has been saved, we can get down to reading @@ -2016,7 +2016,7 @@ ParseDoInclude(char *line) if (curFile.F == (FILE * ) NULL) { if (!silent) - Parse_Error (PARSE_FATAL, "Cannot open %s", fullname); + Parse_Error(PARSE_FATAL, "Cannot open %s", fullname); /* * Pop to previous file */ @@ -2078,13 +2078,13 @@ Parse_FromString(char *str, int lineno) if (DEBUG(FOR)) (void) fprintf(stderr, "%s\n---- at line %d\n", str, lineno); - oldFile = (IFile *) emalloc (sizeof (IFile)); + oldFile = emalloc(sizeof(IFile)); memcpy(oldFile, &curFile, sizeof (IFile)); - (void) Lst_AtFront (includes, (ClientData)oldFile); + (void) Lst_AtFront(includes, (ClientData)oldFile); curFile.F = NULL; - curFile.P = (PTR *) emalloc (sizeof (PTR)); + curFile.P = emalloc(sizeof(PTR)); curFile.P->str = curFile.P->ptr = str; curFile.lineno = lineno; curFile.fname = estrdup(curFile.fname); @@ -2131,7 +2131,7 @@ ParseTraditionalInclude(char *line) file++; if (*file == '\0') { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Filename missing from \"include\""); return; } @@ -2220,7 +2220,7 @@ ParseTraditionalInclude(char *line) * is placed on a list with other IFile structures. The list makes * a very nice stack to track how we got here... */ - oldFile = (IFile *) emalloc(sizeof(IFile)); + oldFile = emalloc(sizeof(IFile)); memcpy(oldFile, &curFile, sizeof (IFile)); (void) Lst_AtFront(includes, (ClientData)oldFile); @@ -2270,13 +2270,13 @@ ParseEOF(int opened) { IFile *ifile; /* the state on the top of the includes stack */ - if (Lst_IsEmpty (includes)) { + if (Lst_IsEmpty(includes)) { Var_Delete(".PARSEDIR", VAR_GLOBAL); Var_Delete(".PARSEFILE", VAR_GLOBAL); return (DONE); } - ifile = (IFile *) Lst_DeQueue (includes); + ifile = (IFile *) Lst_DeQueue(includes); /* XXX dispose of curFile info */ free ((Address) curFile.fname); @@ -2591,7 +2591,7 @@ test_char: } Buf_AddByte (buf, (Byte)'\0'); line = (char *)Buf_GetAll (buf, &lineLength); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); /* * Strip trailing blanks and tabs from the line. @@ -2613,7 +2613,7 @@ test_char: * The line might be a conditional. Ask the conditional module * about it and act accordingly */ - switch (Cond_Eval (line)) { + switch (Cond_Eval(line)) { case COND_SKIP: /* * Skip to next conditional that evaluates to COND_PARSE. @@ -2640,7 +2640,7 @@ test_char: */ line = ParseSkipLine(0, 1); if (line == NULL) { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Unexpected end of file in for loop.\n"); break; } @@ -2683,7 +2683,7 @@ ParseFinishLine(void) { if (inLine) { Lst_ForEach(targets, Suff_EndTransform, (ClientData)NULL); - Lst_Destroy (targets, ParseHasCommands); + Lst_Destroy(targets, ParseHasCommands); targets = NULL; inLine = FALSE; } @@ -2725,7 +2725,7 @@ Parse_File(const char *name, FILE *stream) ParseSetParseFile(curFile.fname); do { - while ((line = ParseReadLine ()) != NULL) { + while ((line = ParseReadLine()) != NULL) { if (*line == '.') { /* * Lines that begin with the special character are either @@ -2737,7 +2737,7 @@ Parse_File(const char *name, FILE *stream) if (strncmp(cp, "include", 7) == 0 || ((cp[0] == 's' || cp[0] == '-') && strncmp(&cp[1], "include", 7) == 0)) { - ParseDoInclude (cp); + ParseDoInclude(cp); goto nextLine; } else if (strncmp(cp, "undef", 5) == 0) { char *cp2; @@ -2779,13 +2779,13 @@ Parse_File(const char *name, FILE *stream) * in a dependency spec, add the command to the list of * commands of all targets in the dependency spec */ - Lst_ForEach (targets, ParseAddCmd, cp); + Lst_ForEach(targets, ParseAddCmd, cp); #ifdef CLEANUP Lst_AtEnd(targCmds, (ClientData) line); #endif continue; } else { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Unassociated shell command \"%s\"", cp); } @@ -2800,12 +2800,12 @@ Parse_File(const char *name, FILE *stream) /* * It's an S3/S5-style "include". */ - ParseTraditionalInclude (line); + ParseTraditionalInclude(line); goto nextLine; #endif - } else if (Parse_IsVar (line)) { + } else if (Parse_IsVar(line)) { ParseFinishLine(); - Parse_DoVar (line, VAR_GLOBAL); + Parse_DoVar(line, VAR_GLOBAL); } else { /* * We now know it's a dependency line so it needs to have all @@ -2841,17 +2841,17 @@ Parse_File(const char *name, FILE *stream) #ifndef POSIX if (*cp == '\0') { if (inLine) { - Parse_Error (PARSE_WARNING, + Parse_Error(PARSE_WARNING, "Shell command needs a leading tab"); goto shellCommand; } else if (nonSpace) { - Parse_Error (PARSE_FATAL, "Missing operator"); + Parse_Error(PARSE_FATAL, "Missing operator"); } } else { #endif ParseFinishLine(); - cp = Var_Subst (NULL, line, VAR_CMD, TRUE); + cp = Var_Subst(NULL, line, VAR_CMD, TRUE); free (line); line = cp; @@ -2861,10 +2861,10 @@ Parse_File(const char *name, FILE *stream) if (targets) Lst_Destroy(targets, NOFREE); - targets = Lst_Init (FALSE); + targets = Lst_Init(FALSE); inLine = TRUE; - ParseDoDependency (line); + ParseDoDependency(line); #ifndef POSIX } #endif @@ -2909,12 +2909,12 @@ void Parse_Init(void) { mainNode = NILGNODE; - parseIncPath = Lst_Init (FALSE); - sysIncPath = Lst_Init (FALSE); - defIncPath = Lst_Init (FALSE); - includes = Lst_Init (FALSE); + parseIncPath = Lst_Init(FALSE); + sysIncPath = Lst_Init(FALSE); + defIncPath = Lst_Init(FALSE); + includes = Lst_Init(FALSE); #ifdef CLEANUP - targCmds = Lst_Init (FALSE); + targCmds = Lst_Init(FALSE); #endif } @@ -2952,17 +2952,17 @@ Parse_MainName(void) { Lst mainList; /* result list */ - mainList = Lst_Init (FALSE); + mainList = Lst_Init(FALSE); if (mainNode == NILGNODE) { - Punt ("no target to make."); + Punt("no target to make."); /*NOTREACHED*/ } else if (mainNode->type & OP_DOUBLEDEP) { - (void) Lst_AtEnd (mainList, (ClientData)mainNode); + (void) Lst_AtEnd(mainList, (ClientData)mainNode); Lst_Concat(mainList, mainNode->cohorts, LST_CONCNEW); } else - (void) Lst_AtEnd (mainList, (ClientData)mainNode); + (void) Lst_AtEnd(mainList, (ClientData)mainNode); Var_Append(".TARGETS", mainNode->name, VAR_GLOBAL); return (mainList); } diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 499e1e8e9ee..920c7d2fd71 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.22 2004/05/07 00:04:40 ross Exp $ */ +/* $NetBSD: str.c,v 1.23 2005/02/16 15:11:52 christos Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: str.c,v 1.22 2004/05/07 00:04:40 ross Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.23 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -__RCSID("$NetBSD: str.c,v 1.22 2004/05/07 00:04:40 ross Exp $"); +__RCSID("$NetBSD: str.c,v 1.23 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -139,7 +139,7 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer) const char *p; int len; int argmax = 50, curlen = 0; - char **argv = (char **)emalloc((argmax + 1) * sizeof(char *)); + char **argv = emalloc((argmax + 1) * sizeof(char *)); /* skip leading space chars. */ for (; *str == ' ' || *str == '\t'; ++str) diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 6f0e97819fa..3e3a983e909 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.47 2004/12/29 01:55:25 christos Exp $ */ +/* $NetBSD: suff.c,v 1.48 2005/02/16 15:11:52 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: suff.c,v 1.47 2004/12/29 01:55:25 christos Exp $"; +static char rcsid[] = "$NetBSD: suff.c,v 1.48 2005/02/16 15:11:52 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else -__RCSID("$NetBSD: suff.c,v 1.47 2004/12/29 01:55:25 christos Exp $"); +__RCSID("$NetBSD: suff.c,v 1.48 2005/02/16 15:11:52 christos Exp $"); #endif #endif /* not lint */ #endif @@ -370,7 +370,7 @@ SuffSuffHasNameP(ClientData s, ClientData sname) static int SuffSuffIsPrefix(ClientData s, ClientData str) { - return (SuffStrIsPrefix (((Suff *) s)->name, (char *) str) == NULL ? 1 : 0); + return (SuffStrIsPrefix(((Suff *) s)->name, (char *) str) == NULL ? 1 : 0); } /*- @@ -439,10 +439,10 @@ SuffFree(ClientData sp) s->refCount); #endif - Lst_Destroy (s->ref, NOFREE); - Lst_Destroy (s->children, NOFREE); - Lst_Destroy (s->parents, NOFREE); - Lst_Destroy (s->searchPath, Dir_Destroy); + Lst_Destroy(s->ref, NOFREE); + Lst_Destroy(s->children, NOFREE); + Lst_Destroy(s->parents, NOFREE); + Lst_Destroy(s->searchPath, Dir_Destroy); free ((Address)s->name); free ((Address)s); @@ -466,7 +466,7 @@ SuffRemove(Lst l, Suff *s) { SuffUnRef((ClientData) l, (ClientData) s); if (s->refCount == 0) { - SuffUnRef ((ClientData) sufflist, (ClientData) s); + SuffUnRef((ClientData) sufflist, (ClientData) s); SuffFree((ClientData) s); } } @@ -494,17 +494,17 @@ SuffInsert(Lst l, Suff *s) LstNode ln; /* current element in l we're examining */ Suff *s2 = NULL; /* the suffix descriptor in this element */ - if (Lst_Open (l) == FAILURE) { + if (Lst_Open(l) == FAILURE) { return; } - while ((ln = Lst_Next (l)) != NILLNODE) { - s2 = (Suff *) Lst_Datum (ln); + while ((ln = Lst_Next(l)) != NILLNODE) { + s2 = (Suff *) Lst_Datum(ln); if (s2->sNum >= s->sNum) { break; } } - Lst_Close (l); + Lst_Close(l); if (DEBUG(SUFF)) { printf("inserting %s(%d)...", s->name, s->sNum); } @@ -548,7 +548,7 @@ void Suff_ClearSuffixes(void) { #ifdef CLEANUP - Lst_Concat (suffClean, sufflist, LST_CONCLINK); + Lst_Concat(suffClean, sufflist, LST_CONCLINK); #endif sufflist = Lst_Init(FALSE); sNum = 0; @@ -598,7 +598,7 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr) if (srcLn == NILLNODE) { srcLn = Lst_Find(sufflist, (ClientData)str, SuffSuffIsPrefix); } else { - srcLn = Lst_FindFrom (sufflist, Lst_Succ(srcLn), (ClientData)str, + srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn), (ClientData)str, SuffSuffIsPrefix); } if (srcLn == NILLNODE) { @@ -621,7 +621,7 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr) } return (FALSE); } - src = (Suff *) Lst_Datum (srcLn); + src = (Suff *) Lst_Datum(srcLn); str2 = str + src->nameLen; if (*str2 == '\0') { single = src; @@ -687,13 +687,13 @@ Suff_AddTransform(char *line) *t; /* target suffix */ LstNode ln; /* Node for existing transformation */ - ln = Lst_Find (transforms, (ClientData)line, SuffGNHasNameP); + ln = Lst_Find(transforms, (ClientData)line, SuffGNHasNameP); if (ln == NILLNODE) { /* * Make a new graph node for the transformation. It will be filled in * by the Parse module. */ - gn = Targ_NewGN (line); + gn = Targ_NewGN(line); (void)Lst_AtEnd (transforms, (ClientData)gn); } else { /* @@ -702,11 +702,11 @@ Suff_AddTransform(char *line) * free the commands themselves, because a given command can be * attached to several different transformations. */ - gn = (GNode *) Lst_Datum (ln); - Lst_Destroy (gn->commands, NOFREE); - Lst_Destroy (gn->children, NOFREE); - gn->commands = Lst_Init (FALSE); - gn->children = Lst_Init (FALSE); + gn = (GNode *) Lst_Datum(ln); + Lst_Destroy(gn->commands, NOFREE); + Lst_Destroy(gn->children, NOFREE); + gn->commands = Lst_Init(FALSE); + gn->children = Lst_Init(FALSE); } gn->type = OP_TRANSFORM; @@ -720,8 +720,8 @@ Suff_AddTransform(char *line) printf("defining transformation from `%s' to `%s'\n", s->name, t->name); } - SuffInsert (t->children, s); - SuffInsert (s->parents, t); + SuffInsert(t->children, s); + SuffInsert(s->parents, t); return (gn); } @@ -753,7 +753,7 @@ Suff_EndTransform(ClientData gnp, ClientData dummy) GNode *gn = (GNode *) gnp; if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) - gn = (GNode *) Lst_Datum (Lst_Last (gn->cohorts)); + gn = (GNode *) Lst_Datum(Lst_Last(gn->cohorts)); if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) && Lst_IsEmpty(gn->children)) { @@ -921,8 +921,8 @@ SuffScanTargets(ClientData targetp, ClientData gsp) *gs->gn = NILGNODE; Targ_SetMain(NILGNODE); } - Lst_Destroy (target->children, NOFREE); - target->children = Lst_Init (FALSE); + Lst_Destroy(target->children, NOFREE); + target->children = Lst_Init(FALSE); target->type = OP_TRANSFORM; /* * link the two together in the proper relationship and order @@ -931,8 +931,8 @@ SuffScanTargets(ClientData targetp, ClientData gsp) printf("defining transformation from `%s' to `%s'\n", s->name, t->name); } - SuffInsert (t->children, s); - SuffInsert (s->parents, t); + SuffInsert(t->children, s); + SuffInsert(s->parents, t); } return 0; } @@ -963,16 +963,16 @@ Suff_AddSuffix(char *str, GNode **gn) LstNode ln; GNodeSuff gs; - ln = Lst_Find (sufflist, (ClientData)str, SuffSuffHasNameP); + ln = Lst_Find(sufflist, (ClientData)str, SuffSuffHasNameP); if (ln == NILLNODE) { - s = (Suff *) emalloc (sizeof (Suff)); + s = emalloc(sizeof(Suff)); - s->name = estrdup (str); + s->name = estrdup(str); s->nameLen = strlen (s->name); - s->searchPath = Lst_Init (FALSE); - s->children = Lst_Init (FALSE); - s->parents = Lst_Init (FALSE); - s->ref = Lst_Init (FALSE); + s->searchPath = Lst_Init(FALSE); + s->children = Lst_Init(FALSE); + s->parents = Lst_Init(FALSE); + s->ref = Lst_Init(FALSE); s->sNum = sNum++; s->flags = 0; s->refCount = 1; @@ -987,12 +987,12 @@ Suff_AddSuffix(char *str, GNode **gn) gs.gn = gn; gs.s = s; gs.r = FALSE; - Lst_ForEach (Targ_List(), SuffScanTargets, (ClientData) &gs); + Lst_ForEach(Targ_List(), SuffScanTargets, (ClientData) &gs); /* * Look for any existing transformations from or to this suffix. * XXX: Only do this after a Suff_ClearSuffixes? */ - Lst_ForEach (transforms, SuffRebuildGraph, (ClientData) s); + Lst_ForEach(transforms, SuffRebuildGraph, (ClientData) s); } } @@ -1015,11 +1015,11 @@ Suff_GetPath(char *sname) LstNode ln; Suff *s; - ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP); + ln = Lst_Find(sufflist, (ClientData)sname, SuffSuffHasNameP); if (ln == NILLNODE) { return (NILLST); } else { - s = (Suff *) Lst_Datum (ln); + s = (Suff *) Lst_Datum(ln); return (s->searchPath); } } @@ -1051,15 +1051,15 @@ Suff_DoPaths(void) Lst inIncludes; /* Cumulative .INCLUDES path */ Lst inLibs; /* Cumulative .LIBS path */ - if (Lst_Open (sufflist) == FAILURE) { + if (Lst_Open(sufflist) == FAILURE) { return; } inIncludes = Lst_Init(FALSE); inLibs = Lst_Init(FALSE); - while ((ln = Lst_Next (sufflist)) != NILLNODE) { - s = (Suff *) Lst_Datum (ln); + while ((ln = Lst_Next(sufflist)) != NILLNODE) { + s = (Suff *) Lst_Datum(ln); if (!Lst_IsEmpty (s->searchPath)) { #ifdef INCLUDES if (s->flags & SUFF_INCLUDE) { @@ -1073,7 +1073,7 @@ Suff_DoPaths(void) #endif /* LIBRARIES */ Dir_Concat(s->searchPath, dirSearchPath); } else { - Lst_Destroy (s->searchPath, Dir_Destroy); + Lst_Destroy(s->searchPath, Dir_Destroy); s->searchPath = Lst_Duplicate(dirSearchPath, Dir_CopyDir); } } @@ -1086,7 +1086,7 @@ Suff_DoPaths(void) Lst_Destroy(inIncludes, Dir_Destroy); Lst_Destroy(inLibs, Dir_Destroy); - Lst_Close (sufflist); + Lst_Close(sufflist); } /*- @@ -1113,9 +1113,9 @@ Suff_AddInclude(char *sname) LstNode ln; Suff *s; - ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP); + ln = Lst_Find(sufflist, (ClientData)sname, SuffSuffHasNameP); if (ln != NILLNODE) { - s = (Suff *) Lst_Datum (ln); + s = (Suff *) Lst_Datum(ln); s->flags |= SUFF_INCLUDE; } } @@ -1145,9 +1145,9 @@ Suff_AddLib(char *sname) LstNode ln; Suff *s; - ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP); + ln = Lst_Find(sufflist, (ClientData)sname, SuffSuffHasNameP); if (ln != NILLNODE) { - s = (Suff *) Lst_Datum (ln); + s = (Suff *) Lst_Datum(ln); s->flags |= SUFF_LIBRARY; } } @@ -1188,7 +1188,7 @@ SuffAddSrc(ClientData sp, ClientData lsp) * structure for a file with no suffix attached. Two birds, and all * that... */ - s2 = (Src *) emalloc (sizeof (Src)); + s2 = emalloc(sizeof(Src)); s2->file = estrdup(targ->pref); s2->pref = targ->pref; s2->parent = targ; @@ -1206,8 +1206,8 @@ SuffAddSrc(ClientData sp, ClientData lsp) printf("\n"); #endif } - s2 = (Src *) emalloc (sizeof (Src)); - s2->file = str_concat (targ->pref, s->name, 0); + s2 = emalloc(sizeof(Src)); + s2->file = str_concat(targ->pref, s->name, 0); s2->pref = targ->pref; s2->parent = targ; s2->node = NILGNODE; @@ -1251,7 +1251,7 @@ SuffAddLevel(Lst l, Src *targ) ls.s = targ; ls.l = l; - Lst_ForEach (targ->suff->children, SuffAddSrc, (ClientData)&ls); + Lst_ForEach(targ->suff->children, SuffAddSrc, (ClientData)&ls); } /*- @@ -1273,7 +1273,7 @@ SuffRemoveSrc(Lst l) Src *s; int t = 0; - if (Lst_Open (l) == FAILURE) { + if (Lst_Open(l) == FAILURE) { return 0; } #ifdef DEBUG_SRC @@ -1283,8 +1283,8 @@ SuffRemoveSrc(Lst l) #endif - while ((ln = Lst_Next (l)) != NILLNODE) { - s = (Src *) Lst_Datum (ln); + while ((ln = Lst_Next(l)) != NILLNODE) { + s = (Src *) Lst_Datum(ln); if (s->children == 0) { free ((Address)s->file); if (!s->parent) @@ -1346,7 +1346,7 @@ SuffFindThem(Lst srcs, Lst slst) rs = (Src *) NULL; while (!Lst_IsEmpty (srcs)) { - s = (Src *) Lst_DeQueue (srcs); + s = (Src *) Lst_DeQueue(srcs); if (DEBUG(SUFF)) { printf ("\ttrying %s...", s->file); @@ -1364,7 +1364,7 @@ SuffFindThem(Lst srcs, Lst slst) break; } - if ((ptr = Dir_FindFile (s->file, s->suff->searchPath)) != NULL) { + if ((ptr = Dir_FindFile(s->file, s->suff->searchPath)) != NULL) { rs = s; #ifdef DEBUG_SRC printf("remove %x from %x\n", s, srcs); @@ -1377,7 +1377,7 @@ SuffFindThem(Lst srcs, Lst slst) printf ("not there\n"); } - SuffAddLevel (srcs, s); + SuffAddLevel(srcs, s); Lst_AtEnd(slst, (ClientData) s); } @@ -1417,13 +1417,13 @@ SuffFindCmds(Src *targ, Lst slst) char *cp; t = targ->node; - (void) Lst_Open (t->children); + (void) Lst_Open(t->children); prefLen = strlen (targ->pref); for (;;) { ln = Lst_Next(t->children); if (ln == NILLNODE) { - Lst_Close (t->children); + Lst_Close(t->children); return NULL; } s = (GNode *)Lst_Datum (ln); @@ -1440,7 +1440,7 @@ SuffFindCmds(Src *targ, Lst slst) * The node matches the prefix ok, see if it has a known * suffix. */ - ln = Lst_Find (sufflist, (ClientData)&cp[prefLen], + ln = Lst_Find(sufflist, (ClientData)&cp[prefLen], SuffSuffHasNameP); if (ln == NILLNODE) continue; @@ -1462,7 +1462,7 @@ SuffFindCmds(Src *targ, Lst slst) * source node's name so Suff_FindDeps can free it * again (ick)), and return the new structure. */ - ret = (Src *)emalloc (sizeof (Src)); + ret = emalloc(sizeof(Src)); ret->file = estrdup(s->name); ret->pref = targ->pref; ret->suff = suff; @@ -1915,8 +1915,8 @@ SuffFindArchiveDeps(GNode *gn, Lst slst) /* * Set the other two local variables required for this target. */ - Var_Set (MEMBER, name, gn, 0); - Var_Set (ARCHIVE, gn->name, gn, 0); + Var_Set(MEMBER, name, gn, 0); + Var_Set(ARCHIVE, gn->name, gn, 0); if (ms != NULL) { /* @@ -2046,7 +2046,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst) /* * Allocate a Src structure to which things can be transformed */ - targ = (Src *)emalloc(sizeof (Src)); + targ = emalloc(sizeof(Src)); targ->file = estrdup(gn->name); targ->suff = (Suff *)Lst_Datum(ln); targ->suff->refCount++; @@ -2091,7 +2091,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst) printf("\tNo known suffix on %s. Using .NULL suffix\n", gn->name); } - targ = (Src *)emalloc(sizeof (Src)); + targ = emalloc(sizeof(Src)); targ->file = estrdup(gn->name); targ->suff = suffNull; targ->suff->refCount++; @@ -2415,17 +2415,17 @@ SuffFindDeps(GNode *gn, Lst slst) LstNode ln; Suff *s; - ln = Lst_Find (sufflist, (ClientData)UNCONST(LIBSUFF), + ln = Lst_Find(sufflist, (ClientData)UNCONST(LIBSUFF), SuffSuffHasNameP); if (gn->suffix) gn->suffix->refCount--; if (ln != NILLNODE) { - gn->suffix = s = (Suff *) Lst_Datum (ln); + gn->suffix = s = (Suff *) Lst_Datum(ln); gn->suffix->refCount++; - Arch_FindLib (gn, s->searchPath); + Arch_FindLib(gn, s->searchPath); } else { gn->suffix = NULL; - Var_Set (TARGET, gn->name, gn, 0); + Var_Set(TARGET, gn->name, gn, 0); } /* * Because a library (-lfoo) target doesn't follow the standard @@ -2476,7 +2476,7 @@ Suff_SetNull(char *name) */ suffNull = s; } else { - Parse_Error (PARSE_WARNING, "Desired null suffix %s not defined.", + Parse_Error(PARSE_WARNING, "Desired null suffix %s not defined.", name); } } @@ -2496,12 +2496,12 @@ Suff_SetNull(char *name) void Suff_Init(void) { - sufflist = Lst_Init (FALSE); + sufflist = Lst_Init(FALSE); #ifdef CLEANUP suffClean = Lst_Init(FALSE); #endif - srclist = Lst_Init (FALSE); - transforms = Lst_Init (FALSE); + srclist = Lst_Init(FALSE); + transforms = Lst_Init(FALSE); sNum = 0; /* @@ -2509,15 +2509,15 @@ Suff_Init(void) * actually go on the suffix list or everyone will think that's its * suffix. */ - emptySuff = suffNull = (Suff *) emalloc (sizeof (Suff)); + emptySuff = suffNull = emalloc(sizeof(Suff)); - suffNull->name = estrdup (""); + suffNull->name = estrdup(""); suffNull->nameLen = 0; - suffNull->searchPath = Lst_Init (FALSE); + suffNull->searchPath = Lst_Init(FALSE); Dir_Concat(suffNull->searchPath, dirSearchPath); - suffNull->children = Lst_Init (FALSE); - suffNull->parents = Lst_Init (FALSE); - suffNull->ref = Lst_Init (FALSE); + suffNull->children = Lst_Init(FALSE); + suffNull->parents = Lst_Init(FALSE); + suffNull->ref = Lst_Init(FALSE); suffNull->sNum = sNum++; suffNull->flags = SUFF_NULL; suffNull->refCount = 1; @@ -2591,13 +2591,13 @@ SuffPrintSuff(ClientData sp, ClientData dummy) } fputc ('\n', stdout); printf ("#\tTo: "); - Lst_ForEach (s->parents, SuffPrintName, (ClientData)0); + Lst_ForEach(s->parents, SuffPrintName, (ClientData)0); fputc ('\n', stdout); printf ("#\tFrom: "); - Lst_ForEach (s->children, SuffPrintName, (ClientData)0); + Lst_ForEach(s->children, SuffPrintName, (ClientData)0); fputc ('\n', stdout); printf ("#\tSearch Path: "); - Dir_PrintPath (s->searchPath); + Dir_PrintPath(s->searchPath); fputc ('\n', stdout); return (dummy ? 0 : 0); } @@ -2608,9 +2608,9 @@ SuffPrintTrans(ClientData tp, ClientData dummy) GNode *t = (GNode *) tp; printf ("%-16s: ", t->name); - Targ_PrintType (t->type); + Targ_PrintType(t->type); fputc ('\n', stdout); - Lst_ForEach (t->commands, Targ_PrintCmd, (ClientData)0); + Lst_ForEach(t->commands, Targ_PrintCmd, (ClientData)0); fputc ('\n', stdout); return(dummy ? 0 : 0); } @@ -2619,8 +2619,8 @@ void Suff_PrintAll(void) { printf ("#*** Suffixes:\n"); - Lst_ForEach (sufflist, SuffPrintSuff, (ClientData)0); + Lst_ForEach(sufflist, SuffPrintSuff, (ClientData)0); printf ("#*** Transformations:\n"); - Lst_ForEach (transforms, SuffPrintTrans, (ClientData)0); + Lst_ForEach(transforms, SuffPrintTrans, (ClientData)0); } diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 0c96e534ca3..dcb8931d9a3 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.33 2004/07/01 20:38:09 jmc Exp $ */ +/* $NetBSD: targ.c,v 1.34 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: targ.c,v 1.33 2004/07/01 20:38:09 jmc Exp $"; +static char rcsid[] = "$NetBSD: targ.c,v 1.34 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: targ.c,v 1.33 2004/07/01 20:38:09 jmc Exp $"); +__RCSID("$NetBSD: targ.c,v 1.34 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -163,8 +163,8 @@ static int TargPropagateNode(ClientData, ClientData); void Targ_Init(void) { - allTargets = Lst_Init (FALSE); - Hash_InitTable (&targets, HTSIZE); + allTargets = Lst_Init(FALSE); + Hash_InitTable(&targets, HTSIZE); } /*- @@ -229,8 +229,8 @@ Targ_NewGN(const char *name) { GNode *gn; - gn = (GNode *) emalloc (sizeof (GNode)); - gn->name = estrdup (name); + gn = emalloc(sizeof(GNode)); + gn->name = estrdup(name); gn->uname = NULL; gn->path = NULL; if (name[0] == '-' && name[1] == 'l') { @@ -245,14 +245,14 @@ Targ_NewGN(const char *name) gn->flags = 0; gn->order = 0; gn->mtime = gn->cmtime = 0; - gn->iParents = Lst_Init (FALSE); - gn->cohorts = Lst_Init (FALSE); - gn->parents = Lst_Init (FALSE); - gn->children = Lst_Init (FALSE); - gn->successors = Lst_Init (FALSE); - gn->preds = Lst_Init (FALSE); + gn->iParents = Lst_Init(FALSE); + gn->cohorts = Lst_Init(FALSE); + gn->parents = Lst_Init(FALSE); + gn->children = Lst_Init(FALSE); + gn->successors = Lst_Init(FALSE); + gn->preds = Lst_Init(FALSE); Hash_InitTable(&gn->context, 0); - gn->commands = Lst_Init (FALSE); + gn->commands = Lst_Init(FALSE); gn->suffix = NULL; gn->lineno = 0; gn->fname = NULL; @@ -335,15 +335,15 @@ Targ_FindNode(const char *name, int flags) if (flags & TARG_CREATE) { - he = Hash_CreateEntry (&targets, name, &isNew); + he = Hash_CreateEntry(&targets, name, &isNew); if (isNew) { - gn = Targ_NewGN (name); + gn = Targ_NewGN(name); Hash_SetValue (he, gn); Var_Append(".ALLTARGETS", name, VAR_GLOBAL); - (void) Lst_AtEnd (allTargets, (ClientData)gn); + (void) Lst_AtEnd(allTargets, (ClientData)gn); } } else { - he = Hash_FindEntry (&targets, name); + he = Hash_FindEntry(&targets, name); } if (he == (Hash_Entry *) NULL) { @@ -380,26 +380,26 @@ Targ_FindList(Lst names, int flags) GNode *gn; /* node in tLn */ char *name; - nodes = Lst_Init (FALSE); + nodes = Lst_Init(FALSE); - if (Lst_Open (names) == FAILURE) { + if (Lst_Open(names) == FAILURE) { return (nodes); } - while ((ln = Lst_Next (names)) != NILLNODE) { + while ((ln = Lst_Next(names)) != NILLNODE) { name = (char *)Lst_Datum(ln); - gn = Targ_FindNode (name, flags); + gn = Targ_FindNode(name, flags); if (gn != NILGNODE) { /* * Note: Lst_AtEnd must come before the Lst_Concat so the nodes * are added to the list in the order in which they were * encountered in the makefile. */ - (void) Lst_AtEnd (nodes, (ClientData)gn); + (void) Lst_AtEnd(nodes, (ClientData)gn); } else if (flags == TARG_NOCREATE) { - Error ("\"%s\" -- target unknown.", name); + Error("\"%s\" -- target unknown.", name); } } - Lst_Close (names); + Lst_Close(names); return (nodes); } @@ -643,13 +643,13 @@ TargPrintNode(ClientData gnp, ClientData passp) } if (!Lst_IsEmpty (gn->iParents)) { printf("# implicit parents: "); - Lst_ForEach (gn->iParents, TargPrintName, (ClientData)0); + Lst_ForEach(gn->iParents, TargPrintName, (ClientData)0); fputc ('\n', stdout); } } if (!Lst_IsEmpty (gn->parents)) { printf("# parents: "); - Lst_ForEach (gn->parents, TargPrintName, (ClientData)0); + Lst_ForEach(gn->parents, TargPrintName, (ClientData)0); fputc ('\n', stdout); } @@ -662,13 +662,13 @@ TargPrintNode(ClientData gnp, ClientData passp) case OP_DOUBLEDEP: printf(":: "); break; } - Targ_PrintType (gn->type); - Lst_ForEach (gn->children, TargPrintName, (ClientData)0); + Targ_PrintType(gn->type); + Lst_ForEach(gn->children, TargPrintName, (ClientData)0); fputc ('\n', stdout); - Lst_ForEach (gn->commands, Targ_PrintCmd, (ClientData)0); + Lst_ForEach(gn->commands, Targ_PrintCmd, (ClientData)0); printf("\n\n"); if (gn->type & OP_DOUBLEDEP) { - Lst_ForEach (gn->cohorts, TargPrintNode, (ClientData)&pass); + Lst_ForEach(gn->cohorts, TargPrintNode, (ClientData)&pass); } } return (0); @@ -717,14 +717,14 @@ void Targ_PrintGraph(int pass) { printf("#*** Input graph:\n"); - Lst_ForEach (allTargets, TargPrintNode, (ClientData)&pass); + Lst_ForEach(allTargets, TargPrintNode, (ClientData)&pass); printf("\n\n"); printf("#\n# Files that are only sources:\n"); - Lst_ForEach (allTargets, TargPrintOnlySrc, (ClientData) 0); + Lst_ForEach(allTargets, TargPrintOnlySrc, (ClientData) 0); printf("#*** Global Variables:\n"); - Var_Dump (VAR_GLOBAL); + Var_Dump(VAR_GLOBAL); printf("#*** Command-line Variables:\n"); - Var_Dump (VAR_CMD); + Var_Dump(VAR_CMD); printf("\n"); Dir_PrintDirectories(); printf("\n"); @@ -746,12 +746,12 @@ TargPropagateNode(ClientData gnp, ClientData junk __unused) { GNode *gn = (GNode *) gnp; if (gn->type & OP_DOUBLEDEP) - Lst_ForEach (gn->cohorts, TargPropagateCohort, gnp); + Lst_ForEach(gn->cohorts, TargPropagateCohort, gnp); return (0); } void Targ_Propagate(void) { - Lst_ForEach (allTargets, TargPropagateNode, (ClientData)0); + Lst_ForEach(allTargets, TargPropagateNode, (ClientData)0); } diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c index a051b60be8d..86ac1d49bb4 100644 --- a/usr.bin/make/util.c +++ b/usr.bin/make/util.c @@ -1,15 +1,15 @@ -/* $NetBSD: util.c,v 1.35 2004/05/07 00:04:40 ross Exp $ */ +/* $NetBSD: util.c,v 1.36 2005/02/16 15:11:53 christos Exp $ */ /* * Missing stuff from OS's */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: util.c,v 1.35 2004/05/07 00:04:40 ross Exp $"; +static char rcsid[] = "$NetBSD: util.c,v 1.36 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: util.c,v 1.35 2004/05/07 00:04:40 ross Exp $"); +__RCSID("$NetBSD: util.c,v 1.36 2005/02/16 15:11:53 christos Exp $"); #endif #endif @@ -67,7 +67,7 @@ setenv(const char *name, const char *value, int dum) { char *p; int len = strlen(name) + strlen(value) + 2; /* = \0 */ - char *ptr = (char*) emalloc(len); + char *ptr = emalloc(len); (void) dum; diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 8f9eafad87a..f008bf255a2 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.91 2004/10/30 20:49:05 dsl Exp $ */ +/* $NetBSD: var.c,v 1.92 2005/02/16 15:11:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.91 2004/10/30 20:49:05 dsl Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.92 2005/02/16 15:11:53 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.91 2004/10/30 20:49:05 dsl Exp $"); +__RCSID("$NetBSD: var.c,v 1.92 2005/02/16 15:11:53 christos Exp $"); #endif #endif /* not lint */ #endif @@ -361,15 +361,15 @@ VarFind(const char *name, GNode *ctxt, int flags) * look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order, * depending on the FIND_* flags in 'flags' */ - var = Hash_FindEntry (&ctxt->context, name); + var = Hash_FindEntry(&ctxt->context, name); if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD)) { - var = Hash_FindEntry (&VAR_CMD->context, name); + var = Hash_FindEntry(&VAR_CMD->context, name); } if (!checkEnvFirst && (var == NULL) && (flags & FIND_GLOBAL) && (ctxt != VAR_GLOBAL)) { - var = Hash_FindEntry (&VAR_GLOBAL->context, name); + var = Hash_FindEntry(&VAR_GLOBAL->context, name); } if ((var == NULL) && (flags & FIND_ENV)) { char *env; @@ -377,7 +377,7 @@ VarFind(const char *name, GNode *ctxt, int flags) if ((env = getenv (name)) != NULL) { int len; - v = (Var *) emalloc(sizeof(Var)); + v = emalloc(sizeof(Var)); v->name = estrdup(name); len = strlen(env); @@ -390,7 +390,7 @@ VarFind(const char *name, GNode *ctxt, int flags) } else if (checkEnvFirst && (flags & FIND_GLOBAL) && (ctxt != VAR_GLOBAL)) { - var = Hash_FindEntry (&VAR_GLOBAL->context, name); + var = Hash_FindEntry(&VAR_GLOBAL->context, name); if (var == NULL) { return ((Var *) NIL); } else { @@ -432,7 +432,7 @@ VarAdd(const char *name, const char *val, GNode *ctxt) int len; Hash_Entry *h; - v = (Var *) emalloc (sizeof (Var)); + v = emalloc(sizeof(Var)); len = val ? strlen(val) : 0; v->val = Buf_Init(len+1); @@ -440,7 +440,7 @@ VarAdd(const char *name, const char *val, GNode *ctxt) v->flags = 0; - h = Hash_CreateEntry (&ctxt->context, name, NULL); + h = Hash_CreateEntry(&ctxt->context, name, NULL); Hash_SetValue(h, v); v->name = h->name; if (DEBUG(VAR)) { @@ -523,9 +523,9 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags) name = Var_Subst(NULL, cp, ctxt, 0); } else name = cp; - v = VarFind (name, ctxt, 0); + v = VarFind(name, ctxt, 0); if (v == (Var *) NIL) { - VarAdd (name, val, ctxt); + VarAdd(name, val, ctxt); } else { Buf_Discard(v->val, Buf_Size(v->val)); Buf_AddBytes(v->val, strlen(val), (const Byte *)val); @@ -594,10 +594,10 @@ Var_Append(const char *name, const char *val, GNode *ctxt) } else name = cp; - v = VarFind (name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0); + v = VarFind(name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0); if (v == (Var *) NIL) { - VarAdd (name, val, ctxt); + VarAdd(name, val, ctxt); } else { Buf_AddByte(v->val, (Byte)' '); Buf_AddBytes(v->val, strlen(val), (const Byte *)val); @@ -615,7 +615,7 @@ Var_Append(const char *name, const char *val, GNode *ctxt) * export other variables...) */ v->flags &= ~VAR_FROM_ENV; - h = Hash_CreateEntry (&ctxt->context, name, NULL); + h = Hash_CreateEntry(&ctxt->context, name, NULL); Hash_SetValue(h, v); } } @@ -678,7 +678,7 @@ Var_Value(const char *name, GNode *ctxt, char **frp) { Var *v; - v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); + v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); *frp = NULL; if (v != (Var *) NIL) { char *p = ((char *)Buf_GetAll(v->val, (int *)NULL)); @@ -728,7 +728,7 @@ VarHead(GNode *ctx __unused, Var_Parse_State *vpstate, Buf_AddByte (buf, vpstate->varSpace); } *slash = '\0'; - Buf_AddBytes (buf, strlen (word), (Byte *)word); + Buf_AddBytes(buf, strlen (word), (Byte *)word); *slash = '/'; return (TRUE); } else { @@ -777,10 +777,10 @@ VarTail(GNode *ctx __unused, Var_Parse_State *vpstate, slash = strrchr (word, '/'); if (slash != (char *)NULL) { *slash++ = '\0'; - Buf_AddBytes (buf, strlen(slash), (Byte *)slash); + Buf_AddBytes(buf, strlen(slash), (Byte *)slash); slash[-1] = '/'; } else { - Buf_AddBytes (buf, strlen(word), (Byte *)word); + Buf_AddBytes(buf, strlen(word), (Byte *)word); } return (dummy ? TRUE : TRUE); } @@ -818,7 +818,7 @@ VarSuffix(GNode *ctx __unused, Var_Parse_State *vpstate, Buf_AddByte (buf, vpstate->varSpace); } *dot++ = '\0'; - Buf_AddBytes (buf, strlen (dot), (Byte *)dot); + Buf_AddBytes(buf, strlen (dot), (Byte *)dot); dot[-1] = '.'; addSpace = TRUE; } @@ -860,10 +860,10 @@ VarRoot(GNode *ctx __unused, Var_Parse_State *vpstate, dot = strrchr (word, '.'); if (dot != (char *)NULL) { *dot = '\0'; - Buf_AddBytes (buf, strlen (word), (Byte *)word); + Buf_AddBytes(buf, strlen (word), (Byte *)word); *dot = '.'; } else { - Buf_AddBytes (buf, strlen(word), (Byte *)word); + Buf_AddBytes(buf, strlen(word), (Byte *)word); } return (dummy ? TRUE : TRUE); } @@ -1412,13 +1412,13 @@ VarSelectWords(GNode *ctx __unused, Var_Parse_State *vpstate, int ac, i; int start, end, step; - buf = Buf_Init (0); + buf = Buf_Init(0); addSpace = FALSE; if (vpstate->oneBigWord) { /* fake what brk_string() would do if there were only one word */ ac = 1; - av = (char **)emalloc((ac + 1) * sizeof(char *)); + av = emalloc((ac + 1) * sizeof(char *)); as = strdup(str); av[0] = as; av[1] = NULL; @@ -1467,7 +1467,7 @@ VarSelectWords(GNode *ctx __unused, Var_Parse_State *vpstate, Buf_AddByte (buf, '\0'); as = (char *)Buf_GetAll (buf, (int *)NULL); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); return (as); } @@ -1505,13 +1505,13 @@ VarModify(GNode *ctx, Var_Parse_State *vpstate, char *as; /* word list memory */ int ac, i; - buf = Buf_Init (0); + buf = Buf_Init(0); addSpace = FALSE; if (vpstate->oneBigWord) { /* fake what brk_string() would do if there were only one word */ ac = 1; - av = (char **)emalloc((ac + 1) * sizeof(char *)); + av = emalloc((ac + 1) * sizeof(char *)); as = strdup(str); av[0] = as; av[1] = NULL; @@ -1528,7 +1528,7 @@ VarModify(GNode *ctx, Var_Parse_State *vpstate, Buf_AddByte (buf, '\0'); as = (char *)Buf_GetAll (buf, (int *)NULL); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); return (as); } @@ -1564,7 +1564,7 @@ VarSort(const char *str) char *as; /* word list memory */ int ac, i; - buf = Buf_Init (0); + buf = Buf_Init(0); av = brk_string(str, &ac, FALSE, &as); @@ -1582,7 +1582,7 @@ VarSort(const char *str) Buf_AddByte (buf, '\0'); as = (char *)Buf_GetAll (buf, (int *)NULL); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); return (as); } @@ -1782,7 +1782,7 @@ VarQuote(char *str) /* This should cover most shells :-( */ static char meta[] = "\n \t'`\";&<>()|*?{}[]\\$!#^~"; - buf = Buf_Init (MAKE_BSIZE); + buf = Buf_Init(MAKE_BSIZE); for (; *str; str++) { if (strchr(meta, *str) != NULL) Buf_AddByte(buf, (Byte)'\\'); @@ -1790,7 +1790,7 @@ VarQuote(char *str) } Buf_AddByte(buf, (Byte) '\0'); str = (char *)Buf_GetAll (buf, (int *)NULL); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); return str; } @@ -1818,13 +1818,13 @@ VarChangeCase(char *str, int upper) int (*modProc)(int); modProc = (upper ? toupper : tolower); - buf = Buf_Init (MAKE_BSIZE); + buf = Buf_Init(MAKE_BSIZE); for (; *str ; str++) { Buf_AddByte(buf, (Byte) modProc(*str)); } Buf_AddByte(buf, (Byte) '\0'); - str = (char *) Buf_GetAll (buf, (int *) NULL); - Buf_Destroy (buf, FALSE); + str = (char *) Buf_GetAll(buf, (int *) NULL); + Buf_Destroy(buf, FALSE); return str; } @@ -1897,7 +1897,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, name[0] = str[1]; name[1] = '\0'; - v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); + v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); if (v == (Var *)NIL) { *lengthPtr = 2; @@ -1936,7 +1936,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, startc = str[1]; endc = startc == '(' ? ')' : '}'; - buf = Buf_Init (MAKE_BSIZE); + buf = Buf_Init(MAKE_BSIZE); /* * Skip to the end character or a colon, whichever comes first. @@ -1980,7 +1980,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, str = Buf_GetAll(buf, (int *) NULL); vlen = strlen(str); - v = VarFind (str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); + v = VarFind(str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); if ((v == (Var *)NIL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) && (vlen == 2) && (str[1] == 'F' || str[1] == 'D')) { @@ -2028,7 +2028,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, *freePtr = TRUE; *lengthPtr = tstr-start+1; *WR(tstr) = endc; - Buf_Destroy (buf, TRUE); + Buf_Destroy(buf, TRUE); return(val); } break; @@ -2087,10 +2087,10 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, strncpy(pstr, start, *lengthPtr); pstr[*lengthPtr] = '\0'; *freePtr = TRUE; - Buf_Destroy (buf, TRUE); + Buf_Destroy(buf, TRUE); return(pstr); } else { - Buf_Destroy (buf, TRUE); + Buf_Destroy(buf, TRUE); return (err ? var_Error : varNoError); } } else { @@ -2098,14 +2098,14 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, * Still need to get to the end of the variable specification, * so kludge up a Var structure for the modifications */ - v = (Var *) emalloc(sizeof(Var)); + v = emalloc(sizeof(Var)); v->name = UNCONST(str); v->val = Buf_Init(1); v->flags = VAR_JUNK; - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); } } else - Buf_Destroy (buf, TRUE); + Buf_Destroy(buf, TRUE); } @@ -2296,9 +2296,9 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, Var_Append(v->name, pattern.rhs, v_ctxt); break; case '!': - newStr = Cmd_Exec (pattern.rhs, &emsg); + newStr = Cmd_Exec(pattern.rhs, &emsg); if (emsg) - Error (emsg, nstr); + Error(emsg, nstr); else Var_Set(v->name, newStr, v_ctxt, 0); if (newStr) @@ -2448,10 +2448,10 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, NULL, &pattern.rightLen, NULL)) == NULL) goto cleanup; - newStr = Cmd_Exec (pattern.rhs, &emsg); + newStr = Cmd_Exec(pattern.rhs, &emsg); free(UNCONST(pattern.rhs)); if (emsg) - Error (emsg, nstr); + Error(emsg, nstr); termc = *cp; delim = '\0'; if (v->flags & VAR_JUNK) { @@ -2675,7 +2675,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, * ":tu", ":tl" */ if (tstr[1] == 'u' || tstr[1] == 'l') { - newStr = VarChangeCase (nstr, (tstr[1] == 'u')); + newStr = VarChangeCase(nstr, (tstr[1] == 'u')); cp = tstr + 2; termc = *cp; } else if (tstr[1] == 'W' || tstr[1] == 'w') { @@ -2964,7 +2964,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, #endif case 'Q': if (tstr[1] == endc || tstr[1] == ':') { - newStr = VarQuote (nstr); + newStr = VarQuote(nstr); cp = tstr + 1; termc = *cp; break; @@ -3008,7 +3008,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, /*FALLTHRU*/ case 'O': if (tstr[1] == endc || tstr[1] == ':') { - newStr = VarSort (nstr); + newStr = VarSort(nstr); cp = tstr + 1; termc = *cp; break; @@ -3016,7 +3016,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, /*FALLTHRU*/ case 'u': if (tstr[1] == endc || tstr[1] == ':') { - newStr = VarUniq (nstr); + newStr = VarUniq(nstr); cp = tstr + 1; termc = *cp; break; @@ -3026,9 +3026,9 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, case 's': if (tstr[1] == 'h' && (tstr[2] == endc || tstr[2] == ':')) { const char *emsg; - newStr = Cmd_Exec (nstr, &emsg); + newStr = Cmd_Exec(nstr, &emsg); if (emsg) - Error (emsg, nstr); + Error(emsg, nstr); cp = tstr + 2; termc = *cp; break; @@ -3099,7 +3099,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, } else #endif { - Error ("Unknown modifier '%c'", *tstr); + Error("Unknown modifier '%c'", *tstr); for (cp = tstr+1; *cp != ':' && *cp != endc && *cp != '\0'; cp++) @@ -3229,7 +3229,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) * been reported to prevent a plethora * of messages when recursing */ - buf = Buf_Init (MAKE_BSIZE); + buf = Buf_Init(MAKE_BSIZE); errorReported = FALSE; while (*str) { @@ -3308,7 +3308,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) continue; } - val = Var_Parse (str, ctxt, undefErr, &length, &doFree); + val = Var_Parse(str, ctxt, undefErr, &length, &doFree); /* * When we come down here, val should either point to the @@ -3332,7 +3332,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) * when the file is parsed. */ if (!errorReported) { - Parse_Error (PARSE_FATAL, + Parse_Error(PARSE_FATAL, "Undefined variable \"%.*s\"",length,str); } str += length; @@ -3352,7 +3352,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) * Copy all the characters from the variable value straight * into the new string. */ - Buf_AddBytes (buf, strlen (val), (Byte *)val); + Buf_AddBytes(buf, strlen (val), (Byte *)val); if (doFree) { free ((Address)val); } @@ -3362,7 +3362,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) Buf_AddByte (buf, '\0'); val = (char *)Buf_GetAll (buf, (int *)NULL); - Buf_Destroy (buf, FALSE); + Buf_Destroy(buf, FALSE); return (val); } @@ -3430,8 +3430,8 @@ Var_GetHead(char *file) void Var_Init(void) { - VAR_GLOBAL = Targ_NewGN ("Global"); - VAR_CMD = Targ_NewGN ("Command"); + VAR_GLOBAL = Targ_NewGN("Global"); + VAR_CMD = Targ_NewGN("Command"); } |
