diff options
| author | christos <christos@NetBSD.org> | 2005-07-25 22:55:58 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2005-07-25 22:55:58 +0000 |
| commit | 3692d77541719fcf01cd0767f047ec48db1a5eba (patch) | |
| tree | d27c36361ad666a23b1503410d1a3da7b39d28f7 /usr.bin/make | |
| parent | c3414672de892161e24b25495c8512650cd9d90a (diff) | |
Whitespace KNF cleanup from Max Okumoto
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/arch.c | 132 | ||||
| -rw-r--r-- | usr.bin/make/buf.c | 18 | ||||
| -rw-r--r-- | usr.bin/make/compat.c | 30 | ||||
| -rw-r--r-- | usr.bin/make/cond.c | 10 | ||||
| -rw-r--r-- | usr.bin/make/dir.c | 74 | ||||
| -rw-r--r-- | usr.bin/make/for.c | 24 | ||||
| -rw-r--r-- | usr.bin/make/hash.c | 12 | ||||
| -rw-r--r-- | usr.bin/make/job.c | 304 | ||||
| -rw-r--r-- | usr.bin/make/main.c | 54 | ||||
| -rw-r--r-- | usr.bin/make/make.c | 52 | ||||
| -rw-r--r-- | usr.bin/make/parse.c | 92 | ||||
| -rw-r--r-- | usr.bin/make/suff.c | 118 | ||||
| -rw-r--r-- | usr.bin/make/targ.c | 32 | ||||
| -rw-r--r-- | usr.bin/make/util.c | 30 | ||||
| -rw-r--r-- | usr.bin/make/var.c | 68 |
15 files changed, 525 insertions, 525 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index c13a86db0e3..1661860dd93 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.44 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: arch.c,v 1.45 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.44 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.45 2005/07/25 22:55:58 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.44 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: arch.c,v 1.45 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -201,7 +201,7 @@ ArchFree(ClientData ap) for (entry = Hash_EnumFirst(&a->members, &search); entry != (Hash_Entry *)NULL; entry = Hash_EnumNext(&search)) - free((Address) Hash_GetValue (entry)); + free((Address)Hash_GetValue(entry)); free(a->name); if (a->fnametab) @@ -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); @@ -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) { @@ -544,23 +544,23 @@ ArchStatMember(char *archive, char *member, Boolean hash) * to point 'member' to the final component, if there is one, to make * the comparisons easier... */ - cp = strrchr (member, '/'); + cp = strrchr(member, '/'); if (cp != (char *) NULL) { member = cp + 1; } 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); if (he != (Hash_Entry *) NULL) { - return ((struct ar_hdr *) Hash_GetValue (he)); + return ((struct ar_hdr *)Hash_GetValue(he)); } else { /* Try truncated name */ char copy[AR_MAX_NAME_LEN+1]; - int len = strlen (member); + int len = strlen(member); if (len > AR_MAX_NAME_LEN) { len = AR_MAX_NAME_LEN; @@ -568,7 +568,7 @@ ArchStatMember(char *archive, char *member, Boolean hash) copy[AR_MAX_NAME_LEN] = '\0'; } if ((he = Hash_FindEntry(&ar->members, copy)) != NULL) - return ((struct ar_hdr *) Hash_GetValue (he)); + return ((struct ar_hdr *)Hash_GetValue(he)); return ((struct ar_hdr *) NULL); } } @@ -597,7 +597,7 @@ ArchStatMember(char *archive, char *member, Boolean hash) * We don't have this archive on the list yet, so we want to find out * everything that's in it and cache it so we can get at it quickly. */ - arch = fopen (archive, "r"); + arch = fopen(archive, "r"); if (arch == (FILE *) NULL) { return ((struct ar_hdr *) NULL); } @@ -606,9 +606,9 @@ ArchStatMember(char *archive, char *member, Boolean hash) * We use the ARMAG string to make sure this is an archive we * can handle... */ - if ((fread (magic, SARMAG, 1, arch) != 1) || - (strncmp (magic, ARMAG, SARMAG) != 0)) { - fclose (arch); + if ((fread(magic, SARMAG, 1, arch) != 1) || + (strncmp(magic, ARMAG, SARMAG) != 0)) { + fclose(arch); return ((struct ar_hdr *) NULL); } @@ -619,8 +619,8 @@ ArchStatMember(char *archive, char *member, Boolean hash) Hash_InitTable(&ar->members, -1); memName[AR_MAX_NAME_LEN] = '\0'; - while (fread ((char *)&arh, sizeof (struct ar_hdr), 1, arch) == 1) { - if (strncmp ( arh.ar_fmag, ARFMAG, sizeof (arh.ar_fmag)) != 0) { + while (fread((char *)&arh, sizeof(struct ar_hdr), 1, arch) == 1) { + if (strncmp( arh.ar_fmag, ARFMAG, sizeof(arh.ar_fmag)) != 0) { /* * The header is bogus, so the archive is bad * and there's no way we can recover... @@ -634,9 +634,9 @@ ArchStatMember(char *archive, char *member, Boolean hash) * 'size' field of the header and round it up during the seek. */ arh.ar_size[sizeof(arh.ar_size)-1] = '\0'; - size = (int) strtol(arh.ar_size, NULL, 10); + size = (int)strtol(arh.ar_size, NULL, 10); - (void) strncpy (memName, arh.ar_name, sizeof(arh.ar_name)); + (void)strncpy(memName, arh.ar_name, sizeof(arh.ar_name)); for (cp = &memName[AR_MAX_NAME_LEN]; *cp == ' '; cp--) { continue; } @@ -677,10 +677,10 @@ ArchStatMember(char *archive, char *member, Boolean hash) if (elen > MAXPATHLEN) goto badarch; - if (fread (memName, elen, 1, arch) != 1) + if (fread(memName, elen, 1, arch) != 1) goto badarch; memName[elen] = '\0'; - fseek (arch, -elen, SEEK_CUR); + fseek(arch, -elen, SEEK_CUR); if (DEBUG(ARCH) || DEBUG(MAKE)) { printf("ArchStat: Extended format entry for %s\n", memName); } @@ -688,16 +688,16 @@ ArchStatMember(char *archive, char *member, Boolean hash) #endif 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)); + Hash_SetValue(he, (ClientData)emalloc(sizeof(struct ar_hdr))); + memcpy((Address)Hash_GetValue(he), (Address)&arh, + sizeof(struct ar_hdr)); } - fseek (arch, (size + 1) & ~1, SEEK_CUR); + fseek(arch, (size + 1) & ~1, SEEK_CUR); } - fclose (arch); + 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 @@ -706,17 +706,17 @@ ArchStatMember(char *archive, char *member, Boolean hash) he = Hash_FindEntry(&ar->members, member); if (he != (Hash_Entry *) NULL) { - return ((struct ar_hdr *) Hash_GetValue (he)); + return ((struct ar_hdr *)Hash_GetValue(he)); } else { return ((struct ar_hdr *) NULL); } badarch: - fclose (arch); + fclose(arch); Hash_DeleteTable(&ar->members); if (ar->fnametab) free(ar->fnametab); - free ((Address)ar); + free((Address)ar); return ((struct ar_hdr *) NULL); } @@ -796,7 +796,7 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE *arch) if (name[1] == ' ' || name[1] == '\0') return 2; - entry = (size_t) strtol(&name[1], &eptr, 0); + entry = (size_t)strtol(&name[1], &eptr, 0); if ((*eptr != ' ' && *eptr != '\0') || eptr == &name[1]) { if (DEBUG(ARCH)) { printf("Could not parse SVR4 name %s\n", name); @@ -815,7 +815,7 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE *arch) printf("Replaced %s with %s\n", name, &ar->fnametab[entry]); } - (void) strncpy(name, &ar->fnametab[entry], MAXPATHLEN); + (void)strncpy(name, &ar->fnametab[entry], MAXPATHLEN); name[MAXPATHLEN] = '\0'; return 1; } @@ -856,7 +856,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr, char magic[SARMAG]; int len, tlen; - arch = fopen (archive, mode); + arch = fopen(archive, mode); if (arch == (FILE *) NULL) { return ((FILE *) NULL); } @@ -865,9 +865,9 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr, * We use the ARMAG string to make sure this is an archive we * can handle... */ - if ((fread (magic, SARMAG, 1, arch) != 1) || - (strncmp (magic, ARMAG, SARMAG) != 0)) { - fclose (arch); + if ((fread(magic, SARMAG, 1, arch) != 1) || + (strncmp(magic, ARMAG, SARMAG) != 0)) { + fclose(arch); return ((FILE *) NULL); } @@ -877,24 +877,24 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr, * to point 'member' to the final component, if there is one, to make * the comparisons easier... */ - cp = strrchr (member, '/'); + cp = strrchr(member, '/'); if (cp != (char *) NULL) { member = cp + 1; } - len = tlen = strlen (member); - if (len > sizeof (arhPtr->ar_name)) { - tlen = sizeof (arhPtr->ar_name); + len = tlen = strlen(member); + if (len > sizeof(arhPtr->ar_name)) { + tlen = sizeof(arhPtr->ar_name); } - while (fread ((char *)arhPtr, sizeof (struct ar_hdr), 1, arch) == 1) { - if (strncmp(arhPtr->ar_fmag, ARFMAG, sizeof (arhPtr->ar_fmag) ) != 0) { + while (fread((char *)arhPtr, sizeof(struct ar_hdr), 1, arch) == 1) { + if (strncmp(arhPtr->ar_fmag, ARFMAG, sizeof(arhPtr->ar_fmag) ) != 0) { /* * The header is bogus, so the archive is bad * and there's no way we can recover... */ - fclose (arch); + fclose(arch); return ((FILE *) NULL); - } else if (strncmp (member, arhPtr->ar_name, tlen) == 0) { + } else if (strncmp(member, arhPtr->ar_name, tlen) == 0) { /* * If the member's name doesn't take up the entire 'name' field, * we have to be careful of matching prefixes. Names are space- @@ -912,7 +912,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr, * the file at the actual member, rather than its header, but * not here... */ - fseek (arch, -sizeof(struct ar_hdr), SEEK_CUR); + fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR); return (arch); } } else @@ -929,11 +929,11 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr, char ename[MAXPATHLEN]; if (elen > MAXPATHLEN) { - fclose (arch); + fclose(arch); return NULL; } - if (fread (ename, elen, 1, arch) != 1) { - fclose (arch); + if (fread(ename, elen, 1, arch) != 1) { + fclose(arch); return NULL; } ename[elen] = '\0'; @@ -942,10 +942,10 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr, } if (strncmp(ename, member, len) == 0) { /* Found as extended name */ - fseek (arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR); + fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR); return (arch); } - fseek (arch, -elen, SEEK_CUR); + fseek(arch, -elen, SEEK_CUR); goto skip; } else #endif @@ -959,8 +959,8 @@ skip: * header and round it up during the seek. */ arhPtr->ar_size[sizeof(arhPtr->ar_size)-1] = '\0'; - size = (int) strtol(arhPtr->ar_size, NULL, 10); - fseek (arch, (size + 1) & ~1, SEEK_CUR); + size = (int)strtol(arhPtr->ar_size, NULL, 10); + fseek(arch, (size + 1) & ~1, SEEK_CUR); } } @@ -968,7 +968,7 @@ skip: * We've looked everywhere, but the member is not to be found. Close the * archive and return NULL -- an error. */ - fclose (arch); + fclose(arch); return ((FILE *) NULL); } @@ -1007,8 +1007,8 @@ Arch_Touch(GNode *gn) snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now); if (arch != (FILE *) NULL) { - (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); - fclose (arch); + (void)fwrite((char *)&arh, sizeof(struct ar_hdr), 1, arch); + fclose(arch); } } @@ -1046,8 +1046,8 @@ Arch_TouchLib(GNode *gn) snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now); if (arch != (FILE *) NULL) { - (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); - fclose (arch); + (void)fwrite((char *)&arh, sizeof(struct ar_hdr), 1, arch); + fclose(arch); times.actime = times.modtime = now; utime(gn->path, ×); @@ -1064,7 +1064,7 @@ Arch_TouchLib(GNode *gn) * gn Node describing archive member * * Results: - * The modification time (seconds). + * The modification time(seconds). * * Side Effects: * The mtime field of the given node is filled in with the value @@ -1088,7 +1088,7 @@ Arch_MTime(GNode *gn) free(p2); if (arhPtr != (struct ar_hdr *) NULL) { - modTime = (time_t) strtol(arhPtr->ar_date, NULL, 10); + modTime = (time_t)strtol(arhPtr->ar_date, NULL, 10); } else { modTime = 0; } @@ -1124,7 +1124,7 @@ Arch_MemMTime(GNode *gn) return (0); } while ((ln = Lst_Next(gn->parents)) != NILLNODE) { - pgn = (GNode *) Lst_Datum(ln); + pgn = (GNode *)Lst_Datum(ln); if (pgn->type & OP_ARCHV) { /* @@ -1134,8 +1134,8 @@ Arch_MemMTime(GNode *gn) * child. We keep searching its parents in case some other * parent requires this child to exist... */ - nameStart = strchr (pgn->name, '(') + 1; - nameEnd = strchr (nameStart, ')'); + nameStart = strchr(pgn->name, '(') + 1; + nameEnd = strchr(nameStart, ')'); if ((pgn->flags & REMAKE) && strncmp(nameStart, gn->name, nameEnd - nameStart) == 0) { @@ -1191,7 +1191,7 @@ Arch_FindLib(GNode *gn, Lst path) gn->path = Dir_FindFile(libName, path); - free (libName); + free(libName); #ifdef LIBRARIES Var_Set(TARGET, gn->name, gn, 0); @@ -1259,7 +1259,7 @@ Arch_LibOODate(GNode *gn) arhPtr = ArchStatMember(gn->path, UNCONST(RANLIBMAG), FALSE); if (arhPtr != (struct ar_hdr *)NULL) { - modTimeTOC = (int) strtol(arhPtr->ar_date, NULL, 10); + modTimeTOC = (int)strtol(arhPtr->ar_date, NULL, 10); if (DEBUG(ARCH) || DEBUG(MAKE)) { printf("%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC)); @@ -1347,11 +1347,11 @@ Arch_IsLib(GNode *gn) return FALSE; if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { - (void) close(fd); + (void)close(fd); return FALSE; } - (void) close(fd); + (void)close(fd); return memcmp(buf, armag, sizeof(buf)) == 0; } diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index 63ab48a505c..49c8e8cef45 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.16 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: buf.c,v 1.17 2005/07/25 22:55:58 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.16 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.17 2005/07/25 22:55:58 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.16 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: buf.c,v 1.17 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -105,7 +105,7 @@ __RCSID("$NetBSD: buf.c,v 1.16 2005/02/16 15:11:52 christos Exp $"); #define BufExpand(bp,nb) \ while (bp->left < (nb)+1) {\ int newSize = (bp)->size * 2; \ - Byte *newBuf = (Byte *) erealloc((bp)->buffer, newSize); \ + Byte *newBuf = (Byte *)erealloc((bp)->buffer, newSize); \ \ (bp)->inPtr = newBuf + ((bp)->inPtr - (bp)->buffer); \ (bp)->outPtr = newBuf + ((bp)->outPtr - (bp)->buffer);\ @@ -134,7 +134,7 @@ Buf_OvAddByte(Buffer bp, int byte) { int nbytes = 1; bp->left = 0; - BufExpand (bp, nbytes); + BufExpand(bp, nbytes); *bp->inPtr++ = byte; bp->left--; @@ -162,9 +162,9 @@ void Buf_AddBytes(Buffer bp, int numBytes, const Byte *bytesPtr) { - BufExpand (bp, numBytes); + BufExpand(bp, numBytes); - memcpy (bp->inPtr, bytesPtr, numBytes); + memcpy(bp->inPtr, bytesPtr, numBytes); bp->inPtr += numBytes; bp->left -= numBytes; @@ -302,9 +302,9 @@ Buf_Destroy(Buffer buf, Boolean freeData) { if (freeData) { - free ((char *)buf->buffer); + free((char *)buf->buffer); } - free ((char *)buf); + free((char *)buf); } /*- diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index ef14341fcbd..8dddeeb989d 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.58 2005/05/08 04:19:12 christos Exp $ */ +/* $NetBSD: compat.c,v 1.59 2005/07/25 22:55:58 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.58 2005/05/08 04:19:12 christos Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.59 2005/07/25 22:55:58 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.58 2005/05/08 04:19:12 christos Exp $"); +__RCSID("$NetBSD: compat.c,v 1.59 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -180,7 +180,7 @@ CompatInterrupt(int signo) } } - exit (signo); + exit(signo); } /*- @@ -296,7 +296,7 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) * this one. We also print the command if -n given. */ if (!silent || NoExecute(gn)) { - printf ("%s\n", cmd); + printf("%s\n", cmd); fflush(stdout); } @@ -390,13 +390,13 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) cp++; } } - printf ("\n"); + printf("\n"); } - printf ("*** Error code %d", status); + printf("*** Error code %d", status); } } else { status = WTERMSIG(reason); /* signaled */ - printf ("*** Signal %d", status); + printf("*** Signal %d", status); } @@ -408,14 +408,14 @@ CompatRunCommand(ClientData cmdp, ClientData gnp) * Abort the current target, but let others * continue. */ - printf (" (continuing)\n"); + printf(" (continuing)\n"); } } else { /* * Continue executing commands for this target. * If we return 0, this will happen... */ - printf (" (ignored)\n"); + printf(" (ignored)\n"); status = 0; } } @@ -506,7 +506,7 @@ Compat_Make(ClientData gnp, ClientData pgnp) * to tell him/her "yes". */ if (queryFlag) { - exit (1); + exit(1); } /* @@ -560,7 +560,7 @@ Compat_Make(ClientData gnp, ClientData pgnp) pgn->flags &= ~REMAKE; } else { PrintOnError("\n\nStop."); - exit (1); + exit(1); } } else if (gn->made == ERROR) { /* @@ -674,13 +674,13 @@ Compat_Run(Lst targs) */ errors = 0; while (!Lst_IsEmpty (targs)) { - gn = (GNode *) Lst_DeQueue(targs); + gn = (GNode *)Lst_DeQueue(targs); Compat_Make(gn, gn); if (gn->made == UPTODATE) { - printf ("`%s' is up to date.\n", gn->name); + printf("`%s' is up to date.\n", gn->name); } else if (gn->made == ABORTED) { - printf ("`%s' not remade because of errors.\n", gn->name); + printf("`%s' not remade because of errors.\n", gn->name); errors += 1; } } diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index e2ec65f52ac..b503802c3dd 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.27 2005/06/02 02:03:19 lukem Exp $ */ +/* $NetBSD: cond.c,v 1.28 2005/07/25 22:55:58 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.27 2005/06/02 02:03:19 lukem Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.28 2005/07/25 22:55:58 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.27 2005/06/02 02:03:19 lukem Exp $"); +__RCSID("$NetBSD: cond.c,v 1.28 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -1075,7 +1075,7 @@ CondF(Boolean doEval) if (l == True) { l = CondF(doEval); } else { - (void) CondF(FALSE); + (void)CondF(FALSE); } } else { /* @@ -1122,7 +1122,7 @@ CondE(Boolean doEval) if (l == False) { l = CondE(doEval); } else { - (void) CondE(FALSE); + (void)CondE(FALSE); } } else { /* diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index b77bd80d7a0..2024dcb22ad 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.45 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: dir.c,v 1.46 2005/07/25 22:55:58 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.45 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.46 2005/07/25 22:55:58 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.45 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: dir.c,v 1.46 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -330,7 +330,7 @@ Dir_InitDot(void) /* Remove old entry from openDirectories, but do not destroy. */ ln = Lst_Member(openDirectories, (ClientData)dot); - (void) Lst_Remove(openDirectories, ln); + (void)Lst_Remove(openDirectories, ln); } dot = Dir_AddDir(NULL, "."); @@ -396,7 +396,7 @@ Dir_SetPATH(void) if (Lst_Open(dirSearchPath) == SUCCESS) { if ((ln = Lst_First(dirSearchPath)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); if (p == dotLast) { hasLastDot = TRUE; Var_Append(".PATH", dotLast->name, VAR_GLOBAL); @@ -411,7 +411,7 @@ Dir_SetPATH(void) } while ((ln = Lst_Next(dirSearchPath)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); if (p == dotLast) continue; if (p == dot && hasLastDot) @@ -450,7 +450,7 @@ Dir_SetPATH(void) static int DirFindName(ClientData p, ClientData dname) { - return (strcmp (((Path *)p)->name, (char *) dname)); + return (strcmp(((Path *)p)->name, (char *) dname)); } /*- @@ -812,7 +812,7 @@ Dir_Expand(const char *word, Lst path, Lst expansions) if (*dp == '/') *dp = '\0'; path = Lst_Init(FALSE); - (void) Dir_AddDir(path, dirpath); + (void)Dir_AddDir(path, dirpath); DirExpandInt(cp+1, path, expansions); Lst_Destroy(path, NOFREE); } @@ -916,7 +916,7 @@ DirLookupSubdir(Path *p, const char *name) printf("checking %s ...\n", file); } - if (stat (file, &stb) == 0) { + if (stat(file, &stb) == 0) { /* * Save the modification time so if it's needed, we don't have * to fetch it again. @@ -931,7 +931,7 @@ DirLookupSubdir(Path *p, const char *name) nearmisses += 1; return (file); } - free (file); + free(file); return NULL; } @@ -1065,7 +1065,7 @@ Dir_FindFile(const char *name, Lst path) * Find the final component of the name and note whether it has a * slash in it (the name, I mean) */ - cp = strrchr (name, '/'); + cp = strrchr(name, '/'); if (cp) { hasSlash = TRUE; cp += 1; @@ -1087,7 +1087,7 @@ Dir_FindFile(const char *name, Lst path) } if ((ln = Lst_First(path)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); if (p == dotLast) { hasLastDot = TRUE; if (DEBUG(DIR)) @@ -1125,7 +1125,7 @@ Dir_FindFile(const char *name, Lst path) } while ((ln = Lst_Next(path)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); if (p == dotLast) continue; if ((file = DirLookup(p, name, cp, hasSlash)) != NULL) { @@ -1181,9 +1181,9 @@ Dir_FindFile(const char *name, Lst path) return file; } - (void) Lst_Open(path); + (void)Lst_Open(path); while ((ln = Lst_Next(path)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); if (p == dotLast) continue; if (p == dot) { @@ -1237,9 +1237,9 @@ Dir_FindFile(const char *name, Lst path) if (!hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL) return *file?file:NULL; - (void) Lst_Open(path); + (void)Lst_Open(path); while ((ln = Lst_Next(path)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); if (p == dotLast) continue; if ((file = DirLookupAbs(p, name, cp)) != NULL) { @@ -1272,7 +1272,7 @@ 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; @@ -1280,7 +1280,7 @@ Dir_FindFile(const char *name, Lst 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) { @@ -1300,7 +1300,7 @@ Dir_FindFile(const char *name, Lst path) printf(" got it (in mtime cache)\n"); } return(estrdup(name)); - } else if (stat (name, &stb) == 0) { + } else if (stat(name, &stb) == 0) { entry = Hash_CreateEntry(&mtimes, name, (Boolean *)NULL); if (DEBUG(DIR)) { printf(" Caching %s for %s\n", Targ_FmtTime(stb.st_mtime), @@ -1452,7 +1452,7 @@ Dir_MTime(GNode *gn) } stb.st_mtime = (time_t)(long)Hash_GetValue(entry); Hash_DeleteEntry(&mtimes, entry); - } else if (stat (fullName, &stb) < 0) { + } else if (stat(fullName, &stb) < 0) { if (gn->type & OP_MEMBER) { if (fullName != gn->path) free(fullName); @@ -1500,7 +1500,7 @@ Dir_AddDir(Lst path, const char *name) if (strcmp(name, ".DOTLAST") == 0) { ln = Lst_Find(path, (ClientData)UNCONST(name), DirFindName); if (ln != NILLNODE) - return (Path *) Lst_Datum(ln); + return (Path *)Lst_Datum(ln); else { dotLast->refCount += 1; (void)Lst_AtFront(path, (ClientData)dotLast); @@ -1510,10 +1510,10 @@ Dir_AddDir(Lst path, const char *name) if (path) ln = Lst_Find(openDirectories, (ClientData)UNCONST(name), DirFindName); if (ln != NILLNODE) { - p = (Path *)Lst_Datum (ln); + p = (Path *)Lst_Datum(ln); if (Lst_Member(path, (ClientData)p) == NILLNODE) { p->refCount += 1; - (void)Lst_AtEnd (path, (ClientData)p); + (void)Lst_AtEnd(path, (ClientData)p); } } else { if (DEBUG(DIR)) { @@ -1521,14 +1521,14 @@ Dir_AddDir(Lst path, const char *name) fflush(stdout); } - if ((d = opendir (name)) != (DIR *) NULL) { + if ((d = opendir(name)) != (DIR *) NULL) { p = emalloc(sizeof(Path)); p->name = estrdup(name); p->hits = 0; p->refCount = 1; Hash_InitTable(&p->files, -1); - while ((dp = readdir (d)) != (struct dirent *) NULL) { + while ((dp = readdir(d)) != (struct dirent *) NULL) { #if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */ /* * The sun directory library doesn't check for a 0 inode @@ -1541,10 +1541,10 @@ Dir_AddDir(Lst path, const char *name) #endif /* sun && d_ino */ (void)Hash_CreateEntry(&p->files, dp->d_name, (Boolean *)NULL); } - (void) closedir (d); - (void)Lst_AtEnd (openDirectories, (ClientData)p); + (void)closedir(d); + (void)Lst_AtEnd(openDirectories, (ClientData)p); if (path != NULL) - (void)Lst_AtEnd (path, (ClientData)p); + (void)Lst_AtEnd(path, (ClientData)p); } if (DEBUG(DIR)) { printf("done\n"); @@ -1608,7 +1608,7 @@ Dir_MakeFlags(const char *flag, Lst path) if (Lst_Open(path) == SUCCESS) { while ((ln = Lst_Next(path)) != NILLNODE) { - p = (Path *) Lst_Datum(ln); + p = (Path *)Lst_Datum(ln); s2 = str_concat(flag, p->name, 0); str = str_concat(s1 = str, s2, STR_ADDSPACE); free(s1); @@ -1648,7 +1648,7 @@ Dir_Destroy(ClientData pp) LstNode ln; ln = Lst_Member(openDirectories, (ClientData)p); - (void) Lst_Remove(openDirectories, ln); + (void)Lst_Remove(openDirectories, ln); Hash_DeleteTable(&p->files); free((Address)p->name); @@ -1724,16 +1724,16 @@ Dir_PrintDirectories(void) LstNode ln; Path *p; - printf ("#*** Directory Cache:\n"); - printf ("# Stats: %d hits %d misses %d near misses %d losers (%d%%)\n", + printf("#*** Directory Cache:\n"); + printf("# Stats: %d hits %d misses %d near misses %d losers (%d%%)\n", hits, misses, nearmisses, bigmisses, (hits+bigmisses+nearmisses ? hits * 100 / (hits + bigmisses + nearmisses) : 0)); - printf ("# %-20s referenced\thits\n", "directory"); + printf("# %-20s referenced\thits\n", "directory"); 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); + p = (Path *)Lst_Datum(ln); + printf("# %-20s %10d\t%4d\n", p->name, p->refCount, p->hits); } Lst_Close(openDirectories); } @@ -1742,7 +1742,7 @@ Dir_PrintDirectories(void) static int DirPrintDir(ClientData p, ClientData dummy) { - printf ("%s ", ((Path *) p)->name); + printf("%s ", ((Path *) p)->name); return (dummy ? 0 : 0); } diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index 5a471ad8e08..c9b9472b7dc 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.18 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: for.c,v 1.19 2005/07/25 22:55:58 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.18 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: for.c,v 1.19 2005/07/25 22:55:58 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.18 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: for.c,v 1.19 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -118,7 +118,7 @@ ForAddVar(const char *data, size_t len) accumFor.nvars++; accumFor.vars = erealloc(accumFor.vars, accumFor.nvars*sizeof(char *)); - accumFor.vars[accumFor.nvars-1] = (char *) Buf_GetAll(buf, &varlen); + accumFor.vars[accumFor.nvars-1] = (char *)Buf_GetAll(buf, &varlen); Buf_Destroy(buf, FALSE); } @@ -228,7 +228,7 @@ For_Eval(char *line) #define ADDWORD() \ Buf_AddBytes(buf, ptr - wrd, (Byte *) wrd), \ Buf_AddByte(buf, (Byte) '\0'), \ - Lst_AtFront(accumFor.lst, (ClientData) Buf_GetAll(buf, &varlen)), \ + Lst_AtFront(accumFor.lst, (ClientData)Buf_GetAll(buf, &varlen)), \ Buf_Destroy(buf, FALSE) for (ptr = sub; *ptr && isspace((unsigned char) *ptr); ptr++) @@ -245,9 +245,9 @@ For_Eval(char *line) if (DEBUG(FOR)) { int i; for (i = 0; i < accumFor.nvars; i++) { - (void) fprintf(stderr, "For: variable %s\n", accumFor.vars[i]); + (void)fprintf(stderr, "For: variable %s\n", accumFor.vars[i]); } - (void) fprintf(stderr, "For: list %s\n", sub); + (void)fprintf(stderr, "For: list %s\n", sub); } if (ptr - wrd > 0) ADDWORD(); @@ -267,7 +267,7 @@ For_Eval(char *line) if (strncmp(ptr, "endfor", 6) == 0 && (isspace((unsigned char) ptr[6]) || !ptr[6])) { if (DEBUG(FOR)) - (void) fprintf(stderr, "For: end for %d\n", forLevel); + (void)fprintf(stderr, "For: end for %d\n", forLevel); if (--forLevel < 0) { Parse_Error(level, "for-less endfor"); return 0; @@ -277,7 +277,7 @@ For_Eval(char *line) isspace((unsigned char) ptr[3])) { forLevel++; if (DEBUG(FOR)) - (void) fprintf(stderr, "For: new loop %d\n", forLevel); + (void)fprintf(stderr, "For: new loop %d\n", forLevel); } } @@ -342,7 +342,7 @@ For_Run(int lineno) done = 1; break; } else { - values[i] = (char *) Lst_Datum(ln); + values[i] = (char *)Lst_Datum(ln); } } if (done) @@ -351,7 +351,7 @@ For_Run(int lineno) for (i = 0; i < arg.nvars; i++) { Var_Set(arg.vars[i], values[i], VAR_GLOBAL, 0); if (DEBUG(FOR)) - (void) fprintf(stderr, "--- %s = %s\n", arg.vars[i], + (void)fprintf(stderr, "--- %s = %s\n", arg.vars[i], values[i]); } @@ -364,7 +364,7 @@ For_Run(int lineno) * not right away. (XXX) */ - guy = (char *) Buf_GetAll(arg.buf, &len); + guy = (char *)Buf_GetAll(arg.buf, &len); orig_guy = guy; for (i = 0; i < arg.nvars; i++) { old_guy = guy; diff --git a/usr.bin/make/hash.c b/usr.bin/make/hash.c index 309142dcd8d..80fd3c690c1 100644 --- a/usr.bin/make/hash.c +++ b/usr.bin/make/hash.c @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.14 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: hash.c,v 1.15 2005/07/25 22:55:58 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.14 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: hash.c,v 1.15 2005/07/25 22:55:58 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.14 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: hash.c,v 1.15 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -293,7 +293,7 @@ Hash_CreateEntry(Hash_Table *t, const char *key, Boolean *newPtr) *hp = e; e->clientData = NULL; e->namehash = h; - (void) strcpy(e->name, p); + (void)strcpy(e->name, p); t->numEntries++; if (newPtr != NULL) @@ -334,7 +334,7 @@ Hash_DeleteEntry(Hash_Table *t, Hash_Entry *e) return; } } - (void) write(2, "bad call to Hash_DeleteEntry\n", 29); + (void)write(2, "bad call to Hash_DeleteEntry\n", 29); abort(); } @@ -448,7 +448,7 @@ RebuildTable(Hash_Table *t) i <<= 1; t->size = i; t->mask = mask = i - 1; - t->bucketPtr = hp = (struct Hash_Entry **) emalloc(sizeof(*hp) * i); + t->bucketPtr = hp = (struct Hash_Entry **)emalloc(sizeof(*hp) * i); while (--i >= 0) *hp++ = NULL; for (hp = oldhp, i = oldsize; --i >= 0;) { diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 5fbaab7e6e8..d93908f2f15 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.95 2005/06/29 19:59:42 christos Exp $ */ +/* $NetBSD: job.c,v 1.96 2005/07/25 22:55:58 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.95 2005/06/29 19:59:42 christos Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.96 2005/07/25 22:55:58 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.95 2005/06/29 19:59:42 christos Exp $"); +__RCSID("$NetBSD: job.c,v 1.96 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -304,11 +304,11 @@ int exit_pipe[2] = { -1, -1 }; /* child exit signal pipe. */ #ifdef REMOTE # define TARG_FMT "--- %s at %s ---\n" /* Default format */ # define MESSAGE(fp, gn) \ - (void) fprintf(fp, targFmt, gn->name, gn->rem.hname) + (void)fprintf(fp, targFmt, gn->name, gn->rem.hname) #else # define TARG_FMT "--- %s ---\n" /* Default format */ # define MESSAGE(fp, gn) \ - (void) fprintf(fp, targFmt, gn->name) + (void)fprintf(fp, targFmt, gn->name) #endif /* @@ -396,7 +396,7 @@ static void JobSigLock(sigset_t *omaskp) static void JobSigUnlock(sigset_t *omaskp) { - (void) sigprocmask(SIG_SETMASK, omaskp, NULL); + (void)sigprocmask(SIG_SETMASK, omaskp, NULL); } /*- @@ -434,10 +434,10 @@ JobCondPassSig(ClientData jobp, ClientData signop) * job as well. */ if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "JobCondPassSig passing signal %d to child %d.\n", signo, job->pid); - (void) fflush(stdout); + (void)fflush(stdout); } KILL(job->pid, signo); #endif @@ -517,8 +517,8 @@ JobPassSig(int signo) int sigcont; if (DEBUG(JOB)) { - (void) fprintf(stdout, "JobPassSig(%d) called.\n", signo); - (void) fflush(stdout); + (void)fprintf(stdout, "JobPassSig(%d) called.\n", signo); + (void)fflush(stdout); } Lst_ForEach(jobs, JobCondPassSig, (ClientData) &signo); @@ -551,20 +551,20 @@ JobPassSig(int signo) */ sigfillset(&nmask); sigdelset(&nmask, signo); - (void) sigprocmask(SIG_SETMASK, &nmask, &omask); + (void)sigprocmask(SIG_SETMASK, &nmask, &omask); act.sa_handler = SIG_DFL; sigemptyset(&act.sa_mask); act.sa_flags = 0; - (void) sigaction(signo, &act, NULL); + (void)sigaction(signo, &act, NULL); if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "JobPassSig passing signal %d to self.\n", signo); - (void) fflush(stdout); + (void)fflush(stdout); } - (void) kill(getpid(), signo); + (void)kill(getpid(), signo); if (signo != SIGTSTP) { sigcont = SIGCONT; Lst_ForEach(jobs, JobCondPassSig, (ClientData) &sigcont); @@ -572,8 +572,8 @@ JobPassSig(int signo) /* Restore handler and signal mask */ act.sa_handler = JobPassSig; - (void) sigaction(signo, &act, NULL); - (void) sigprocmask(SIG_SETMASK, &omask, NULL); + (void)sigaction(signo, &act, NULL); + (void)sigprocmask(SIG_SETMASK, &omask, NULL); } /*- @@ -689,11 +689,11 @@ JobPrintCommand(ClientData cmdp, ClientData jobp) } #define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \ - (void) fprintf(stdout, fmt, arg); \ - (void) fflush(stdout); \ + (void)fprintf(stdout, fmt, arg); \ + (void)fflush(stdout); \ } \ - (void) fprintf(job->cmdFILE, fmt, arg); \ - (void) fflush(job->cmdFILE); + (void)fprintf(job->cmdFILE, fmt, arg); \ + (void)fflush(job->cmdFILE); numCommands += 1; @@ -893,8 +893,8 @@ JobPrintCommand(ClientData cmdp, ClientData jobp) static int JobSaveCommand(ClientData cmd, ClientData gn) { - cmd = (ClientData) Var_Subst(NULL, (char *) cmd, (GNode *) gn, FALSE); - (void) Lst_AtEnd(postCommands->commands, cmd); + cmd = (ClientData)Var_Subst(NULL, (char *) cmd, (GNode *) gn, FALSE); + (void)Lst_AtEnd(postCommands->commands, cmd); return(0); } @@ -922,12 +922,12 @@ JobClose(Job *job) clearfd(job); #endif if (job->outPipe != job->inPipe) { - (void) close(job->outPipe); + (void)close(job->outPipe); } JobDoOutput(job, TRUE); - (void) close(job->inPipe); + (void)close(job->inPipe); } else { - (void) close(job->outFd); + (void)close(job->outFd); JobDoOutput(job, TRUE); } } @@ -981,7 +981,7 @@ JobFinish(Job *job, int *status) #endif JobClose(job); if (job->cmdFILE != NULL && job->cmdFILE != stdout) { - (void) fclose(job->cmdFILE); + (void)fclose(job->cmdFILE); job->cmdFILE = NULL; } done = TRUE; @@ -1037,16 +1037,16 @@ JobFinish(Job *job, int *status) if (WIFEXITED(*status)) { if (DEBUG(JOB)) { - (void) fprintf(stdout, "Process %d [%s] exited.\n", + (void)fprintf(stdout, "Process %d [%s] exited.\n", job->pid, job->node->name); - (void) fflush(stdout); + (void)fflush(stdout); } if (WEXITSTATUS(*status) != 0) { if (usePipes && job->node != lastNode) { MESSAGE(out, job->node); lastNode = job->node; } - (void) fprintf(out, "*** [%s] Error code %d%s\n", + (void)fprintf(out, "*** [%s] Error code %d%s\n", job->node->name, WEXITSTATUS(*status), (job->flags & JOB_IGNERR) ? "(ignored)" : ""); @@ -1059,14 +1059,14 @@ JobFinish(Job *job, int *status) MESSAGE(out, job->node); lastNode = job->node; } - (void) fprintf(out, "*** [%s] Completed successfully\n", + (void)fprintf(out, "*** [%s] Completed successfully\n", job->node->name); } } else if (WIFSTOPPED(*status) && WSTOPSIG(*status) != SIGCONT) { if (DEBUG(JOB)) { - (void) fprintf(stdout, "Process %d (%s) stopped.\n", + (void)fprintf(stdout, "Process %d (%s) stopped.\n", job->pid, job->node->name); - (void) fflush(stdout); + (void)fflush(stdout); } if (usePipes && job->node != lastNode) { MESSAGE(out, job->node); @@ -1075,15 +1075,15 @@ JobFinish(Job *job, int *status) if (!(job->flags & JOB_REMIGRATE)) { switch (WSTOPSIG(*status)) { case SIGTSTP: - (void) fprintf(out, "*** [%s] Suspended\n", + (void)fprintf(out, "*** [%s] Suspended\n", job->node->name); break; case SIGSTOP: - (void) fprintf(out, "*** [%s] Stopped\n", + (void)fprintf(out, "*** [%s] Stopped\n", job->node->name); break; default: - (void) fprintf(out, "*** [%s] Stopped -- signal %d\n", + (void)fprintf(out, "*** [%s] Stopped -- signal %d\n", job->node->name, WSTOPSIG(*status)); } } @@ -1093,7 +1093,7 @@ JobFinish(Job *job, int *status) if (job->flags & JOB_REMIGRATE) JobRestart(job); #endif - (void) fflush(out); + (void)fflush(out); return; } else if (WIFSTOPPED(*status) && WSTOPSIG(*status) == SIGCONT) { /* @@ -1106,14 +1106,14 @@ JobFinish(Job *job, int *status) MESSAGE(out, job->node); lastNode = job->node; } - (void) fprintf(out, "*** [%s] Continued\n", job->node->name); + (void)fprintf(out, "*** [%s] Continued\n", job->node->name); } if (!(job->flags & JOB_CONTINUING)) { if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "Warning: process %d [%s] was not continuing.\n", job->pid, job->node->name); - (void) fflush(stdout); + (void)fflush(stdout); } #ifdef notdef /* @@ -1130,25 +1130,25 @@ JobFinish(Job *job, int *status) nJobs += 1; if (!(job->flags & JOB_REMOTE)) { if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "Process %d is continuing locally.\n", job->pid); - (void) fflush(stdout); + (void)fflush(stdout); } nLocal += 1; } - (void) fflush(out); + (void)fflush(out); return; } else { if (usePipes && job->node != lastNode) { MESSAGE(out, job->node); lastNode = job->node; } - (void) fprintf(out, "*** [%s] Signal %d\n", + (void)fprintf(out, "*** [%s] Signal %d\n", job->node->name, WTERMSIG(*status)); } - (void) fflush(out); + (void)fflush(out); } /* @@ -1272,8 +1272,8 @@ Job_Touch(GNode *gn, Boolean silent) } if (!silent || NoExecute(gn)) { - (void) fprintf(stdout, "touch %s\n", gn->name); - (void) fflush(stdout); + (void)fprintf(stdout, "touch %s\n", gn->name); + (void)fflush(stdout); } if (NoExecute(gn)) { @@ -1299,15 +1299,15 @@ Job_Touch(GNode *gn, Boolean silent) * modification time, then close the file. */ if (read(streamID, &c, 1) == 1) { - (void) lseek(streamID, (off_t)0, SEEK_SET); - (void) write(streamID, &c, 1); + (void)lseek(streamID, (off_t)0, SEEK_SET); + (void)write(streamID, &c, 1); } - (void) close(streamID); + (void)close(streamID); } else { - (void) fprintf(stdout, "*** couldn't touch %s: %s", + (void)fprintf(stdout, "*** couldn't touch %s: %s", file, strerror(errno)); - (void) fflush(stdout); + (void)fflush(stdout); } } } @@ -1366,13 +1366,13 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...)) static const char msg[] = ": don't know how to make"; if (gn->type & OP_OPTIONAL) { - (void) fprintf(stdout, "%s%s %s(ignored)\n", progname, + (void)fprintf(stdout, "%s%s %s(ignored)\n", progname, msg, gn->name); - (void) fflush(stdout); + (void)fflush(stdout); } else if (keepgoing) { - (void) fprintf(stdout, "%s%s %s(continuing)\n", progname, + (void)fprintf(stdout, "%s%s %s(continuing)\n", progname, msg, gn->name); - (void) fflush(stdout); + (void)fflush(stdout); return FALSE; } else { (*abortProc)("%s%s %s. Stop", progname, msg, gn->name); @@ -1437,14 +1437,14 @@ JobExec(Job *job, char **argv) if (DEBUG(JOB)) { int i; - (void) fprintf(stdout, "Running %s %sly\n", job->node->name, + (void)fprintf(stdout, "Running %s %sly\n", job->node->name, job->flags&JOB_REMOTE?"remote":"local"); - (void) fprintf(stdout, "\tCommand: "); + (void)fprintf(stdout, "\tCommand: "); for (i = 0; argv[i] != NULL; i++) { - (void) fprintf(stdout, "%s ", argv[i]); + (void)fprintf(stdout, "%s ", argv[i]); } - (void) fprintf(stdout, "\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "\n"); + (void)fflush(stdout); } /* @@ -1491,8 +1491,8 @@ JobExec(Job *job, char **argv) execError("dup2", "job->cmdFILE"); _exit(1); } - (void) fcntl(0, F_SETFD, 0); - (void) lseek(0, (off_t)0, SEEK_SET); + (void)fcntl(0, F_SETFD, 0); + (void)lseek(0, (off_t)0, SEEK_SET); if (job->node->type & OP_MAKE) { /* @@ -1524,11 +1524,11 @@ JobExec(Job *job, char **argv) } /* * The output channels are marked close on exec. This bit was - * duplicated by the dup2 (on some systems), so we have to clear + * duplicated by the dup2(on some systems), so we have to clear * it before routing the shell's error output to the same place as * its standard output. */ - (void) fcntl(1, F_SETFD, 0); + (void)fcntl(1, F_SETFD, 0); if (dup2(1, 2) == -1) { execError("dup2", "1, 2"); _exit(1); @@ -1543,7 +1543,7 @@ JobExec(Job *job, char **argv) # if defined(SYSV) (void) setsid(); # else - (void) setpgid(0, getpid()); + (void)setpgid(0, getpid()); # endif #endif /* USE_PGRP */ @@ -1553,7 +1553,7 @@ JobExec(Job *job, char **argv) } else #endif /* REMOTE */ { - (void) execv(shellPath, argv); + (void)execv(shellPath, argv); execError("exec", shellPath); } _exit(1); @@ -1589,7 +1589,7 @@ JobExec(Job *job, char **argv) * XXX: Used to not happen if REMOTE. Why? */ if (job->cmdFILE != NULL && job->cmdFILE != stdout) { - (void) fclose(job->cmdFILE); + (void)fclose(job->cmdFILE); job->cmdFILE = NULL; } } @@ -1606,7 +1606,7 @@ jobExecFinish: job->node->name, job->pid); } nJobs += 1; - (void) Lst_AtEnd(jobs, (ClientData)job); + (void)Lst_AtEnd(jobs, (ClientData)job); JobSigUnlock(&mask); } @@ -1689,16 +1689,16 @@ JobRestart(Job *job) verboseRemigrates || #endif DEBUG(JOB)) { - (void) fprintf(stdout, "*** remigrating %x(%s)\n", + (void)fprintf(stdout, "*** remigrating %x(%s)\n", job->pid, job->node->name); - (void) fflush(stdout); + (void)fflush(stdout); } #ifdef REMOTE if (!Rmt_ReExport(job->pid, job->node, &host)) { if (verboseRemigrates || DEBUG(JOB)) { - (void) fprintf(stdout, "*** couldn't migrate...\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "*** couldn't migrate...\n"); + (void)fflush(stdout); } #endif if (nLocal != maxLocal) { @@ -1712,8 +1712,8 @@ JobRestart(Job *job) verboseRemigrates || #endif DEBUG(JOB)) { - (void) fprintf(stdout, "*** resuming on local machine\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "*** resuming on local machine\n"); + (void)fflush(stdout); } KILL(job->pid, SIGCONT); nLocal +=1; @@ -1733,8 +1733,8 @@ JobRestart(Job *job) verboseRemigrates || #endif DEBUG(JOB)) { - (void) fprintf(stdout, "*** holding\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "*** holding\n"); + (void)fflush(stdout); } (void)Lst_AtFront(stoppedJobs, (ClientData)job); return 1; @@ -1768,8 +1768,8 @@ JobRestart(Job *job) JobMakeArgv(job, argv); if (DEBUG(JOB)) { - (void) fprintf(stdout, "Restarting %s...", job->node->name); - (void) fflush(stdout); + (void)fprintf(stdout, "Restarting %s...", job->node->name); + (void)fflush(stdout); } #ifdef REMOTE if ((job->node->type & OP_NOEXPORT) || @@ -1788,8 +1788,8 @@ JobRestart(Job *job) * back on the hold queue and mark the table full */ if (DEBUG(JOB)) { - (void) fprintf(stdout, "holding\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "holding\n"); + (void)fflush(stdout); } (void)Lst_AtFront(stoppedJobs, (ClientData)job); return 1; @@ -1798,8 +1798,8 @@ JobRestart(Job *job) * Job may be run locally. */ if (DEBUG(JOB)) { - (void) fprintf(stdout, "running locally\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "running locally\n"); + (void)fflush(stdout); } job->flags &= ~JOB_REMOTE; } @@ -1810,8 +1810,8 @@ JobRestart(Job *job) * Can be exported. Hooray! */ if (DEBUG(JOB)) { - (void) fprintf(stdout, "exporting\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "exporting\n"); + (void)fflush(stdout); } job->flags |= JOB_REMOTE; } @@ -1823,8 +1823,8 @@ JobRestart(Job *job) * we don't know... */ if (DEBUG(JOB)) { - (void) fprintf(stdout, "Resuming %s...", job->node->name); - (void) fflush(stdout); + (void)fprintf(stdout, "Resuming %s...", job->node->name); + (void)fflush(stdout); } if ((nJobs != maxJobs) && ((job->flags & JOB_REMOTE) || @@ -1864,8 +1864,8 @@ JobRestart(Job *job) job->flags &= ~(JOB_RESUME|JOB_CONTINUING); if (DEBUG(JOB)) { - (void) fprintf(stdout, "done\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "done\n"); + (void)fflush(stdout); } } else { Error("couldn't resume %s: %s", @@ -1879,10 +1879,10 @@ JobRestart(Job *job) * place the job back on the list of stopped jobs. */ if (DEBUG(JOB)) { - (void) fprintf(stdout, "table full\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "table full\n"); + (void)fflush(stdout); } - (void) Lst_AtFront(stoppedJobs, (ClientData)job); + (void)Lst_AtFront(stoppedJobs, (ClientData)job); return 1; } } @@ -1993,14 +1993,14 @@ JobStart(GNode *gn, int flags, Job *previous) if ((tfd = mkstemp(tfile)) == -1) Punt("Could not create temporary file %s", strerror(errno)); if (!DEBUG(SCRIPT)) - (void) eunlink(tfile); + (void)eunlink(tfile); JobSigUnlock(&mask); job->cmdFILE = fdopen(tfd, "w+"); if (job->cmdFILE == NULL) { Punt("Could not fdopen %s", tfile); } - (void) fcntl(FILENO(job->cmdFILE), F_SETFD, 1); + (void)fcntl(FILENO(job->cmdFILE), F_SETFD, 1); /* * Send the commands to the command file, flush all its buffers then * rewind and remove the thing. @@ -2026,7 +2026,7 @@ JobStart(GNode *gn, int flags, Job *previous) LstNode ln = Lst_Next(gn->commands); if ((ln == NILLNODE) || - JobPrintCommand((ClientData) Lst_Datum(ln), + JobPrintCommand((ClientData)Lst_Datum(ln), (ClientData) job)) { noExec = TRUE; @@ -2105,11 +2105,11 @@ JobStart(GNode *gn, int flags, Job *previous) */ if (job->cmdFILE != stdout) { if (job->cmdFILE != NULL) { - (void) fclose(job->cmdFILE); + (void)fclose(job->cmdFILE); job->cmdFILE = NULL; } } else { - (void) fflush(stdout); + (void)fflush(stdout); } /* @@ -2135,7 +2135,7 @@ JobStart(GNode *gn, int flags, Job *previous) return(JOB_ERROR); } } else { - (void) fflush(job->cmdFILE); + (void)fflush(job->cmdFILE); } /* @@ -2156,14 +2156,14 @@ JobStart(GNode *gn, int flags, Job *previous) Punt("Cannot create pipe: %s", strerror(errno)); job->inPipe = fd[0]; job->outPipe = fd[1]; - (void) fcntl(job->inPipe, F_SETFD, 1); - (void) fcntl(job->outPipe, F_SETFD, 1); + (void)fcntl(job->inPipe, F_SETFD, 1); + (void)fcntl(job->outPipe, F_SETFD, 1); } else { - (void) fprintf(stdout, "Remaking `%s'\n", gn->name); - (void) fflush(stdout); - (void) strcpy(job->outFile, TMPPAT); + (void)fprintf(stdout, "Remaking `%s'\n", gn->name); + (void)fflush(stdout); + (void)strcpy(job->outFile, TMPPAT); job->outFd = mkstemp(job->outFile); - (void) fcntl(job->outFd, F_SETFD, 1); + (void)fcntl(job->outFd, F_SETFD, 1); } } @@ -2200,7 +2200,7 @@ JobStart(GNode *gn, int flags, Job *previous) * be run locally if maxLocal is 0. */ job->flags |= JOB_RESTART; - (void) Lst_AtEnd(stoppedJobs, (ClientData)job); + (void)Lst_AtEnd(stoppedJobs, (ClientData)job); } else { JobExec(job, argv); } @@ -2227,8 +2227,8 @@ JobOutput(Job *job, char *cp, char *endp, int msg) * however, since the non-printable comes after it, * there must be a newline, so we don't print one. */ - (void) fprintf(stdout, "%s", cp); - (void) fflush(stdout); + (void)fprintf(stdout, "%s", cp); + (void)fflush(stdout); } cp = ecp + commandShell->noPLen; if (cp != endp) { @@ -2385,13 +2385,13 @@ end_loop: MESSAGE(stdout, job->node); lastNode = job->node; } - (void) fprintf(stdout, "%s%s", cp, gotNL ? "\n" : ""); - (void) fflush(stdout); + (void)fprintf(stdout, "%s%s", cp, gotNL ? "\n" : ""); + (void)fflush(stdout); } } if (i < max - 1) { /* shift the remaining characters down */ - (void) memcpy(job->outBuf, &job->outBuf[i + 1], max - (i + 1)); + (void)memcpy(job->outBuf, &job->outBuf[i + 1], max - (i + 1)); job->curPos = max - (i + 1); } else { @@ -2426,8 +2426,8 @@ end_loop: */ oFILE = fopen(job->outFile, "r"); if (oFILE != NULL) { - (void) fprintf(stdout, "Results of making %s:\n", job->node->name); - (void) fflush(stdout); + (void)fprintf(stdout, "Results of making %s:\n", job->node->name); + (void)fflush(stdout); while (fgets(inLine, sizeof(inLine), oFILE) != NULL) { char *cp, *endp, *oendp; @@ -2443,15 +2443,15 @@ end_loop: * we know there's no newline at the end, so we add one of * our own free will. */ - (void) fprintf(stdout, "%s", cp); - (void) fflush(stdout); + (void)fprintf(stdout, "%s", cp); + (void)fflush(stdout); if (endp != oendp) { - (void) fprintf(stdout, "\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "\n"); + (void)fflush(stdout); } } - (void) fclose(oFILE); - (void) eunlink(job->outFile); + (void)fclose(oFILE); + (void)eunlink(job->outFile); } else { Punt("Cannot open `%s'", job->outFile); } @@ -2528,9 +2528,9 @@ Job_CatchChildren(Boolean block) (block?0:WNOHANG)|WUNTRACED)) > 0) { if (DEBUG(JOB)) { - (void) fprintf(stdout, "Process %d exited or stopped %x.\n", pid, + (void)fprintf(stdout, "Process %d exited or stopped %x.\n", pid, status); - (void) fflush(stdout); + (void)fflush(stdout); } jnode = Lst_Find(jobs, (ClientData)&pid, JobCmpPid); @@ -2542,21 +2542,21 @@ Job_CatchChildren(Boolean block) continue; } job = (Job *)Lst_Datum(jnode); - (void) Lst_Remove(stoppedJobs, jnode); + (void)Lst_Remove(stoppedJobs, jnode); } else { Error("Child (%d) not in table?", pid); continue; } } else { - job = (Job *) Lst_Datum(jnode); - (void) Lst_Remove(jobs, jnode); + job = (Job *)Lst_Datum(jnode); + (void)Lst_Remove(jobs, jnode); nJobs -= 1; #ifdef REMOTE if (!(job->flags & JOB_REMOTE)) { if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "Job queue has one fewer local process.\n"); - (void) fflush(stdout); + (void)fflush(stdout); } nLocal -= 1; } @@ -2574,7 +2574,7 @@ Job_CatchChildren(Boolean block) * Job_CatchOutput -- * Catch the output from our children, if we're using * pipes do so. Otherwise just block time until we get a - * signal (most likely a SIGCHLD) since there's no point in + * signal(most likely a SIGCHLD) since there's no point in * just spinning when there's nothing to do and the reaping * of a child can wait for a while. * @@ -2595,7 +2595,7 @@ Job_CatchOutput(void) int pnJobs; /* Previous nJobs */ #endif - (void) fflush(stdout); + (void)fflush(stdout); Job_TokenFlush(); #ifdef RMT_WILL_WATCH pnJobs = nJobs; @@ -2633,12 +2633,12 @@ Job_CatchOutput(void) if (readyfd(&childExitJob)) { char token; - (void) read(childExitJob.inPipe, &token, 1); + (void)read(childExitJob.inPipe, &token, 1); nready -= 1; } while (nready && (ln = Lst_Next(jobs)) != NILLNODE) { - job = (Job *) Lst_Datum(ln); + job = (Job *)Lst_Datum(ln); if (readyfd(job)) { JobDoOutput(job, FALSE); nready -= 1; @@ -2668,7 +2668,7 @@ Job_CatchOutput(void) void Job_Make(GNode *gn) { - (void) JobStart(gn, 0, NULL); + (void)JobStart(gn, 0, NULL); } void @@ -2762,7 +2762,7 @@ Job_Init(int maxproc, int maxlocal) #define ADDSIG(s,h) \ if (signal(s, SIG_IGN) != SIG_IGN) { \ sigaddset(&caught_signals, s); \ - (void) signal(s, h); \ + (void)signal(s, h); \ } /* @@ -2805,7 +2805,7 @@ static void JobSigReset(void) { #define DELSIG(s) \ if (sigismember(&caught_signals, s)) { \ - (void) signal(SIGINT, SIG_DFL); \ + (void)signal(SIGINT, SIG_DFL); \ } DELSIG(SIGINT) @@ -3100,11 +3100,11 @@ JobInterrupt(int runINTERRUPT, int signo) JobSigLock(&mask); - (void) Lst_Open(jobs); + (void)Lst_Open(jobs); while ((ln = Lst_Next(jobs)) != NILLNODE) { GNode *gn; - job = (Job *) Lst_Datum(ln); + job = (Job *)Lst_Datum(ln); gn = job->node; if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) { @@ -3135,10 +3135,10 @@ JobInterrupt(int runINTERRUPT, int signo) #else if (job->pid) { if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "JobInterrupt passing signal %d to child %d.\n", signo, job->pid); - (void) fflush(stdout); + (void)fflush(stdout); } KILL(job->pid, signo); } @@ -3151,15 +3151,15 @@ JobInterrupt(int runINTERRUPT, int signo) while ((ln = Lst_Next(stoppedJobs)) != NILLNODE) { GNode *gn; - job = (Job *) Lst_Datum(ln); + job = (Job *)Lst_Datum(ln); gn = job->node; if (job->flags & JOB_RESTART) { if (DEBUG(JOB)) { - (void) fprintf(stdout, "%s%s", + (void)fprintf(stdout, "%s%s", "JobInterrupt skipping job on stopped queue", "-- it was waiting to be restarted.\n"); - (void) fflush(stdout); + (void)fflush(stdout); } continue; } @@ -3173,10 +3173,10 @@ JobInterrupt(int runINTERRUPT, int signo) * Resume the thing so it will take the signal. */ if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "JobInterrupt passing CONT to stopped child %d.\n", job->pid); - (void) fflush(stdout); + (void)fflush(stdout); } KILL(job->pid, SIGCONT); #ifdef RMT_WANTS_SIGNALS @@ -3196,10 +3196,10 @@ JobInterrupt(int runINTERRUPT, int signo) } } else if (job->pid) { if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "JobInterrupt passing interrupt to stopped child %d.\n", job->pid); - (void) fflush(stdout); + (void)fflush(stdout); } KILL(job->pid, SIGINT); } @@ -3324,9 +3324,9 @@ Job_AbortAll(void) if (nJobs) { JobSigLock(&mask); - (void) Lst_Open(jobs); + (void)Lst_Open(jobs); while ((ln = Lst_Next(jobs)) != NILLNODE) { - job = (Job *) Lst_Datum(ln); + job = (Job *)Lst_Datum(ln); /* * kill the child process with increasingly drastic signals to make @@ -3381,8 +3381,8 @@ JobFlagForMigration(int hostID) LstNode jnode; /* list element for finding job */ if (DEBUG(JOB)) { - (void) fprintf(stdout, "JobFlagForMigration(%d) called.\n", hostID); - (void) fflush(stdout); + (void)fprintf(stdout, "JobFlagForMigration(%d) called.\n", hostID); + (void)fflush(stdout); } jnode = Lst_Find(jobs, (ClientData)&hostID, JobCmpRmtID); @@ -3395,13 +3395,13 @@ JobFlagForMigration(int hostID) return; } } - job = (Job *) Lst_Datum(jnode); + job = (Job *)Lst_Datum(jnode); if (DEBUG(JOB)) { - (void) fprintf(stdout, + (void)fprintf(stdout, "JobFlagForMigration(%d) found job '%s'.\n", hostID, job->node->name); - (void) fflush(stdout); + (void)fflush(stdout); } KILL(job->pid, SIGSTOP); @@ -3434,8 +3434,8 @@ JobRestartJobs(void) JobSigLock(&mask); while (!Lst_IsEmpty(stoppedJobs)) { if (DEBUG(JOB)) { - (void) fprintf(stdout, "Restarting a stopped job.\n"); - (void) fflush(stdout); + (void)fprintf(stdout, "Restarting a stopped job.\n"); + (void)fflush(stdout); } if (JobRestart((Job *)Lst_DeQueue(stoppedJobs)) != 0) break; diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 156495af802..e3f98a84d23 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.111 2005/06/24 02:53:27 lukem Exp $ */ +/* $NetBSD: main.c,v 1.112 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.111 2005/06/24 02:53:27 lukem Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.112 2005/07/25 22:55:58 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.111 2005/06/24 02:53:27 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.112 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -313,7 +313,7 @@ rearg: case 'L': maxLocal = strtol(optarg, &p, 0); if (*p != '\0' || maxLocal < 1) { - (void) fprintf(stderr, "%s: illegal argument to -L -- must be positive integer!\n", + (void)fprintf(stderr, "%s: illegal argument to -L -- must be positive integer!\n", progname); exit(1); } @@ -435,7 +435,7 @@ rearg: forceJobs = TRUE; maxJobs = strtol(optarg, &p, 0); if (*p != '\0' || maxJobs < 1) { - (void) fprintf(stderr, "%s: illegal argument to -j -- must be positive integer!\n", + (void)fprintf(stderr, "%s: illegal argument to -j -- must be positive integer!\n", progname); exit(1); } @@ -455,10 +455,10 @@ rearg: if (!Dir_FindHereOrAbove(curdir, optarg+4, found_path, sizeof(found_path))) break; /* nothing doing */ - (void) Dir_AddDir(sysIncPath, found_path); + (void)Dir_AddDir(sysIncPath, found_path); } else { - (void) Dir_AddDir(sysIncPath, optarg); + (void)Dir_AddDir(sysIncPath, optarg); } Var_Append(MAKEFLAGS, "-m", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); @@ -656,7 +656,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rl) != -1 && rl.rlim_cur != rl.rlim_max) { rl.rlim_cur = rl.rlim_max; - (void) setrlimit(RLIMIT_NOFILE, &rl); + (void)setrlimit(RLIMIT_NOFILE, &rl); } } #endif @@ -691,7 +691,7 @@ main(int argc, char **argv) if (makeobjdir == NULL || !strchr(makeobjdir, '$')) { if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino && sa.st_dev == sb.st_dev) - (void) strncpy(curdir, pwd, MAXPATHLEN); + (void)strncpy(curdir, pwd, MAXPATHLEN); } } @@ -757,19 +757,19 @@ main(int argc, char **argv) * of these paths exist, just use .CURDIR. */ Dir_Init(curdir); - (void) Main_SetObjdir(curdir); + (void)Main_SetObjdir(curdir); if ((path = getenv("MAKEOBJDIRPREFIX")) != NULL) { - (void) snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); - (void) Main_SetObjdir(mdpath); + (void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); + (void)Main_SetObjdir(mdpath); } else if ((path = getenv("MAKEOBJDIR")) != NULL) { - (void) Main_SetObjdir(path); + (void)Main_SetObjdir(path); } else { - (void) snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine); + (void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine); if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) { - (void) snprintf(mdpath, MAXPATHLEN, "%s%s", + (void)snprintf(mdpath, MAXPATHLEN, "%s%s", _PATH_OBJDIRPREFIX, curdir); - (void) Main_SetObjdir(mdpath); + (void)Main_SetObjdir(mdpath); } } @@ -890,11 +890,11 @@ main(int argc, char **argv) } /* look for magic parent directory search string */ if (strncmp(".../", start, 4) != 0) { - (void) Dir_AddDir(defIncPath, start); + (void)Dir_AddDir(defIncPath, start); } else { if (Dir_FindHereOrAbove(curdir, start+4, found_path, sizeof(found_path))) { - (void) Dir_AddDir(defIncPath, found_path); + (void)Dir_AddDir(defIncPath, found_path); } } } @@ -974,7 +974,7 @@ main(int argc, char **argv) savec = *cp; *cp = '\0'; /* Add directory to search path */ - (void) Dir_AddDir(dirSearchPath, path); + (void)Dir_AddDir(dirSearchPath, path); *cp = savec; path = cp + 1; } while (savec == ':'); @@ -1385,17 +1385,17 @@ Cmd_Exec(const char *cmd, const char **err) /* * Close input side of pipe */ - (void) close(fds[0]); + (void)close(fds[0]); /* * Duplicate the output stream to the shell's output, then * shut the extra thing down. Note we don't fetch the error * stream...why not? Why? */ - (void) dup2(fds[1], 1); - (void) close(fds[1]); + (void)dup2(fds[1], 1); + (void)close(fds[1]); - (void) execv(shellPath, UNCONST(args)); + (void)execv(shellPath, UNCONST(args)); _exit(1); /*NOTREACHED*/ @@ -1407,7 +1407,7 @@ Cmd_Exec(const char *cmd, const char **err) /* * No need for the writing half */ - (void) close(fds[1]); + (void)close(fds[1]); buf = Buf_Init(MAKE_BSIZE); @@ -1422,7 +1422,7 @@ Cmd_Exec(const char *cmd, const char **err) /* * Close the input side of the pipe. */ - (void) close(fds[0]); + (void)close(fds[0]); /* * Wait for the process to exit. @@ -1430,7 +1430,7 @@ Cmd_Exec(const char *cmd, const char **err) while(((pid = wait(&status)) != cpid) && (pid >= 0)) continue; - res = (char *)Buf_GetAll (buf, &cc); + res = (char *)Buf_GetAll(buf, &cc); Buf_Destroy(buf, FALSE); if (cc == 0) @@ -1679,7 +1679,7 @@ execError(const char *af, const char *av) iov[i].iov_len = strlen(iov[i].iov_base), \ i++) #else -#define IOADD (void)write(2, s, strlen(s)) +#define IOADD(void)write(2, s, strlen(s)) #endif IOADD(progname); diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index b056553376e..92c7d999403 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.56 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: make.c,v 1.57 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: make.c,v 1.56 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: make.c,v 1.57 2005/07/25 22:55:58 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.56 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: make.c,v 1.57 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -208,12 +208,12 @@ 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)); + printf("modified %s...", Targ_FmtTime(gn->mtime)); } else { - printf ("non-existent..."); + printf("non-existent..."); } } } @@ -355,7 +355,7 @@ MakeAddChild(ClientData gnp, ClientData lp) Lst l = (Lst) lp; if ((gn->flags & REMAKE) == 0 && !(gn->type & (OP_USE|OP_USEBEFORE))) { - (void)Lst_EnQueue (l, (ClientData)gn); + (void)Lst_EnQueue(l, (ClientData)gn); } return (0); } @@ -383,7 +383,7 @@ MakeFindChild(ClientData gnp, ClientData pgnp) GNode *gn = (GNode *) gnp; GNode *pgn = (GNode *) pgnp; - (void) Dir_MTime(gn); + (void)Dir_MTime(gn); Make_TimeStamp(pgn, gn); pgn->unmade--; @@ -435,20 +435,20 @@ Make_HandleUse(GNode *cgn, GNode *pgn) */ Lst cmds = pgn->commands; pgn->commands = Lst_Duplicate(cgn->commands, NOCOPY); - (void) Lst_Concat(pgn->commands, cmds, LST_CONCNEW); + (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) { - GNode *tgn, *gn = (GNode *)Lst_Datum (ln); + GNode *tgn, *gn = (GNode *)Lst_Datum(ln); /* * Expand variables in the .USE node's name @@ -470,8 +470,8 @@ 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); @@ -695,7 +695,7 @@ Make_Update(GNode *cgn) } if (Lst_Open(parents) == SUCCESS) { while ((ln = Lst_Next(parents)) != NILLNODE) { - pgn = (GNode *)Lst_Datum (ln); + pgn = (GNode *)Lst_Datum(ln); if (mtime == 0) pgn->flags |= FORCE; /* @@ -709,7 +709,7 @@ Make_Update(GNode *cgn) if ( ! (cgn->type & (OP_EXEC|OP_USE|OP_USEBEFORE))) { if (cgn->made == MADE) pgn->flags |= CHILDMADE; - (void)Make_TimeStamp (pgn, cgn); + (void)Make_TimeStamp(pgn, cgn); } /* @@ -726,7 +726,7 @@ Make_Update(GNode *cgn) * Queue the node up -- any unmade predecessors will * be dealt with in MakeStartJobs. */ - (void)Lst_EnQueue (toBeMade, (ClientData)pgn); + (void)Lst_EnQueue(toBeMade, (ClientData)pgn); } else if (pgn->unmade < 0) { Error("Graph cycles through %s", pgn->name); } @@ -759,7 +759,7 @@ Make_Update(GNode *cgn) char *cpref = Var_Value(PREFIX, cgn, &p1); while ((ln = Lst_Next(cgn->iParents)) != NILLNODE) { - pgn = (GNode *)Lst_Datum (ln); + pgn = (GNode *)Lst_Datum(ln); if (pgn->flags & REMAKE) { Var_Set(IMPSRC, cname, pgn, 0); if (cpref != NULL) @@ -933,9 +933,9 @@ 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); + printf("Examining %s...", gn->name); } /* * Make sure any and all predecessors that are going to be made, @@ -974,7 +974,7 @@ MakeStartJobs(void) numNodes--; if (Make_OODate(gn)) { if (DEBUG(MAKE)) { - printf ("out-of-date\n"); + printf("out-of-date\n"); } if (queryFlag) { return (TRUE); @@ -983,7 +983,7 @@ MakeStartJobs(void) Job_Make(gn); } else { if (DEBUG(MAKE)) { - printf ("up-to-date\n"); + printf("up-to-date\n"); } gn->made = UPTODATE; if (gn->type & OP_JOIN) { @@ -1029,7 +1029,7 @@ MakePrintStatus(ClientData gnp, ClientData cyclep) GNode *gn = (GNode *) gnp; Boolean cycle = *(Boolean *) cyclep; if (gn->made == UPTODATE) { - printf ("`%s' is up to date.\n", gn->name); + printf("`%s' is up to date.\n", gn->name); } else if (gn->unmade != 0) { if (cycle) { Boolean t = TRUE; @@ -1053,7 +1053,7 @@ MakePrintStatus(ClientData gnp, ClientData cyclep) Lst_ForEach(gn->children, MakePrintStatus, (ClientData) &t); } } else { - printf ("`%s' not remade because of errors.\n", gn->name); + printf("`%s' not remade because of errors.\n", gn->name); } } return (0); @@ -1096,7 +1096,7 @@ 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; @@ -1147,7 +1147,7 @@ Make_ExpandUse(Lst targs) if (gn->unmade != 0) { Lst_ForEach(gn->children, MakeAddChild, (ClientData)examine); } else { - (void)Lst_EnQueue (ntargs, (ClientData)gn); + (void)Lst_EnQueue(ntargs, (ClientData)gn); } } } @@ -1202,7 +1202,7 @@ Make_Run(Lst targs) * the finishing of a job. So we fill the Job table as much as we can * before going into our loop. */ - (void) MakeStartJobs(); + (void)MakeStartJobs(); } /* diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index d7f670685a9..7e8f366b3ab 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.102 2005/06/18 14:32:04 rpaulo Exp $ */ +/* $NetBSD: parse.c,v 1.103 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.102 2005/06/18 14:32:04 rpaulo Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.103 2005/07/25 22:55:58 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.102 2005/06/18 14:32:04 rpaulo Exp $"); +__RCSID("$NetBSD: parse.c,v 1.103 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -373,7 +373,7 @@ ParseFindKeyword(char *str) do { cur = start + ((end - start) / 2); - diff = strcmp (str, parseKeywords[cur].name); + diff = strcmp(str, parseKeywords[cur].name); if (diff == 0) { return (cur); @@ -510,10 +510,10 @@ 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)); - (void)Lst_AtEnd (pgn->children, (ClientData)cgn); + 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); + (void)Lst_AtEnd(cgn->parents, (ClientData)pgn); pgn->unmade += 1; return (0); } @@ -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. @@ -872,7 +872,7 @@ ParseFindMain(ClientData gnp, ClientData dummy) static int ParseAddDir(ClientData path, ClientData name) { - (void) Dir_AddDir((Lst) path, (char *) name); + (void)Dir_AddDir((Lst) path, (char *) name); return(0); } @@ -1112,7 +1112,7 @@ ParseDoDependency(char *line) default: break; } - } else if (strncmp (line, ".PATH", 5) == 0) { + } else if (strncmp(line, ".PATH", 5) == 0) { /* * .PATH<suffix> has to be handled specially. * Call on the suffix module to give us a path to @@ -1170,7 +1170,7 @@ ParseDoDependency(char *line) gn = Suff_AddTransform(targName); } - (void)Lst_AtEnd (targets, (ClientData)gn); + (void)Lst_AtEnd(targets, (ClientData)gn); } } else if (specType == ExPath && *line != '.' && *line != '\0') { Parse_Error(PARSE_WARNING, "Extra target (%s) ignored", line); @@ -1424,7 +1424,7 @@ ParseDoDependency(char *line) } while (!Lst_IsEmpty (sources)) { - gn = (GNode *) Lst_DeQueue(sources); + gn = (GNode *)Lst_DeQueue(sources); ParseDoSrc(tOp, gn->name, curSrcs, hasWait); } Lst_Destroy(sources, NOFREE); @@ -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); @@ -1838,7 +1838,7 @@ ParseHasCommands(ClientData gnp) void Parse_AddIncludeDir(char *dir) { - (void) Dir_AddDir(parseIncPath, dir); + (void)Dir_AddDir(parseIncPath, dir); } /*- @@ -1937,7 +1937,7 @@ ParseDoInclude(char *line) /* Make a temporary copy of this, to be safe. */ Fname = estrdup(curFile.fname); - prefEnd = strrchr (Fname, '/'); + prefEnd = strrchr(Fname, '/'); if (prefEnd != (char *)NULL) { char *newName; @@ -1950,12 +1950,12 @@ ParseDoInclude(char *line) if (fullname == (char *)NULL) { fullname = Dir_FindFile(newName, dirSearchPath); } - free (newName); + free(newName); *prefEnd = '/'; } else { fullname = (char *)NULL; } - free (Fname); + free(Fname); if (fullname == (char *)NULL) { /* * Makefile wasn't found in same directory as included makefile. @@ -1996,9 +1996,9 @@ ParseDoInclude(char *line) */ oldFile = emalloc(sizeof(IFile)); - memcpy(oldFile, &curFile, 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 @@ -2011,7 +2011,7 @@ ParseDoInclude(char *line) ParseSetParseFile(curFile.fname); - curFile.F = fopen (fullname, "r"); + curFile.F = fopen(fullname, "r"); curFile.P = NULL; if (curFile.F == (FILE * ) NULL) { @@ -2020,7 +2020,7 @@ ParseDoInclude(char *line) /* * Pop to previous file */ - (void) ParseEOF(0); + (void)ParseEOF(0); } } @@ -2076,12 +2076,12 @@ Parse_FromString(char *str, int lineno) IFile *oldFile; /* state associated with this file */ if (DEBUG(FOR)) - (void) fprintf(stderr, "%s\n---- at line %d\n", str, lineno); + (void)fprintf(stderr, "%s\n---- at line %d\n", str, lineno); oldFile = emalloc(sizeof(IFile)); - memcpy(oldFile, &curFile, sizeof (IFile)); + memcpy(oldFile, &curFile, sizeof(IFile)); - (void) Lst_AtFront(includes, (ClientData)oldFile); + (void)Lst_AtFront(includes, (ClientData)oldFile); curFile.F = NULL; curFile.P = emalloc(sizeof(PTR)); @@ -2175,7 +2175,7 @@ ParseTraditionalInclude(char *line) if (fullname == NULL) { fullname = Dir_FindFile(newName, dirSearchPath); } - free (newName); + free(newName); *prefEnd = '/'; } else { fullname = NULL; @@ -2221,9 +2221,9 @@ ParseTraditionalInclude(char *line) * a very nice stack to track how we got here... */ oldFile = emalloc(sizeof(IFile)); - memcpy(oldFile, &curFile, 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 @@ -2244,7 +2244,7 @@ ParseTraditionalInclude(char *line) /* * Pop to previous file */ - (void) ParseEOF(1); + (void)ParseEOF(1); } } } @@ -2276,20 +2276,20 @@ ParseEOF(int opened) return (DONE); } - ifile = (IFile *) Lst_DeQueue(includes); + ifile = (IFile *)Lst_DeQueue(includes); /* XXX dispose of curFile info */ - free ((Address) curFile.fname); + free((Address) curFile.fname); if (opened && curFile.F) - (void) fclose (curFile.F); + (void)fclose(curFile.F); if (curFile.P) { free((Address) curFile.P->str); free((Address) curFile.P); } - memcpy(&curFile, ifile, sizeof (IFile)); + memcpy(&curFile, ifile, sizeof(IFile)); - free ((Address)ifile); + free((Address)ifile); /* pop the PARSEDIR/PARSEFILE variables */ ParseSetParseFile(curFile.fname); @@ -2467,7 +2467,7 @@ ParseReadLine(void) lastc = c; buf = Buf_Init(MAKE_BSIZE); - while (((c = ParseReadc ()) != '\n' || (lastc == '\\')) && + while (((c = ParseReadc()) != '\n' || (lastc == '\\')) && (c != EOF)) { test_char: @@ -2483,7 +2483,7 @@ test_char: */ curFile.lineno++; lastc = ' '; - while ((c = ParseReadc ()) == ' ' || c == '\t') { + while ((c = ParseReadc()) == ' ' || c == '\t') { continue; } if (c == EOF || c == '\n') { @@ -2586,7 +2586,7 @@ test_char: /* * Copy in the previous character and save this one in lastc. */ - Buf_AddByte (buf, (Byte)lastc); + Buf_AddByte(buf, (Byte)lastc); lastc = c; } @@ -2594,10 +2594,10 @@ test_char: curFile.lineno++; if (lastc != '\0') { - Buf_AddByte (buf, (Byte)lastc); + Buf_AddByte(buf, (Byte)lastc); } - Buf_AddByte (buf, (Byte)'\0'); - line = (char *)Buf_GetAll (buf, &lineLength); + Buf_AddByte(buf, (Byte)'\0'); + line = (char *)Buf_GetAll(buf, &lineLength); Buf_Destroy(buf, FALSE); /* @@ -2626,14 +2626,14 @@ test_char: * Skip to next conditional that evaluates to COND_PARSE. */ do { - free (line); + free(line); line = ParseSkipLine(1, 0); } while (line && Cond_Eval(line) != COND_PARSE); if (line == NULL) break; /*FALLTHRU*/ case COND_PARSE: - free ((Address) line); + free((Address) line); line = ParseReadLine(); break; case COND_INVALID: @@ -2859,7 +2859,7 @@ Parse_File(const char *name, FILE *stream) ParseFinishLine(); cp = Var_Subst(NULL, line, VAR_CMD, TRUE); - free (line); + free(line); line = cp; /* @@ -2879,7 +2879,7 @@ Parse_File(const char *name, FILE *stream) nextLine: - free (line); + free(line); } /* * Reached EOF, but it may be just EOF of an include file... @@ -2896,7 +2896,7 @@ Parse_File(const char *name, FILE *stream) "%s: Fatal errors encountered -- cannot continue\n", progname); PrintOnError(NULL); - exit (1); + exit(1); } } @@ -2965,11 +2965,11 @@ Parse_MainName(void) 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/suff.c b/usr.bin/make/suff.c index 3e3a983e909..100ca4de92e 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.48 2005/02/16 15:11:52 christos Exp $ */ +/* $NetBSD: suff.c,v 1.49 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: suff.c,v 1.48 2005/02/16 15:11:52 christos Exp $"; +static char rcsid[] = "$NetBSD: suff.c,v 1.49 2005/07/25 22:55:58 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.48 2005/02/16 15:11:52 christos Exp $"); +__RCSID("$NetBSD: suff.c,v 1.49 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -345,7 +345,7 @@ SuffSuffIsSuffixP(ClientData s, ClientData sd) static int SuffSuffHasNameP(ClientData s, ClientData sname) { - return (strcmp ((char *) sname, ((Suff *) s)->name)); + return (strcmp((char *) sname, ((Suff *) s)->name)); } /*- @@ -392,7 +392,7 @@ SuffSuffIsPrefix(ClientData s, ClientData str) static int SuffGNHasNameP(ClientData gn, ClientData name) { - return (strcmp ((char *) name, ((GNode *) gn)->name)); + return (strcmp((char *) name, ((GNode *) gn)->name)); } /*********** Maintenance Functions ************/ @@ -444,8 +444,8 @@ SuffFree(ClientData sp) Lst_Destroy(s->parents, NOFREE); Lst_Destroy(s->searchPath, Dir_Destroy); - free ((Address)s->name); - free ((Address)s); + free((Address)s->name); + free((Address)s); } /*- @@ -498,7 +498,7 @@ SuffInsert(Lst l, Suff *s) return; } while ((ln = Lst_Next(l)) != NILLNODE) { - s2 = (Suff *) Lst_Datum(ln); + s2 = (Suff *)Lst_Datum(ln); if (s2->sNum >= s->sNum) { break; } @@ -512,14 +512,14 @@ SuffInsert(Lst l, Suff *s) if (DEBUG(SUFF)) { printf("at end of list\n"); } - (void)Lst_AtEnd (l, (ClientData)s); + (void)Lst_AtEnd(l, (ClientData)s); s->refCount++; (void)Lst_AtEnd(s->ref, (ClientData) l); } else if (s2->sNum != s->sNum) { if (DEBUG(SUFF)) { printf("before %s(%d)\n", s2->name, s2->sNum); } - (void)Lst_Insert (l, ln, (ClientData)s); + (void)Lst_Insert(l, ln, (ClientData)s); s->refCount++; (void)Lst_AtEnd(s->ref, (ClientData) l); } else if (DEBUG(SUFF)) { @@ -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; @@ -694,7 +694,7 @@ Suff_AddTransform(char *line) * by the Parse module. */ gn = Targ_NewGN(line); - (void)Lst_AtEnd (transforms, (ClientData)gn); + (void)Lst_AtEnd(transforms, (ClientData)gn); } else { /* * New specification for transformation rule. Just nuke the old list @@ -702,7 +702,7 @@ Suff_AddTransform(char *line) * free the commands themselves, because a given command can be * attached to several different transformations. */ - gn = (GNode *) Lst_Datum(ln); + gn = (GNode *)Lst_Datum(ln); Lst_Destroy(gn->commands, NOFREE); Lst_Destroy(gn->children, NOFREE); gn->commands = Lst_Init(FALSE); @@ -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)) { @@ -968,7 +968,7 @@ Suff_AddSuffix(char *str, GNode **gn) s = emalloc(sizeof(Suff)); s->name = estrdup(str); - s->nameLen = strlen (s->name); + s->nameLen = strlen(s->name); s->searchPath = Lst_Init(FALSE); s->children = Lst_Init(FALSE); s->parents = Lst_Init(FALSE); @@ -977,7 +977,7 @@ Suff_AddSuffix(char *str, GNode **gn) s->flags = 0; s->refCount = 1; - (void)Lst_AtEnd (sufflist, (ClientData)s); + (void)Lst_AtEnd(sufflist, (ClientData)s); /* * We also look at our existing targets list to see if adding * this suffix will make one of our current targets mutate into @@ -1019,7 +1019,7 @@ Suff_GetPath(char *sname) if (ln == NILLNODE) { return (NILLST); } else { - s = (Suff *) Lst_Datum(ln); + s = (Suff *)Lst_Datum(ln); return (s->searchPath); } } @@ -1059,7 +1059,7 @@ Suff_DoPaths(void) inLibs = Lst_Init(FALSE); while ((ln = Lst_Next(sufflist)) != NILLNODE) { - s = (Suff *) Lst_Datum(ln); + s = (Suff *)Lst_Datum(ln); if (!Lst_IsEmpty (s->searchPath)) { #ifdef INCLUDES if (s->flags & SUFF_INCLUDE) { @@ -1115,7 +1115,7 @@ Suff_AddInclude(char *sname) ln = Lst_Find(sufflist, (ClientData)sname, SuffSuffHasNameP); if (ln != NILLNODE) { - s = (Suff *) Lst_Datum(ln); + s = (Suff *)Lst_Datum(ln); s->flags |= SUFF_INCLUDE; } } @@ -1147,7 +1147,7 @@ Suff_AddLib(char *sname) ln = Lst_Find(sufflist, (ClientData)sname, SuffSuffHasNameP); if (ln != NILLNODE) { - s = (Suff *) Lst_Datum(ln); + s = (Suff *)Lst_Datum(ln); s->flags |= SUFF_LIBRARY; } } @@ -1197,7 +1197,7 @@ SuffAddSrc(ClientData sp, ClientData lsp) s->refCount++; s2->children = 0; targ->children += 1; - (void)Lst_AtEnd (ls->l, (ClientData)s2); + (void)Lst_AtEnd(ls->l, (ClientData)s2); #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, (ClientData) s2); @@ -1215,7 +1215,7 @@ SuffAddSrc(ClientData sp, ClientData lsp) s->refCount++; s2->children = 0; targ->children += 1; - (void)Lst_AtEnd (ls->l, (ClientData)s2); + (void)Lst_AtEnd(ls->l, (ClientData)s2); #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, (ClientData) s2); @@ -1284,9 +1284,9 @@ SuffRemoveSrc(Lst l) while ((ln = Lst_Next(l)) != NILLNODE) { - s = (Src *) Lst_Datum(ln); + s = (Src *)Lst_Datum(ln); if (s->children == 0) { - free ((Address)s->file); + free((Address)s->file); if (!s->parent) free((Address)s->pref); else { @@ -1302,7 +1302,7 @@ SuffRemoveSrc(Lst l) Lst_Destroy(s->cp, NOFREE); #endif Lst_Remove(l, ln); - free ((Address)s); + free((Address)s); t |= 1; Lst_Close(l); return TRUE; @@ -1346,10 +1346,10 @@ 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); + printf("\ttrying %s...", s->file); } /* @@ -1374,7 +1374,7 @@ SuffFindThem(Lst srcs, Lst slst) } if (DEBUG(SUFF)) { - printf ("not there\n"); + printf("not there\n"); } SuffAddLevel(srcs, s); @@ -1382,7 +1382,7 @@ SuffFindThem(Lst srcs, Lst slst) } if (DEBUG(SUFF) && rs) { - printf ("got it\n"); + printf("got it\n"); } return (rs); } @@ -1417,8 +1417,8 @@ SuffFindCmds(Src *targ, Lst slst) char *cp; t = targ->node; - (void) Lst_Open(t->children); - prefLen = strlen (targ->pref); + (void)Lst_Open(t->children); + prefLen = strlen(targ->pref); for (;;) { ln = Lst_Next(t->children); @@ -1426,15 +1426,15 @@ SuffFindCmds(Src *targ, Lst slst) Lst_Close(t->children); return NULL; } - s = (GNode *)Lst_Datum (ln); + s = (GNode *)Lst_Datum(ln); - cp = strrchr (s->name, '/'); + cp = strrchr(s->name, '/'); if (cp == (char *)NULL) { cp = s->name; } else { cp++; } - if (strncmp (cp, targ->pref, prefLen) != 0) + if (strncmp(cp, targ->pref, prefLen) != 0) continue; /* * The node matches the prefix ok, see if it has a known @@ -1450,7 +1450,7 @@ SuffFindCmds(Src *targ, Lst slst) * * XXX: Handle multi-stage transformations here, too. */ - suff = (Suff *)Lst_Datum (ln); + suff = (Suff *)Lst_Datum(ln); if (Lst_Member(suff->parents, (ClientData)targ->suff) != NILLNODE) break; @@ -1478,7 +1478,7 @@ SuffFindCmds(Src *targ, Lst slst) #endif Lst_AtEnd(slst, (ClientData) ret); if (DEBUG(SUFF)) { - printf ("\tusing existing source %s\n", s->name); + printf("\tusing existing source %s\n", s->name); } return (ret); } @@ -1506,7 +1506,7 @@ SuffFindCmds(Src *targ, Lst slst) static int SuffExpandChildren(LstNode prevLN, GNode *pgn) { - GNode *cgn = (GNode *) Lst_Datum(prevLN); + GNode *cgn = (GNode *)Lst_Datum(prevLN); GNode *gn; /* New source 8) */ char *cp; /* Expanded value */ @@ -1864,8 +1864,8 @@ SuffFindArchiveDeps(GNode *gn, Lst slst) * The node is an archive(member) pair. so we must find a * suffix for both of them. */ - eoarch = strchr (gn->name, '('); - eoname = strchr (eoarch, ')'); + eoarch = strchr(gn->name, '('); + eoname = strchr(eoarch, ')'); *eoname = '\0'; /* Nuke parentheses during suffix search */ *eoarch = '\0'; /* So a suffix can be found */ @@ -2398,7 +2398,7 @@ SuffFindDeps(GNode *gn, Lst slst) } if (DEBUG(SUFF)) { - printf ("SuffFindDeps (%s)\n", gn->name); + printf("SuffFindDeps (%s)\n", gn->name); } if (gn->type & OP_ARCHV) { @@ -2420,7 +2420,7 @@ SuffFindDeps(GNode *gn, Lst slst) 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); } else { @@ -2556,7 +2556,7 @@ Suff_End(void) static int SuffPrintName(ClientData s, ClientData dummy) { - printf ("%s ", ((Suff *) s)->name); + printf("%s ", ((Suff *) s)->name); return (dummy ? 0 : 0); } @@ -2567,38 +2567,38 @@ SuffPrintSuff(ClientData sp, ClientData dummy) int flags; int flag; - printf ("# `%s' [%d] ", s->name, s->refCount); + printf("# `%s' [%d] ", s->name, s->refCount); flags = s->flags; if (flags) { - fputs (" (", stdout); + fputs(" (", stdout); while (flags) { flag = 1 << (ffs(flags) - 1); flags &= ~flag; switch (flag) { case SUFF_NULL: - printf ("NULL"); + printf("NULL"); break; case SUFF_INCLUDE: - printf ("INCLUDE"); + printf("INCLUDE"); break; case SUFF_LIBRARY: - printf ("LIBRARY"); + printf("LIBRARY"); break; } fputc(flags ? '|' : ')', stdout); } } - fputc ('\n', stdout); - printf ("#\tTo: "); + fputc('\n', stdout); + printf("#\tTo: "); Lst_ForEach(s->parents, SuffPrintName, (ClientData)0); - fputc ('\n', stdout); - printf ("#\tFrom: "); + fputc('\n', stdout); + printf("#\tFrom: "); Lst_ForEach(s->children, SuffPrintName, (ClientData)0); - fputc ('\n', stdout); - printf ("#\tSearch Path: "); + fputc('\n', stdout); + printf("#\tSearch Path: "); Dir_PrintPath(s->searchPath); - fputc ('\n', stdout); + fputc('\n', stdout); return (dummy ? 0 : 0); } @@ -2607,20 +2607,20 @@ SuffPrintTrans(ClientData tp, ClientData dummy) { GNode *t = (GNode *) tp; - printf ("%-16s: ", t->name); + printf("%-16s: ", t->name); Targ_PrintType(t->type); - fputc ('\n', stdout); + fputc('\n', stdout); Lst_ForEach(t->commands, Targ_PrintCmd, (ClientData)0); - fputc ('\n', stdout); + fputc('\n', stdout); return(dummy ? 0 : 0); } void Suff_PrintAll(void) { - printf ("#*** Suffixes:\n"); + printf("#*** Suffixes:\n"); Lst_ForEach(sufflist, SuffPrintSuff, (ClientData)0); - printf ("#*** Transformations:\n"); + printf("#*** Transformations:\n"); Lst_ForEach(transforms, SuffPrintTrans, (ClientData)0); } diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index dcb8931d9a3..3012dc1d495 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.34 2005/02/16 15:11:53 christos Exp $ */ +/* $NetBSD: targ.c,v 1.35 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: targ.c,v 1.34 2005/02/16 15:11:53 christos Exp $"; +static char rcsid[] = "$NetBSD: targ.c,v 1.35 2005/07/25 22:55:58 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.34 2005/02/16 15:11:53 christos Exp $"); +__RCSID("$NetBSD: targ.c,v 1.35 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -338,9 +338,9 @@ Targ_FindNode(const char *name, int flags) he = Hash_CreateEntry(&targets, name, &isNew); if (isNew) { gn = Targ_NewGN(name); - Hash_SetValue (he, gn); + 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); @@ -349,7 +349,7 @@ Targ_FindNode(const char *name, int flags) if (he == (Hash_Entry *) NULL) { return (NILGNODE); } else { - return ((GNode *) Hash_GetValue (he)); + return ((GNode *)Hash_GetValue(he)); } } @@ -394,7 +394,7 @@ Targ_FindList(Lst names, int flags) * 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); } @@ -507,14 +507,14 @@ static int TargPrintName(ClientData gnp, ClientData ppath) { GNode *gn = (GNode *) gnp; - printf ("%s ", gn->name); + printf("%s ", gn->name); #ifdef notdef if (ppath) { if (gn->path) { - printf ("[%s] ", gn->path); + printf("[%s] ", gn->path); } if (gn == mainTarg) { - printf ("(MAIN NAME) "); + printf("(MAIN NAME) "); } } #endif /* notdef */ @@ -525,7 +525,7 @@ TargPrintName(ClientData gnp, ClientData ppath) int Targ_PrintCmd(ClientData cmd, ClientData dummy) { - printf ("\t%s\n", (char *) cmd); + printf("\t%s\n", (char *) cmd); return (dummy ? 0 : 0); } @@ -572,7 +572,7 @@ Targ_PrintType(int type) int tbit; #define PRINTBIT(attr) case CONCAT(OP_,attr): printf("." #attr " "); break -#define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) printf("." #attr " "); break +#define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG))printf("." #attr " "); break type &= ~OP_OPMASK; @@ -593,7 +593,7 @@ Targ_PrintType(int type) PRINTBIT(NOTMAIN); PRINTDBIT(LIB); /*XXX: MEMBER is defined, so CONCAT(OP_,MEMBER) gives OP_"%" */ - case OP_MEMBER: if (DEBUG(TARG)) printf(".MEMBER "); break; + case OP_MEMBER: if (DEBUG(TARG))printf(".MEMBER "); break; PRINTDBIT(ARCHV); PRINTDBIT(MADE); PRINTDBIT(PHONY); @@ -644,13 +644,13 @@ TargPrintNode(ClientData gnp, ClientData passp) if (!Lst_IsEmpty (gn->iParents)) { printf("# implicit parents: "); Lst_ForEach(gn->iParents, TargPrintName, (ClientData)0); - fputc ('\n', stdout); + fputc('\n', stdout); } } if (!Lst_IsEmpty (gn->parents)) { printf("# parents: "); Lst_ForEach(gn->parents, TargPrintName, (ClientData)0); - fputc ('\n', stdout); + fputc('\n', stdout); } printf("%-16s", gn->name); @@ -664,7 +664,7 @@ TargPrintNode(ClientData gnp, ClientData passp) } Targ_PrintType(gn->type); Lst_ForEach(gn->children, TargPrintName, (ClientData)0); - fputc ('\n', stdout); + fputc('\n', stdout); Lst_ForEach(gn->commands, Targ_PrintCmd, (ClientData)0); printf("\n\n"); if (gn->type & OP_DOUBLEDEP) { diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c index 86ac1d49bb4..994e00fa7cd 100644 --- a/usr.bin/make/util.c +++ b/usr.bin/make/util.c @@ -1,15 +1,15 @@ -/* $NetBSD: util.c,v 1.36 2005/02/16 15:11:53 christos Exp $ */ +/* $NetBSD: util.c,v 1.37 2005/07/25 22:55:58 christos Exp $ */ /* * Missing stuff from OS's */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: util.c,v 1.36 2005/02/16 15:11:53 christos Exp $"; +static char rcsid[] = "$NetBSD: util.c,v 1.37 2005/07/25 22:55:58 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: util.c,v 1.36 2005/02/16 15:11:53 christos Exp $"); +__RCSID("$NetBSD: util.c,v 1.37 2005/07/25 22:55:58 christos Exp $"); #endif #endif @@ -229,7 +229,7 @@ getwd(char *pathname) /* find the inode of root */ if (stat("/", &st_root) == -1) { - (void) sprintf(pathname, + (void)sprintf(pathname, "getwd: Cannot stat \"/\" (%s)", strerror(errno)); return (NULL); } @@ -240,7 +240,7 @@ getwd(char *pathname) /* find the inode of the current directory */ if (lstat(".", &st_cur) == -1) { - (void) sprintf(pathname, + (void)sprintf(pathname, "getwd: Cannot stat \".\" (%s)", strerror(errno)); return (NULL); } @@ -252,19 +252,19 @@ getwd(char *pathname) /* look if we found root yet */ if (st_cur.st_ino == st_root.st_ino && DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) { - (void) strcpy(pathname, *pathptr != '/' ? "/" : pathptr); + (void)strcpy(pathname, *pathptr != '/' ? "/" : pathptr); return (pathname); } /* open the parent directory */ if (stat(nextpathptr, &st_dotdot) == -1) { - (void) sprintf(pathname, + (void)sprintf(pathname, "getwd: Cannot stat directory \"%s\" (%s)", nextpathptr, strerror(errno)); return (NULL); } if ((dp = opendir(nextpathptr)) == NULL) { - (void) sprintf(pathname, + (void)sprintf(pathname, "getwd: Cannot open directory \"%s\" (%s)", nextpathptr, strerror(errno)); return (NULL); @@ -285,12 +285,12 @@ getwd(char *pathname) for (d = readdir(dp); d != NULL; d = readdir(dp)) { if (ISDOT(d->d_name) || ISDOTDOT(d->d_name)) continue; - (void) strcpy(cur_name_add, d->d_name); + (void)strcpy(cur_name_add, d->d_name); if (lstat(nextpathptr, &st_next) == -1) { - (void) sprintf(pathname, + (void)sprintf(pathname, "getwd: Cannot stat \"%s\" (%s)", d->d_name, strerror(errno)); - (void) closedir(dp); + (void)closedir(dp); return (NULL); } /* check if we found it yet */ @@ -300,16 +300,16 @@ getwd(char *pathname) } } if (d == NULL) { - (void) sprintf(pathname, + (void)sprintf(pathname, "getwd: Cannot find \".\" in \"..\""); - (void) closedir(dp); + (void)closedir(dp); return (NULL); } st_cur = st_dotdot; pathptr = strrcpy(pathptr, d->d_name); pathptr = strrcpy(pathptr, "/"); nextpathptr = strrcpy(nextpathptr, "../"); - (void) closedir(dp); + (void)closedir(dp); *cur_name_add = '\0'; } } /* end getwd */ @@ -369,7 +369,7 @@ vsnprintf(char *s, size_t n, const char *fmt, va_list args) fakebuf._cnt = 0; return (n-fakebuf._cnt-1); #else - (void) vsprintf(s, fmt, args); + (void)vsprintf(s, fmt, args); return strlen(s); #endif } diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 8730ba24356..235f503c6ea 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.96 2005/07/01 16:45:38 christos Exp $ */ +/* $NetBSD: var.c,v 1.97 2005/07/25 22:55:58 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.96 2005/07/01 16:45:38 christos Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.97 2005/07/25 22:55:58 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.96 2005/07/01 16:45:38 christos Exp $"); +__RCSID("$NetBSD: var.c,v 1.97 2005/07/25 22:55:58 christos Exp $"); #endif #endif /* not lint */ #endif @@ -374,7 +374,7 @@ VarFind(const char *name, GNode *ctxt, int flags) if ((var == NULL) && (flags & FIND_ENV)) { char *env; - if ((env = getenv (name)) != NULL) { + if ((env = getenv(name)) != NULL) { int len; v = emalloc(sizeof(Var)); @@ -402,7 +402,7 @@ VarFind(const char *name, GNode *ctxt, int flags) } else if (var == NULL) { return ((Var *) NIL); } else { - return ((Var *) Hash_GetValue(var)); + return ((Var *)Hash_GetValue(var)); } } @@ -604,7 +604,7 @@ Var_Append(const char *name, const char *val, GNode *ctxt) if (DEBUG(VAR)) { printf("%s:%s = %s\n", ctxt->name, name, - (char *) Buf_GetAll(v->val, (int *)NULL)); + (char *)Buf_GetAll(v->val, (int *)NULL)); } if (v->flags & VAR_FROM_ENV) { @@ -722,13 +722,13 @@ VarHead(GNode *ctx __unused, Var_Parse_State *vpstate, { char *slash; - slash = strrchr (word, '/'); + slash = strrchr(word, '/'); if (slash != (char *)NULL) { if (addSpace && vpstate->varSpace) { - Buf_AddByte (buf, vpstate->varSpace); + 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 { @@ -771,10 +771,10 @@ VarTail(GNode *ctx __unused, Var_Parse_State *vpstate, char *slash; if (addSpace && vpstate->varSpace) { - Buf_AddByte (buf, vpstate->varSpace); + Buf_AddByte(buf, vpstate->varSpace); } - slash = strrchr (word, '/'); + slash = strrchr(word, '/'); if (slash != (char *)NULL) { *slash++ = '\0'; Buf_AddBytes(buf, strlen(slash), (Byte *)slash); @@ -812,13 +812,13 @@ VarSuffix(GNode *ctx __unused, Var_Parse_State *vpstate, { char *dot; - dot = strrchr (word, '.'); + dot = strrchr(word, '.'); if (dot != (char *)NULL) { if (addSpace && vpstate->varSpace) { - Buf_AddByte (buf, vpstate->varSpace); + 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; } @@ -854,13 +854,13 @@ VarRoot(GNode *ctx __unused, Var_Parse_State *vpstate, char *dot; if (addSpace && vpstate->varSpace) { - Buf_AddByte (buf, vpstate->varSpace); + Buf_AddByte(buf, vpstate->varSpace); } - dot = strrchr (word, '.'); + 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); @@ -1465,8 +1465,8 @@ VarSelectWords(GNode *ctx __unused, Var_Parse_State *vpstate, free(as); free(av); - Buf_AddByte (buf, '\0'); - as = (char *)Buf_GetAll (buf, (int *)NULL); + Buf_AddByte(buf, '\0'); + as = (char *)Buf_GetAll(buf, (int *)NULL); Buf_Destroy(buf, FALSE); return (as); } @@ -1526,8 +1526,8 @@ VarModify(GNode *ctx, Var_Parse_State *vpstate, free(as); free(av); - Buf_AddByte (buf, '\0'); - as = (char *)Buf_GetAll (buf, (int *)NULL); + Buf_AddByte(buf, '\0'); + as = (char *)Buf_GetAll(buf, (int *)NULL); Buf_Destroy(buf, FALSE); return (as); } @@ -1599,14 +1599,14 @@ VarOrder(const char *str, const char otype) for (i = 0; i < ac; i++) { Buf_AddBytes(buf, strlen(av[i]), (Byte *) av[i]); if (i != ac - 1) - Buf_AddByte (buf, ' '); + Buf_AddByte(buf, ' '); } free(as); free(av); - Buf_AddByte (buf, '\0'); - as = (char *)Buf_GetAll (buf, (int *)NULL); + Buf_AddByte(buf, '\0'); + as = (char *)Buf_GetAll(buf, (int *)NULL); Buf_Destroy(buf, FALSE); return (as); } @@ -1779,7 +1779,7 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate __unused, else { char *rstr; *tstr = ++cp; - rstr = (char *) Buf_GetAll(buf, length); + rstr = (char *)Buf_GetAll(buf, length); *length -= 1; /* Don't count the NULL */ Buf_Destroy(buf, FALSE); return rstr; @@ -1814,7 +1814,7 @@ VarQuote(char *str) Buf_AddByte(buf, (Byte)*str); } Buf_AddByte(buf, (Byte) '\0'); - str = (char *)Buf_GetAll (buf, (int *)NULL); + str = (char *)Buf_GetAll(buf, (int *)NULL); Buf_Destroy(buf, FALSE); return str; } @@ -1848,7 +1848,7 @@ VarChangeCase(char *str, int upper) Buf_AddByte(buf, (Byte) modProc(*str)); } Buf_AddByte(buf, (Byte) '\0'); - str = (char *) Buf_GetAll(buf, (int *) NULL); + str = (char *)Buf_GetAll(buf, (int *) NULL); Buf_Destroy(buf, FALSE); return str; } @@ -2150,7 +2150,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, * return. */ nstr = (char *)Buf_GetAll(v->val, (int *)NULL); - if (strchr (nstr, '$') != (char *)NULL) { + if (strchr(nstr, '$') != (char *)NULL) { nstr = Var_Subst(NULL, nstr, ctxt, err); *freePtr = TRUE; } @@ -3152,7 +3152,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr, if (newStr != nstr) { if (*freePtr) { - free (nstr); + free(nstr); } nstr = newStr; if (nstr != var_Error && nstr != varNoError) { @@ -3379,7 +3379,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) str += length; errorReported = TRUE; } else { - Buf_AddByte (buf, (Byte)*str); + Buf_AddByte(buf, (Byte)*str); str += 1; } } else { @@ -3397,14 +3397,14 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) Buf_AddBytes(buf, length, (Byte *)val); trailingBslash = length > 0 && val[length - 1] == '\\'; if (doFree) { - free ((Address)val); + free((Address)val); } } } } - Buf_AddByte (buf, '\0'); - val = (char *)Buf_GetAll (buf, (int *)NULL); + Buf_AddByte(buf, '\0'); + val = (char *)Buf_GetAll(buf, (int *)NULL); Buf_Destroy(buf, FALSE); return (val); } @@ -3490,7 +3490,7 @@ static void VarPrintVar(ClientData vp) { Var *v = (Var *) vp; - printf ("%-16s = %s\n", v->name, (char *) Buf_GetAll(v->val, (int *)NULL)); + printf("%-16s = %s\n", v->name, (char *)Buf_GetAll(v->val, (int *)NULL)); } /*- |
