diff options
42 files changed, 713 insertions, 1264 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 72d6e39ab26..ed6d6e7c94b 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: arch.c,v 1.53 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: arch.c,v 1.54 2004/04/07 13:11:35 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -169,13 +169,11 @@ struct SVR4namelist { static const char *svr4list = "Archive list"; -static char *ArchSVR4Entry(struct SVR4namelist *, char *, size_t, FILE *); +static char *ArchSVR4Entry(struct SVR4namelist *, const char *, size_t, FILE *); #endif static struct arch_member * -new_arch_member(hdr, name) - struct ar_hdr *hdr; - const char *name; +new_arch_member(struct ar_hdr *hdr, const char *name) { const char *end = NULL; struct arch_member *n; @@ -190,8 +188,7 @@ new_arch_member(hdr, name) } static TIMESTAMP -mtime_of_member(m) - struct arch_member *m; +mtime_of_member(struct arch_member *m) { if (is_out_of_date(m->mtime)) ts_set_from_time_t((time_t) strtol(m->date, NULL, 10), m->mtime); @@ -206,8 +203,7 @@ mtime_of_member(m) *----------------------------------------------------------------------- */ static void -ArchFree(a) - Arch *a; +ArchFree(Arch *a) { struct arch_member *mem; unsigned int i; @@ -226,15 +222,14 @@ ArchFree(a) /* Side-effects: Some nodes may be created. */ bool -Arch_ParseArchive(linePtr, nodeLst, ctxt) - char **linePtr; /* Pointer to start of specification */ - Lst nodeLst; /* Lst on which to place the nodes */ - SymTable *ctxt; /* Context in which to expand variables */ +Arch_ParseArchive(char **linePtr, /* Pointer to start of specification */ + Lst nodeLst, /* Lst on which to place the nodes */ + SymTable *ctxt) /* Context in which to expand variables */ { char *cp; /* Pointer into line */ GNode *gn; /* New node */ char *libName; /* Library-part of specification */ - char *memName; /* Member-part of specification */ + char *memberName; /* Member-part of specification */ char nameBuf[MAKE_BSIZE]; /* temporary place for node name */ char saveChar; /* Ending delimiter of member-name */ bool subLibName; /* true if libName should have/had @@ -264,11 +259,11 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) /* First skip to the start of the member's name, mark that * place and skip to the end of it (either white-space or * a close paren). */ - bool doSubst = false; /* true if need to substitute in memName */ + bool doSubst = false; /* true if need to substitute in memberName */ while (*cp != '\0' && *cp != ')' && isspace(*cp)) cp++; - memName = cp; + memberName = cp; while (*cp != '\0' && *cp != ')' && !isspace(*cp)) { if (*cp == '$') { bool ok; @@ -290,7 +285,7 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) } /* If we didn't move anywhere, we must be done. */ - if (cp == memName) + if (cp == memberName) break; saveChar = *cp; @@ -308,20 +303,21 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) if (doSubst) { char *buf; char *sacrifice; - char *oldMemName = memName; - size_t len; + char *oldMemberName = memberName; + size_t length; - memName = Var_Subst(memName, ctxt, true); + memberName = Var_Subst(memberName, ctxt, true); /* Now form an archive spec and recurse to deal with nested * variables and multi-word variable values.... The results * are just placed at the end of the nodeLst we're returning. */ - len = strlen(memName)+strlen(libName)+3; - buf = sacrifice = emalloc(len); + length = strlen(memberName)+strlen(libName)+3; + buf = sacrifice = emalloc(length); - snprintf(buf, len, "%s(%s)", libName, memName); + snprintf(buf, length, "%s(%s)", libName, memberName); - if (strchr(memName, '$') && strcmp(memName, oldMemName) == 0) { + if (strchr(memberName, '$') && + strcmp(memberName, oldMemberName) == 0) { /* Must contain dynamic sources, so we can't deal with it now. * Just create an ARCHV node for the thing and let * SuffExpandChildren handle it... */ @@ -342,13 +338,13 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) } /* Free buffer and continue with our work. */ free(buf); - } else if (Dir_HasWildcards(memName)) { + } else if (Dir_HasWildcards(memberName)) { LIST members; char *member; Lst_Init(&members); - Dir_Expand(memName, dirSearchPath, &members); + Dir_Expand(memberName, dirSearchPath, &members); while ((member = (char *)Lst_DeQueue(&members)) != NULL) { snprintf(nameBuf, MAKE_BSIZE, "%s(%s)", libName, member); free(member); @@ -362,7 +358,7 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) Lst_AtEnd(nodeLst, gn); } } else { - snprintf(nameBuf, MAKE_BSIZE, "%s(%s)", libName, memName); + snprintf(nameBuf, MAKE_BSIZE, "%s(%s)", libName, memberName); gn = Targ_FindNode(nameBuf, TARG_CREATE); /* We've found the node, but have to make sure the rest of the * world knows it's an archive member, without having to @@ -373,7 +369,7 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) Lst_AtEnd(nodeLst, gn); } if (doSubst) - free(memName); + free(memberName); *cp = saveChar; } @@ -395,22 +391,18 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) /* Helper function: ar fields are not null terminated. */ static long -field2long(field, len) - const char *field; - size_t len; +field2long(const char *field, size_t length) { static char enough[32]; - assert(len < sizeof(enough)); - memcpy(enough, field, len); - enough[len] = '\0'; + assert(length < sizeof(enough)); + memcpy(enough, field, length); + enough[length] = '\0'; return strtol(enough, NULL, 10); } static Arch * -read_archive(archive, end) - const char *archive; - const char *end; +read_archive(const char *archive, const char *earchive) { FILE * arch; /* Stream to archive */ char magic[SARMAG]; @@ -434,20 +426,20 @@ read_archive(archive, end) return NULL; } - ar = ohash_create_entry(&arch_info, archive, &end); + ar = ohash_create_entry(&arch_info, archive, &earchive); ohash_init(&ar->members, 8, &members_info); for (;;) { size_t n; - struct ar_hdr arh; /* Archive-member header for reading archive */ + struct ar_hdr arHeader;/* Archive-member header for reading archive */ off_t size; /* Size of archive member */ char buffer[PATH_MAX]; - char *memName; + char *memberName; /* Current member name while hashing. */ char *cp; /* Useful character pointer */ - memName = buffer; - n = fread(&arh, 1, sizeof(struct ar_hdr), arch); + memberName = buffer; + n = fread(&arHeader, 1, sizeof(struct ar_hdr), arch); /* Whole archive read ok. */ if (n == 0 && feof(arch)) { @@ -460,7 +452,7 @@ read_archive(archive, end) if (n < sizeof(struct ar_hdr)) break; - if (memcmp(arh.ar_fmag, ARFMAG, sizeof(arh.ar_fmag)) != 0) { + if (memcmp(arHeader.ar_fmag, ARFMAG, sizeof(arHeader.ar_fmag)) != 0) { /* The header is bogus. */ break; } else { @@ -468,23 +460,24 @@ read_archive(archive, end) * next header. Records are padded with newlines to an even-byte * boundary, so we need to extract the size of the record and * round it up during the seek. */ - size = (off_t) field2long(arh.ar_size, sizeof(arh.ar_size)); + size = (off_t) field2long(arHeader.ar_size, + sizeof(arHeader.ar_size)); - (void)memcpy(memName, arh.ar_name, AR_NAME_SIZE); + (void)memcpy(memberName, arHeader.ar_name, AR_NAME_SIZE); /* Find real end of name (strip extranous ' ') */ - for (cp = memName + AR_NAME_SIZE - 1; *cp == ' ';) + for (cp = memberName + AR_NAME_SIZE - 1; *cp == ' ';) cp--; cp[1] = '\0'; #ifdef SVR4ARCHIVES /* SVR4 names are slash terminated. Also svr4 extended AR format. */ - if (memName[0] == '/') { + if (memberName[0] == '/') { /* SVR4 magic mode. */ - memName = ArchSVR4Entry(&list, memName, size, arch); - if (memName == NULL) /* Invalid data */ + memberName = ArchSVR4Entry(&list, memberName, size, arch); + if (memberName == NULL) /* Invalid data */ break; - else if (memName == svr4list) /* List of files entry */ + else if (memberName == svr4list)/* List of files entry */ continue; /* Got the entry. */ /* XXX this assumes further processing, such as AR_EFMT1, @@ -499,27 +492,28 @@ read_archive(archive, end) #ifdef AR_EFMT1 /* BSD 4.4 extended AR format: #1/<namelen>, with name as the * first <namelen> bytes of the file. */ - if (memcmp(memName, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 && - isdigit(memName[sizeof(AR_EFMT1) - 1])) { + if (memcmp(memberName, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 && + isdigit(memberName[sizeof(AR_EFMT1) - 1])) { - int elen = atoi(memName + sizeof(AR_EFMT1)-1); + int elen = atoi(memberName + sizeof(AR_EFMT1)-1); if (elen <= 0 || elen >= PATH_MAX) break; - memName = buffer; - if (fread(memName, elen, 1, arch) != 1) + memberName = buffer; + if (fread(memberName, elen, 1, arch) != 1) break; - memName[elen] = '\0'; + memberName[elen] = '\0'; if (fseek(arch, -elen, SEEK_CUR) != 0) break; if (DEBUG(ARCH) || DEBUG(MAKE)) - printf("ArchStat: Extended format entry for %s\n", memName); + printf("ArchStat: Extended format entry for %s\n", + memberName); } #endif ohash_insert(&ar->members, - ohash_qlookup(&ar->members, memName), - new_arch_member(&arh, memName)); + ohash_qlookup(&ar->members, memberName), + new_arch_member(&arHeader, memberName)); } if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) break; @@ -550,11 +544,11 @@ read_archive(archive, end) *----------------------------------------------------------------------- */ static TIMESTAMP -ArchMTimeMember(archive, member, hash) - const char *archive; /* Path to the archive */ - const char *member; /* Name of member. If it is a path, only the +ArchMTimeMember( + const char *archive, /* Path to the archive */ + const char *member, /* Name of member. If it is a path, only the * last component is used. */ - bool hash; /* true if archive should be hashed if not + bool hash) /* true if archive should be hashed if not * already so. */ { FILE * arch; /* Stream to archive */ @@ -583,13 +577,14 @@ ArchMTimeMember(archive, member, hash) /* Quick path: no need to hash the whole archive, just use * ArchFindMember to get the member's header and close the stream * again. */ - struct ar_hdr sarh; + struct ar_hdr arHeader; - arch = ArchFindMember(archive, member, &sarh, "r"); + arch = ArchFindMember(archive, member, &arHeader, "r"); if (arch != NULL) { fclose(arch); - ts_set_from_time_t( (time_t)strtol(sarh.ar_date, NULL, 10), result); + ts_set_from_time_t( (time_t)strtol(arHeader.ar_date, NULL, 10), + result); } return result; } @@ -640,11 +635,7 @@ ArchMTimeMember(archive, member, hash) */ static char * -ArchSVR4Entry(l, name, size, arch) - struct SVR4namelist *l; - char *name; - size_t size; - FILE *arch; +ArchSVR4Entry(struct SVR4namelist *l, const char *name, size_t size, FILE *arch) { #define ARLONGNAMES1 "/" #define ARLONGNAMES2 "ARFILENAMES" @@ -728,21 +719,21 @@ ArchSVR4Entry(l, name, size, arch) * the member's header, or NULL if the member was nonexistent. * * Side Effects: - * Fill the struct ar_hdr pointed by arhPtr. + * Fill the struct ar_hdr pointed by arHeaderPtr. *----------------------------------------------------------------------- */ static FILE * -ArchFindMember(archive, member, arhPtr, mode) - const char *archive; /* Path to the archive */ - const char *member; /* Name of member. If it is a path, only the +ArchFindMember( + const char *archive, /* Path to the archive */ + const char *member, /* Name of member. If it is a path, only the * last component is used. */ - struct ar_hdr *arhPtr; /* Pointer to header structure to be filled in */ - const char *mode; /* The mode for opening the stream */ + struct ar_hdr *arHeaderPtr,/* Pointer to header structure to be filled in */ + const char *mode) /* mode for opening the stream */ { FILE * arch; /* Stream to archive */ - char *cp; /* Useful character pointer */ + char *cp; char magic[SARMAG]; - size_t len; + size_t length; #ifdef SVR4ARCHIVES struct SVR4namelist list; @@ -768,33 +759,35 @@ ArchFindMember(archive, member, arhPtr, mode) if (cp != NULL) member = cp + 1; - len = strlen(member); - if (len >= AR_NAME_SIZE) - len = AR_NAME_SIZE; + length = strlen(member); + if (length >= AR_NAME_SIZE) + length = AR_NAME_SIZE; /* Error handling is simpler than for read_archive, since we just * look for a given member. */ - while (fread(arhPtr, sizeof(struct ar_hdr), 1, arch) == 1) { + while (fread(arHeaderPtr, sizeof(struct ar_hdr), 1, arch) == 1) { off_t size; /* Size of archive member */ - char *memName; + char *memberName; - if (memcmp(arhPtr->ar_fmag, ARFMAG, sizeof(arhPtr->ar_fmag) ) != 0) + if (memcmp(arHeaderPtr->ar_fmag, ARFMAG, sizeof(arHeaderPtr->ar_fmag) ) + != 0) /* The header is bogus, so the archive is bad. */ break; - memName = arhPtr->ar_name; - if (memcmp(member, memName, len) == 0) { + memberName = arHeaderPtr->ar_name; + if (memcmp(member, memberName, length) == 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- * padded to the right, so if the character in 'name' at the end * of the matched string is anything but a space, this isn't the * member we sought. */ #ifdef SVR4ARCHIVES - if (len < sizeof(arhPtr->ar_name) && memName[len] == '/') - len++; + if (length < sizeof(arHeaderPtr->ar_name) && + memberName[length] == '/') + length++; #endif - if (len == sizeof(arhPtr->ar_name) || - memName[len] == ' ') { + if (length == sizeof(arHeaderPtr->ar_name) || + memberName[length] == ' ') { #ifdef SVR4ARCHIVES efree(list.fnametab); #endif @@ -802,20 +795,22 @@ ArchFindMember(archive, member, arhPtr, mode) } } - size = (off_t) field2long(arhPtr->ar_size, sizeof(arhPtr->ar_size)); + size = (off_t) field2long(arHeaderPtr->ar_size, + sizeof(arHeaderPtr->ar_size)); #ifdef SVR4ARCHIVES /* svr4 names are slash terminated. Also svr4 extended AR format. */ - if (memName[0] == '/') { + if (memberName[0] == '/') { /* svr4 magic mode. */ - memName = ArchSVR4Entry(&list, arhPtr->ar_name, size, arch); - if (memName == NULL) /* Invalid data */ + memberName = ArchSVR4Entry(&list, arHeaderPtr->ar_name, size, + arch); + if (memberName == NULL) /* Invalid data */ break; - else if (memName == svr4list) /* List of files entry */ + else if (memberName == svr4list)/* List of files entry */ continue; /* Got the entry. */ - if (strcmp(memName, member) == 0) { + if (strcmp(memberName, member) == 0) { efree(list.fnametab); return arch; } @@ -825,19 +820,19 @@ ArchFindMember(archive, member, arhPtr, mode) #ifdef AR_EFMT1 /* BSD 4.4 extended AR format: #1/<namelen>, with name as the * first <namelen> bytes of the file. */ - if (memcmp(memName, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 && - isdigit(memName[sizeof(AR_EFMT1) - 1])) { + if (memcmp(memberName, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 && + isdigit(memberName[sizeof(AR_EFMT1) - 1])) { char ename[PATH_MAX]; - int elen = atoi(memName + sizeof(AR_EFMT1)-1); + int elength = atoi(memberName + sizeof(AR_EFMT1)-1); - if (elen <= 0 || elen >= PATH_MAX) + if (elength <= 0 || elength >= PATH_MAX) break; - if (fread(ename, elen, 1, arch) != 1) + if (fread(ename, elength, 1, arch) != 1) break; - if (fseek(arch, -elen, SEEK_CUR) != 0) + if (fseek(arch, -elength, SEEK_CUR) != 0) break; - ename[elen] = '\0'; + ename[elength] = '\0'; if (DEBUG(ARCH) || DEBUG(MAKE)) printf("ArchFind: Extended format entry for %s\n", ename); /* Found as extended name. */ @@ -865,19 +860,17 @@ ArchFindMember(archive, member, arhPtr, mode) } static void -ArchTouch(archive, member) - const char *archive; /* Path to the archive */ - const char *member; /* Name of member. */ +ArchTouch(const char *archive, const char *member) { FILE *arch; - struct ar_hdr arh; + struct ar_hdr arHeader; - arch = ArchFindMember(archive, member, &arh, "r+"); + arch = ArchFindMember(archive, member, &arHeader, "r+"); if (arch != NULL) { - snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) + snprintf(arHeader.ar_date, sizeof(arHeader.ar_date), "%-12ld", (long) timestamp2time_t(now)); if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) == 0) - (void)fwrite(&arh, sizeof(struct ar_hdr), 1, arch); + (void)fwrite(&arHeader, sizeof(struct ar_hdr), 1, arch); fclose(arch); } } @@ -889,16 +882,14 @@ ArchTouch(archive, member) * whole thing. */ void -Arch_Touch(gn) - GNode *gn; /* Node of member to touch */ +Arch_Touch(GNode *gn) { ArchTouch(Varq_Value(ARCHIVE_INDEX, gn), Varq_Value(MEMBER_INDEX, gn)); } /*ARGSUSED*/ void -Arch_TouchLib(gn) - GNode *gn UNUSED; /* The node of the library to touch */ +Arch_TouchLib(GNode *gn UNUSED) /* ^ Non RANLIBMAG does nothing with it */ { #ifdef RANLIBMAG @@ -910,8 +901,7 @@ Arch_TouchLib(gn) } TIMESTAMP -Arch_MTime(gn) - GNode *gn; /* Node describing archive member */ +Arch_MTime(GNode *gn) { gn->mtime = ArchMTimeMember(Varq_Value(ARCHIVE_INDEX, gn), Varq_Value(MEMBER_INDEX, gn), @@ -921,8 +911,7 @@ Arch_MTime(gn) } TIMESTAMP -Arch_MemMTime(gn) - GNode *gn; +Arch_MemMTime(GNode *gn) { LstNode ln; @@ -967,15 +956,13 @@ Arch_MemMTime(gn) * as returned by Dir_FindFile. */ void -Arch_FindLib(gn, path) - GNode *gn; /* Node of library to find */ - Lst path; /* Search path */ +Arch_FindLib(GNode *gn, Lst path) { char *libName; /* file name for archive */ - size_t len = strlen(gn->name) + 6 - 2; + size_t length = strlen(gn->name) + 6 - 2; - libName = emalloc(len); - snprintf(libName, len, "lib%s.a", &gn->name[2]); + libName = emalloc(length); + snprintf(libName, length, "lib%s.a", &gn->name[2]); gn->path = Dir_FindFile(libName, path); @@ -1024,8 +1011,7 @@ Arch_FindLib(gn, path) *----------------------------------------------------------------------- */ bool -Arch_LibOODate(gn) - GNode *gn; /* The library's graph node */ +Arch_LibOODate(GNode *gn) { #ifdef RANLIBMAG TIMESTAMP modTimeTOC; /* mod time of __.SYMDEF */ @@ -1057,14 +1043,14 @@ Arch_LibOODate(gn) } void -Arch_Init() +Arch_Init(void) { ohash_init(&archives, 4, &arch_info); } #ifdef CLEANUP void -Arch_End() +Arch_End(void) { Arch *e; unsigned int i; @@ -1077,8 +1063,7 @@ Arch_End() #endif bool -Arch_IsLib(gn) - GNode *gn; +Arch_IsLib(GNode *gn) { char buf[SARMAG]; int fd; diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index b0cbe8cdf24..0b1a602a337 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: buf.c,v 1.19 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: buf.c,v 1.20 2004/04/07 13:11:35 espie Exp $ */ /* $NetBSD: buf.c,v 1.9 1996/12/31 17:53:21 christos Exp $ */ /* @@ -64,7 +64,7 @@ /*- * buf.c -- - * Functions for automatically-expanded buffers. + * Functions for automatically expanded buffers. */ #include <ctype.h> @@ -110,18 +110,14 @@ do { \ /* the hard case for Buf_AddChar: buffer must be expanded to accommodate * one more char. */ void -BufOverflow(bp) - Buffer bp; +BufOverflow(Buffer bp) { BufExpand(bp, 1); } void -Buf_AddChars(bp, numBytes, bytesPtr) - Buffer bp; - size_t numBytes; - const char *bytesPtr; +Buf_AddChars(Buffer bp, size_t numBytes, const char *bytesPtr) { if ((size_t)(bp->endPtr - bp->inPtr) < numBytes+1) @@ -133,9 +129,7 @@ Buf_AddChars(bp, numBytes, bytesPtr) void -Buf_Init(bp, size) - Buffer bp; - size_t size; +Buf_Init(Buffer bp, size_t size) { #ifdef STATS_BUF STAT_TOTAL_BUFS++; @@ -151,8 +145,7 @@ Buf_Init(bp, size) } void -Buf_KillTrailingSpaces(bp) - Buffer bp; +Buf_KillTrailingSpaces(Buffer bp) { while (bp->inPtr > bp->buffer + 1 && isspace(bp->inPtr[-1])) { if (bp->inPtr[-2] == '\\') diff --git a/usr.bin/make/cmd_exec.c b/usr.bin/make/cmd_exec.c index ea7e3d8072c..2212a54e601 100644 --- a/usr.bin/make/cmd_exec.c +++ b/usr.bin/make/cmd_exec.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: cmd_exec.c,v 1.4 2003/10/19 20:23:34 tedu Exp $ */ +/* $OpenBSD: cmd_exec.c,v 1.5 2004/04/07 13:11:35 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -38,9 +38,7 @@ #include "pathnames.h" char * -Cmd_Exec(cmd, err) - const char *cmd; - char **err; +Cmd_Exec(const char *cmd, char **err) { char *args[4]; /* Args for invoking the shell */ int fds[2]; /* Pipe streams */ diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index 9a6613c6848..02ec6a20990 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: compat.c,v 1.49 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: compat.c,v 1.50 2004/04/07 13:11:35 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -82,8 +82,7 @@ static int shellneed(char **); static volatile sig_atomic_t interrupted; static void -CompatInterrupt(signo) - int signo; +CompatInterrupt(int signo) { if (interrupted != SIGINT) interrupted = signo; @@ -104,8 +103,7 @@ CompatInterrupt(signo) *----------------------------------------------------------------------- */ static int -shellneed(av) - char **av; +shellneed(char **av) { char *runsh[] = { "alias", "cd", "eval", "exec", "exit", "read", "set", "ulimit", @@ -156,9 +154,8 @@ shellneed(av) *----------------------------------------------------------------------- */ static int -CompatRunCommand(cmdp, gnp) - void * cmdp; /* Command to execute */ - void * gnp; /* Node from which the command came */ +CompatRunCommand(void *cmdp, /* Command to execute */ + void *gnp) /* Node from which the command came */ { char *cmdStart; /* Start of expanded command */ char *cp, *bp = NULL; @@ -375,9 +372,8 @@ CompatRunCommand(cmdp, gnp) *----------------------------------------------------------------------- */ static void -CompatMake(gnp, pgnp) - void * gnp; /* The node to make */ - void * pgnp; /* Parent to abort if necessary */ +CompatMake(void *gnp, /* The node to make */ + void *pgnp) /* Parent to abort if necessary */ { GNode *gn = (GNode *)gnp; GNode *pgn = (GNode *)pgnp; @@ -557,12 +553,11 @@ CompatMake(gnp, pgnp) } void -Compat_Run(targs) - Lst targs; /* List of target nodes to re-create */ +Compat_Run(Lst targs) /* List of target nodes to re-create */ { - char *cp; /* Pointer to string of shell meta-characters */ - GNode *gn = NULL;/* Current root target */ - int errors; /* Number of targets not remade due to errors */ + char *cp; /* Pointer to string of shell meta-characters */ + GNode *gn = NULL; /* Current root target */ + int errors; /* Number of targets not remade due to errors */ signal(SIGINT, CompatInterrupt); signal(SIGTERM, CompatInterrupt); diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index 0f2d45091a7..500057da0c4 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: cond.c,v 1.29 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: cond.c,v 1.30 2004/04/07 13:11:35 espie Exp $ */ /* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */ /* @@ -163,8 +163,7 @@ static bool skipLine = false; /* Whether the parse module is skipping * lines */ static const char * -find_cond(p) - const char *p; +find_cond(const char *p) { for (;;p++) { if (strchr(" \t)&|$", *p) != NULL) @@ -187,11 +186,8 @@ find_cond(p) *----------------------------------------------------------------------- */ static bool -CondGetArg(linePtr, arg, func, parens) - const char **linePtr; - struct Name *arg; - const char *func; - bool parens; /* true if arg should be bounded by parens */ +CondGetArg(const char **linePtr, struct Name *arg, const char *func, + bool parens) /* true if arg should be bounded by parens */ { const char *cp; @@ -244,8 +240,7 @@ CondGetArg(linePtr, arg, func, parens) *----------------------------------------------------------------------- */ static bool -CondDoDefined(arg) - struct Name *arg; +CondDoDefined(struct Name *arg) { if (Var_Valuei(arg->s, arg->e) != NULL) return true; @@ -263,8 +258,7 @@ CondDoDefined(arg) *----------------------------------------------------------------------- */ static bool -CondDoMake(arg) - struct Name *arg; +CondDoMake(struct Name *arg) { LstNode ln; @@ -287,8 +281,7 @@ CondDoMake(arg) *----------------------------------------------------------------------- */ static bool -CondDoExists(arg) - struct Name *arg; +CondDoExists(struct Name *arg) { bool result; char *path; @@ -313,8 +306,7 @@ CondDoExists(arg) *----------------------------------------------------------------------- */ static bool -CondDoTarget(arg) - struct Name *arg; +CondDoTarget(struct Name *arg) { GNode *gn; @@ -343,9 +335,7 @@ CondDoTarget(arg) *----------------------------------------------------------------------- */ static bool -CondCvtArg(str, value) - const char *str; - double *value; +CondCvtArg(const char *str, double *value) { if (*str == '0' && str[1] == 'x') { long i; @@ -372,8 +362,7 @@ CondCvtArg(str, value) static Token -CondHandleVarSpec(doEval) - bool doEval; +CondHandleVarSpec(bool doEval) { Token t; char *lhs; @@ -591,8 +580,7 @@ static struct operator { {NULL, 0, NULL} }; static Token -CondHandleDefault(doEval) - bool doEval; +CondHandleDefault(bool doEval) { bool t; bool (*evalProc)(struct Name *); @@ -682,8 +670,7 @@ CondHandleDefault(doEval) *----------------------------------------------------------------------- */ static Token -CondToken(doEval) - bool doEval; +CondToken(bool doEval) { if (condPushBack != None) { @@ -743,8 +730,7 @@ CondToken(doEval) *----------------------------------------------------------------------- */ static Token -CondT(doEval) - bool doEval; +CondT(bool doEval) { Token t; @@ -784,8 +770,7 @@ CondT(doEval) *----------------------------------------------------------------------- */ static Token -CondF(doEval) - bool doEval; +CondF(bool doEval) { Token l, o; @@ -824,8 +809,7 @@ CondF(doEval) *----------------------------------------------------------------------- */ static Token -CondE(doEval) - bool doEval; +CondE(bool doEval) { Token l, o; @@ -1099,7 +1083,7 @@ Cond_Eval(const char *line) } void -Cond_End() +Cond_End(void) { int i; diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index ed9c285b381..f4c6c146400 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: dir.c,v 1.40 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: dir.c,v 1.41 2004/04/07 13:11:35 espie Exp $ */ /* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* @@ -240,9 +240,7 @@ static void DirPrintWord(void *); static void DirPrintDir(void *); static void -record_stamp(file, t) - const char *file; - TIMESTAMP t; +record_stamp(const char *file, TIMESTAMP t) { unsigned int slot; const char *end = NULL; @@ -260,17 +258,13 @@ record_stamp(file, t) } static struct file_stamp * -find_stampi(file, end) - const char *file; - const char *end; +find_stampi(const char *file, const char *efile) { - return ohash_find(&mtimes, ohash_qlookupi(&mtimes, file, &end)); + return ohash_find(&mtimes, ohash_qlookupi(&mtimes, file, &efile)); } static void -add_file(p, file) - Path *p; - const char *file; +add_file(Path *p, const char *file) { unsigned int slot; const char *end = NULL; @@ -286,20 +280,15 @@ add_file(p, file) } static char * -find_file_hashi(p, file, e, hv) - Path *p; - const char *file; - const char *e; - u_int32_t hv; +find_file_hashi(Path *p, const char *file, const char *efile, u_int32_t hv) { struct ohash *h = &p->files; - return ohash_find(h, ohash_lookup_interval(h, file, e, hv)); + return ohash_find(h, ohash_lookup_interval(h, file, efile, hv)); } static void -free_hash(h) - struct ohash *h; +free_hash(struct ohash *h) { void *e; unsigned int i; @@ -312,7 +301,7 @@ free_hash(h) /* Side Effects: cache the current directory */ void -Dir_Init() +Dir_Init(void) { char *dotname = "."; @@ -333,7 +322,7 @@ Dir_Init() #ifdef CLEANUP void -Dir_End() +Dir_End(void) { struct Path *p; unsigned int i; @@ -352,15 +341,13 @@ Dir_End() /* XXX: This code is not 100% correct ([^]] fails) */ bool -Dir_HasWildcardsi(name, end) - const char *name; - const char *end; +Dir_HasWildcardsi(const char *name, const char *ename) { const char *cp; bool wild = false; unsigned long brace = 0, bracket = 0; - for (cp = name; cp != end; cp++) { + for (cp = name; cp != ename; cp++) { switch (*cp) { case '{': brace++; @@ -402,11 +389,7 @@ Dir_HasWildcardsi(name, end) *----------------------------------------------------------------------- */ static void -DirMatchFilesi(pattern, end, p, expansions) - const char *pattern; /* Pattern to look for */ - const char *end; /* End of pattern */ - Path *p; /* Directory to search */ - Lst expansions; /* Place to store the results */ +DirMatchFilesi(const char *word, const char *eword, Path *p, Lst expansions) { unsigned int search; /* Index into the directory's table */ const char *entry; /* Current entry in the table */ @@ -420,9 +403,9 @@ DirMatchFilesi(pattern, end, p, expansions) * convention that dot files will only be found if the pattern * begins with a dot (the hashing scheme doesn't hash . or .., * so they won't match `.*'. */ - if (*pattern != '.' && *entry == '.') + if (*word != '.' && *entry == '.') continue; - if (Str_Matchi(entry, strchr(entry, '\0'), pattern, end)) + if (Str_Matchi(entry, strchr(entry, '\0'), word, eword)) Lst_AtEnd(expansions, isDot ? estrdup(entry) : Str_concat(p->name, entry, '/')); } @@ -436,21 +419,16 @@ DirMatchFilesi(pattern, end, p, expansions) *----------------------------------------------------------------------- */ static void -PathMatchFilesi(word, end, path, expansions) - const char *word; /* Word to expand */ - const char *end; /* End of word */ - Lst path; /* Path on which to look */ - Lst expansions; /* Place to store the result */ +PathMatchFilesi(const char *word, const char *eword, Lst path, Lst expansions) { LstNode ln; /* Current node */ for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) - DirMatchFilesi(word, end, (Path *)Lst_Datum(ln), expansions); + DirMatchFilesi(word, eword, (Path *)Lst_Datum(ln), expansions); } static void -DirPrintWord(word) - void *word; +DirPrintWord(void *word) { printf("%s ", (char *)word); } @@ -467,29 +445,24 @@ DirPrintWord(word) *----------------------------------------------------------------------- */ static void -DirExpandWildi(word, end, path, expansions) - const char *word; /* the word to expand */ - const char *end; /* end of word */ - Lst path; /* the list of directories in which to find - * the resulting files */ - Lst expansions; /* the list on which to place the results */ +DirExpandWildi(const char *word, const char *eword, Lst path, Lst expansions) { const char *cp; const char *slash; /* keep track of first slash before wildcard */ - slash = memchr(word, '/', end - word); + slash = memchr(word, '/', eword - word); if (slash == NULL) { /* First the files in dot. */ - DirMatchFilesi(word, end, dot, expansions); + DirMatchFilesi(word, eword, dot, expansions); /* Then the files in every other directory on the path. */ - PathMatchFilesi(word, end, path, expansions); + PathMatchFilesi(word, eword, path, expansions); return; } /* The thing has a directory component -- find the first wildcard * in the string. */ slash = word; - for (cp = word; cp != end; cp++) { + for (cp = word; cp != eword; cp++) { if (*cp == '/') slash = cp; if (*cp == '?' || *cp == '[' || *cp == '*') { @@ -514,17 +487,17 @@ DirExpandWildi(word, end, path, expansions) Lst_Init(&temp); Dir_AddDiri(&temp, dirpath, dp); - PathMatchFilesi(slash+1, end, &temp, expansions); + PathMatchFilesi(slash+1, eword, &temp, expansions); Lst_Destroy(&temp, NOFREE); } } else /* Start the search from the local directory. */ - PathMatchFilesi(word, end, path, expansions); + PathMatchFilesi(word, eword, path, expansions); return; } } /* Return the file -- this should never happen. */ - PathMatchFilesi(word, end, path, expansions); + PathMatchFilesi(word, eword, path, expansions); } /*- @@ -538,11 +511,7 @@ DirExpandWildi(word, end, path, expansions) *----------------------------------------------------------------------- */ static void -DirExpandCurlyi(word, endw, path, expansions) - const char *word; /* Entire word to expand */ - const char *endw; /* End of word */ - Lst path; /* Search path to use */ - Lst expansions; /* Place to store the expansions */ +DirExpandCurlyi(const char *word, const char *eword, Lst path, Lst expansions) { const char *cp2; /* Pointer for checking for wildcards in * expansion before calling Dir_Expand */ @@ -552,7 +521,7 @@ DirExpandCurlyi(word, endw, path, expansions) /* Determine once and for all if there is something else going on */ dowild = false; - for (cp2 = word; cp2 != endw; cp2++) + for (cp2 = word; cp2 != eword; cp2++) if (*cp2 == '*' || *cp2 == '?' || *cp2 == '[') { dowild = true; break; @@ -560,7 +529,7 @@ DirExpandCurlyi(word, endw, path, expansions) /* Prime queue with copy of initial word */ Lst_Init(&curled); - Lst_EnQueue(&curled, Str_dupi(word, endw)); + Lst_EnQueue(&curled, Str_dupi(word, eword)); while ((toexpand = (char *)Lst_DeQueue(&curled)) != NULL) { const char *brace; const char *start; /* Start of current chunk of brace clause */ @@ -632,26 +601,21 @@ DirExpandCurlyi(word, endw, path, expansions) /* Side effects: * Dir_Expandi will hash directories that were not yet visited */ void -Dir_Expandi(word, end, path, expansions) - const char *word; /* the word to expand */ - const char *end; /* end of word */ - Lst path; /* the list of directories in which to find - * the resulting files */ - Lst expansions; /* the list on which to place the results */ +Dir_Expandi(const char *word, const char *eword, Lst path, Lst expansions) { const char *cp; if (DEBUG(DIR)) { - char *s = Str_dupi(word, end); + char *s = Str_dupi(word, eword); printf("expanding \"%s\"...", s); free(s); } - cp = memchr(word, '{', end - word); + cp = memchr(word, '{', eword - word); if (cp) - DirExpandCurlyi(word, end, path, expansions); + DirExpandCurlyi(word, eword, path, expansions); else - DirExpandWildi(word, end, path, expansions); + DirExpandWildi(word, eword, path, expansions); if (DEBUG(DIR)) { Lst_Every(expansions, DirPrintWord); @@ -670,10 +634,7 @@ Dir_Expandi(word, end, path, expansions) * that directory later on. */ char * -Dir_FindFilei(name, end, path) - const char *name; - const char *end; - Lst path; +Dir_FindFilei(const char *name, const char *ename, Lst path) { Path *p; /* current path member */ char *p1; /* pointer into p->name */ @@ -686,11 +647,11 @@ Dir_FindFilei(name, end, path) struct stat stb; /* Buffer for stat, if necessary */ struct file_stamp *entry; /* Entry for mtimes table */ u_int32_t hv; /* hash value for last component in file name */ - char *q; /* Str_dupi(name, end) */ + char *q; /* Str_dupi(name, ename) */ /* Find the final component of the name and note whether name has a * slash in it */ - cp = Str_rchri(name, end, '/'); + cp = Str_rchri(name, ename, '/'); if (cp) { hasSlash = true; cp++; @@ -699,7 +660,7 @@ Dir_FindFilei(name, end, path) cp = name; } - hv = ohash_interval(cp, &end); + hv = ohash_interval(cp, &ename); if (DEBUG(DIR)) printf("Searching for %s...", name); @@ -707,14 +668,14 @@ Dir_FindFilei(name, end, path) * before anywhere else and we always return exactly what the caller * specified. */ if ((!hasSlash || (cp - name == 2 && *name == '.')) && - find_file_hashi(dot, cp, end, hv) != NULL) { + find_file_hashi(dot, cp, ename, hv) != NULL) { if (DEBUG(DIR)) printf("in '.'\n"); #ifdef DEBUG_DIRECTORY_CACHE hits++; dot->hits++; #endif - return Str_dupi(name, end); + return Str_dupi(name, ename); } /* Then, we look through all the directories on path, seeking one @@ -726,7 +687,7 @@ Dir_FindFilei(name, end, path) p = (Path *)Lst_Datum(ln); if (DEBUG(DIR)) printf("%s...", p->name); - if (find_file_hashi(p, cp, end, hv) != NULL) { + if (find_file_hashi(p, cp, ename, hv) != NULL) { if (DEBUG(DIR)) printf("here..."); if (hasSlash) { @@ -748,7 +709,7 @@ Dir_FindFilei(name, end, path) continue; } } - file = Str_concati(p->name, strchr(p->name, '\0'), cp, end, '/'); + file = Str_concati(p->name, strchr(p->name, '\0'), cp, ename, '/'); if (DEBUG(DIR)) printf("returning %s\n", file); #ifdef DEBUG_DIRECTORY_CACHE @@ -799,10 +760,10 @@ Dir_FindFilei(name, end, path) for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) { p = (Path *)Lst_Datum(ln); if (p != dot) - file = Str_concati(p->name, strchr(p->name, '\0'), name, end, '/'); + file = Str_concati(p->name, strchr(p->name, '\0'), name, ename, '/'); else { /* Checking in dot -- DON'T put a leading ./ on the thing. */ - file = Str_dupi(name, end); + file = Str_dupi(name, ename); checkedDot = true; } if (DEBUG(DIR)) @@ -862,14 +823,14 @@ Dir_FindFilei(name, end, path) * $(FILE) exists in $(INSTALLDIR) but not in the current one. * When searching for $(FILE), we will find it in $(INSTALLDIR) * b/c we added it here. This is not good... */ - q = Str_dupi(name, end); + q = Str_dupi(name, ename); if (DEBUG(DIR)) printf("Looking for \"%s\"...", q); #ifdef DEBUG_DIRECTORY_CACHE bigmisses++; #endif - entry = find_stampi(name, end); + entry = find_stampi(name, ename); if (entry != NULL) { if (DEBUG(DIR)) printf("got it (in mtime cache)\n"); @@ -893,22 +854,20 @@ Dir_FindFilei(name, end, path) /* Read a directory, either from the disk, or from the cache. */ static Path * -DirReaddiri(name, end) - const char *name; - const char *end; +DirReaddiri(const char *name, const char *ename) { Path *p; /* pointer to new Path structure */ DIR *d; /* for reading directory */ struct dirent *dp; /* entry in directory */ unsigned int slot; - slot = ohash_qlookupi(&openDirectories, name, &end); + slot = ohash_qlookupi(&openDirectories, name, &ename); p = ohash_find(&openDirectories, slot); if (p != NULL) return p; - p = ohash_create_entry(&dir_info, name, &end); + p = ohash_create_entry(&dir_info, name, &ename); #ifdef DEBUG_DIRECTORY_CACHE p->hits = 0; #endif @@ -958,14 +917,11 @@ DirReaddiri(name, end) */ void -Dir_AddDiri(path, name, end) - Lst path; /* the path to which the directory should be added */ - const char *name; /* the name of the directory to add */ - const char *end; +Dir_AddDiri(Lst path, const char *name, const char *ename) { Path *p; /* pointer to new Path structure */ - p = DirReaddiri(name, end); + p = DirReaddiri(name, ename); if (p == NULL) return; if (p->refCount == 0) @@ -989,8 +945,7 @@ Dir_AddDiri(path, name, end) *----------------------------------------------------------------------- */ void * -Dir_CopyDir(p) - void *p; +Dir_CopyDir(void *p) { ((Path *)p)->refCount++; return p; @@ -1011,9 +966,7 @@ Dir_CopyDir(p) *----------------------------------------------------------------------- */ char * -Dir_MakeFlags(flag, path) - const char *flag; /* flag which should precede each directory */ - Lst path; /* list of directories */ +Dir_MakeFlags(const char *flag, Lst path) { LstNode ln; /* the node of the current directory */ BUFFER buf; @@ -1041,8 +994,7 @@ Dir_MakeFlags(flag, path) *----------------------------------------------------------------------- */ void -Dir_Destroy(pp) - void *pp; /* The directory descriptor to nuke */ +Dir_Destroy(void *pp) { Path *p = (Path *)pp; @@ -1064,9 +1016,7 @@ Dir_Destroy(pp) *----------------------------------------------------------------------- */ void -Dir_Concat(path1, path2) - Lst path1; /* Dest */ - Lst path2; /* Source */ +Dir_Concat(Lst path1, Lst path2) { LstNode ln; Path *p; @@ -1080,7 +1030,7 @@ Dir_Concat(path1, path2) #ifdef DEBUG_DIRECTORY_CACHE void -Dir_PrintDirectories() +Dir_PrintDirectories(void) { Path *p; unsigned int i; @@ -1098,23 +1048,19 @@ Dir_PrintDirectories() #endif static void -DirPrintDir(p) - void *p; +DirPrintDir(void *p) { printf("%s ", ((Path *)p)->name); } void -Dir_PrintPath(path) - Lst path; +Dir_PrintPath(Lst path) { Lst_Every(path, DirPrintDir); } TIMESTAMP -Dir_MTime(gn) - GNode *gn; /* the file whose modification time is - * desired */ +Dir_MTime(GNode *gn) { char *fullName; /* the full pathname of name */ struct stat stb; /* buffer for finding the mod time */ diff --git a/usr.bin/make/error.c b/usr.bin/make/error.c index b5fd187fcb3..0b9278a0c48 100644 --- a/usr.bin/make/error.c +++ b/usr.bin/make/error.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: error.c,v 1.11 2002/05/17 11:58:56 espie Exp $ */ +/* $OpenBSD: error.c,v 1.12 2004/04/07 13:11:35 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -113,7 +113,7 @@ Punt(char *fmt, ...) * A big one... */ void -DieHorribly() +DieHorribly(void) { Job_AbortAll(); if (DEBUG(GRAPH2)) @@ -130,8 +130,7 @@ DieHorribly() * The program exits */ void -Finish(errors) - int errors; /* number of errors encountered in Make_Make */ +Finish(int errors) /* number of errors encountered in Make_Make */ { Fatal("%d error%s", errors, errors == 1 ? "" : "s"); } @@ -174,7 +173,8 @@ Parse_Error(int type, const char *fmt, ...) va_list ap; va_start(ap, fmt); - ParseVErrorInternal(Parse_Getfilename(), Parse_Getlineno(), type, fmt, ap); + ParseVErrorInternal(Parse_Getfilename(), Parse_Getlineno(), type, + fmt, ap); va_end(ap); } diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index f141f04c6ce..1447079c78c 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: for.c,v 1.29 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: for.c,v 1.30 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */ /* @@ -114,9 +114,7 @@ static void ForExec(void *, void *); static unsigned long build_words_list(Lst, const char *); static unsigned long -build_words_list(lst, s) - Lst lst; - const char *s; +build_words_list(Lst lst, const char *s) { const char *end, *wrd; unsigned long n; @@ -132,8 +130,7 @@ build_words_list(lst, s) } For * -For_Eval(line) - const char *line; /* Line to parse */ +For_Eval(const char *line) { const char *ptr = line; const char *wrd; @@ -199,9 +196,7 @@ For_Eval(line) bool -For_Accumulate(arg, line) - For *arg; - const char *line; /* Line to parse */ +For_Accumulate(For *arg, const char *line) { const char *ptr = line; @@ -235,9 +230,7 @@ For_Accumulate(arg, line) #define GUESS_EXPANSION 32 static void -ForExec(valuep, argp) - void *valuep; - void *argp; +ForExec(void *valuep, void *argp) { char *value = (char *)valuep; For *arg = (For *)argp; @@ -267,8 +260,7 @@ ForExec(valuep, argp) void -For_Run(arg) - For *arg; +For_Run(For *arg) { arg->text = Buf_Retrieve(&arg->buf); arg->guess = Buf_Size(&arg->buf) + GUESS_EXPANSION; diff --git a/usr.bin/make/init.c b/usr.bin/make/init.c index 71afa520df5..6a69b806c1e 100644 --- a/usr.bin/make/init.c +++ b/usr.bin/make/init.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: init.c,v 1.1 2001/05/23 12:34:43 espie Exp $ */ +/* $OpenBSD: init.c,v 1.2 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -40,7 +40,7 @@ #include "job.h" void -Init() +Init(void) { Init_Timestamp(); Init_Stats(); @@ -56,7 +56,7 @@ Init() } void -End() +End(void) { Suff_End(); Targ_End(); diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 46f4516809a..6c2764bdb1b 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: job.c,v 1.55 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: job.c,v 1.56 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -457,9 +457,8 @@ static void JobRestartJobs(void); *----------------------------------------------------------------------- */ static void -JobCondPassSig(jobp, signop) - void *jobp; /* Job to biff */ - void *signop; /* Signal to send it */ +JobCondPassSig(void *jobp, /* Job to biff */ + void *signop) /* Signal to send it */ { Job *job = (Job *)jobp; int signo = *(int *)signop; @@ -483,8 +482,7 @@ JobCondPassSig(jobp, signop) *----------------------------------------------------------------------- */ static void -JobPassSig(signo) - int signo; /* The signal number we've received */ +JobPassSig(int signo) /* The signal number we've received */ { int save_errno = errno; sigset_t nmask, omask; @@ -561,9 +559,8 @@ JobPassSig(signo) *----------------------------------------------------------------------- */ static int -JobCmpPid(job, pid) - void *job; /* job to examine */ - void *pid; /* process id desired */ +JobCmpPid(void *job, /* job to examine */ + void *pid) /* process id desired */ { return *(pid_t *)pid - ((Job *)job)->pid; } @@ -596,9 +593,8 @@ JobCmpPid(job, pid) *----------------------------------------------------------------------- */ static int -JobPrintCommand(cmdp, jobp) - void *cmdp; /* command string to print */ - void *jobp; /* job for which to print it */ +JobPrintCommand(void *cmdp, /* command string to print */ + void *jobp) /* job for which to print it */ { bool noSpecials; /* true if we shouldn't worry about * inserting special commands into @@ -750,9 +746,7 @@ JobPrintCommand(cmdp, jobp) *----------------------------------------------------------------------- */ static void -JobSaveCommand(cmd, gn) - void *cmd; - void *gn; +JobSaveCommand(void *cmd, void *gn) { GNode *g = (GNode *)gn; char *result; @@ -772,8 +766,7 @@ JobSaveCommand(cmd, gn) *----------------------------------------------------------------------- */ static void -JobClose(job) - Job *job; +JobClose(Job *job) { if (usePipes) { FD_CLR(job->inPipe, outputsp); @@ -810,9 +803,8 @@ JobClose(job) */ /*ARGSUSED*/ static void -JobFinish(job, status) - Job *job; /* job to finish */ - int *status; /* sub-why job went away */ +JobFinish(Job *job, /* job to finish */ + int *status) /* sub-why job went away */ { bool done; @@ -1053,9 +1045,8 @@ JobFinish(job, status) *----------------------------------------------------------------------- */ void -Job_Touch(gn, silent) - GNode *gn; /* the node of the file to touch */ - bool silent; /* true if should not print messages */ +Job_Touch(GNode *gn, /* the node of the file to touch */ + bool silent) /* true if should not print messages */ { int streamID; /* ID of stream opened to do the touch */ @@ -1122,11 +1113,9 @@ Job_Touch(gn, silent) *----------------------------------------------------------------------- */ bool -Job_CheckCommands(gn, abortProc) - GNode *gn; /* The target whose commands need - * verifying */ - void (*abortProc)(char *, ...); - /* Function to abort with message */ +Job_CheckCommands(GNode *gn, /* The target whose commands need + * verifying */ + void (*abortProc)(char *, ...)) /* Function to abort with message */ { if (OP_NOP(gn->type) && Lst_IsEmpty(&gn->commands) && (gn->type & OP_LIB) == 0) { @@ -1185,9 +1174,7 @@ Job_CheckCommands(gn, abortProc) *----------------------------------------------------------------------- */ static void -JobExec(job, argv) - Job *job; /* Job to execute */ - char **argv; +JobExec(Job *job, char **argv) { pid_t cpid; /* ID of new child */ @@ -1326,9 +1313,7 @@ JobExec(job, argv) *----------------------------------------------------------------------- */ static void -JobMakeArgv(job, argv) - Job *job; - char **argv; +JobMakeArgv(Job *job, char **argv) { int argc; static char args[10]; /* For merged arguments */ @@ -1378,8 +1363,7 @@ JobMakeArgv(job, argv) *----------------------------------------------------------------------- */ static void -JobRestart(job) - Job *job; /* Job to restart */ +JobRestart(Job *job) { if (job->flags & JOB_RESTART) { /* @@ -1506,11 +1490,10 @@ JobRestart(job) *----------------------------------------------------------------------- */ static int -JobStart(gn, flags, previous) - GNode *gn; /* target to create */ - int flags; /* flags for the job to override normal ones. +JobStart(GNode *gn, /* target to create */ + int flags, /* flags for the job to override normal ones. * e.g. JOB_SPECIAL or JOB_IGNDOTS */ - Job *previous; /* The previous Job structure for this node, + Job *previous) /* The previous Job structure for this node, * if any. */ { Job *job; /* new job descriptor */ @@ -1776,10 +1759,7 @@ JobStart(gn, flags, previous) } static char * -JobOutput(job, cp, endp, msg) - Job *job; - char *cp, *endp; - int msg; +JobOutput(Job *job, char *cp, char *endp, int msg) { char *ecp; @@ -1846,9 +1826,8 @@ JobOutput(job, cp, endp, msg) *----------------------------------------------------------------------- */ static void -JobDoOutput(job, finish) - Job *job; /* the job whose output needs printing */ - bool finish; /* true if this is the last time we'll be +JobDoOutput(Job *job, /* the job whose output needs printing */ + bool finish) /* true if this is the last time we'll be * called for this job */ { bool gotNL = false; /* true if got a newline */ @@ -2038,8 +2017,7 @@ end_loop: *----------------------------------------------------------------------- */ void -Job_CatchChildren(block) - bool block; /* true if should block on the wait. */ +Job_CatchChildren(bool block) /* true if should block on the wait. */ { pid_t pid; /* pid of dead child */ Job *job; /* job descriptor for dead child */ @@ -2107,7 +2085,7 @@ Job_CatchChildren(block) * ----------------------------------------------------------------------- */ void -Job_CatchOutput() +Job_CatchOutput(void) { int nfds; struct timeval timeout; @@ -2153,8 +2131,7 @@ Job_CatchOutput() *----------------------------------------------------------------------- */ void -Job_Make(gn) - GNode *gn; +Job_Make(GNode *gn) { (void)JobStart(gn, 0, NULL); } @@ -2169,10 +2146,9 @@ Job_Make(gn) *----------------------------------------------------------------------- */ void -Job_Init(maxproc, maxlocal) - int maxproc; /* the greatest number of jobs which may be +Job_Init(int maxproc, /* the greatest number of jobs which may be * running at one time */ - int maxlocal; /* the greatest number of local jobs which may + int maxlocal) /* the greatest number of local jobs which may * be running at once. */ { GNode *begin; /* node for commands to do at the very start */ @@ -2288,7 +2264,7 @@ Job_Init(maxproc, maxlocal) *----------------------------------------------------------------------- */ bool -Job_Full() +Job_Full(void) { return aborting || jobFull; } @@ -2306,7 +2282,7 @@ Job_Full() * ----------------------------------------------------------------------- */ bool -Job_Empty() +Job_Empty(void) { if (nJobs == 0) { if (!Lst_IsEmpty(&stoppedJobs) && !aborting) { @@ -2335,8 +2311,7 @@ Job_Empty() *----------------------------------------------------------------------- */ static Shell * -JobMatchShell(name) - char *name; /* Final component of shell path */ +JobMatchShell(char *name) /* Final component of shell path */ { Shell *sh; /* Pointer into shells table */ Shell *match; /* Longest-matching shell */ @@ -2406,8 +2381,7 @@ JobMatchShell(name) *----------------------------------------------------------------------- */ bool -Job_ParseShell(line) - char *line; /* The shell spec */ +Job_ParseShell(const char *line) /* The shell spec */ { char **words; int wordCount; @@ -2541,10 +2515,9 @@ Job_ParseShell(line) *----------------------------------------------------------------------- */ static void -JobInterrupt(runINTERRUPT, signo) - int runINTERRUPT; /* Non-zero if commands for the .INTERRUPT +JobInterrupt(int runINTERRUPT, /* Non-zero if commands for the .INTERRUPT * target should be executed */ - int signo; /* signal received */ + int signo) /* signal received */ { LstNode ln; /* element in job table */ Job *job; /* job descriptor in that element */ @@ -2605,7 +2578,7 @@ JobInterrupt(runINTERRUPT, signo) *----------------------------------------------------------------------- */ int -Job_Finish() +Job_Finish(void) { if (postCommands != NULL && !Lst_IsEmpty(&postCommands->commands)) { if (errors) { @@ -2634,7 +2607,7 @@ Job_Finish() */ #ifdef CLEANUP void -Job_End() +Job_End(void) { efree(shellArgv); } @@ -2652,7 +2625,7 @@ Job_End() *----------------------------------------------------------------------- */ void -Job_Wait() +Job_Wait(void) { aborting = ABORT_WAIT; while (nJobs != 0) { @@ -2674,7 +2647,7 @@ Job_Wait() *----------------------------------------------------------------------- */ void -Job_AbortAll() +Job_AbortAll(void) { LstNode ln; /* element in job table */ Job *job; /* the job descriptor in that element */ @@ -2715,7 +2688,7 @@ Job_AbortAll() *----------------------------------------------------------------------- */ static void -JobRestartJobs() +JobRestartJobs(void) { Job *job; diff --git a/usr.bin/make/job.h b/usr.bin/make/job.h index 676eadb420a..15052fedddf 100644 --- a/usr.bin/make/job.h +++ b/usr.bin/make/job.h @@ -2,7 +2,7 @@ #define _JOB_H_ /* $OpenPackages$ */ -/* $OpenBSD: job.h,v 1.14 2003/06/03 02:56:11 millert Exp $ */ +/* $OpenBSD: job.h,v 1.15 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: job.h,v 1.5 1996/11/06 17:59:10 christos Exp $ */ /* @@ -55,7 +55,7 @@ extern void Job_Make(GNode *); extern void Job_Init(int, int); extern bool Job_Full(void); extern bool Job_Empty(void); -extern bool Job_ParseShell(char *); +extern bool Job_ParseShell(const char *); extern int Job_Finish(void); #ifdef CLEANUP extern void Job_End(void); diff --git a/usr.bin/make/lowparse.c b/usr.bin/make/lowparse.c index 974e5fddf6a..41d67596de0 100644 --- a/usr.bin/make/lowparse.c +++ b/usr.bin/make/lowparse.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lowparse.c,v 1.17 2002/12/29 17:29:35 espie Exp $ */ +/* $OpenBSD: lowparse.c,v 1.18 2004/04/07 13:11:36 espie Exp $ */ /* low-level parsing functions. */ @@ -108,9 +108,7 @@ static void ParseFoldLF(Buffer, int); static int ParseSkipEmptyLines(Buffer); static IFile * -new_ifile(name, stream) - const char *name; - FILE *stream; +new_ifile(const char *name, FILE *stream) { IFile *ifile; #if 0 @@ -128,8 +126,7 @@ new_ifile(name, stream) } static void -free_ifile(ifile) - IFile *ifile; +free_ifile(IFile *ifile) { if (ifile->F && fileno(ifile->F) != STDIN_FILENO) (void)fclose(ifile->F); @@ -140,10 +137,7 @@ free_ifile(ifile) } static IFile * -new_istring(str, name, lineno) - char *str; - const char *name; - unsigned long lineno; +new_istring(char *str, const char *name, unsigned long lineno) { IFile *ifile; @@ -161,9 +155,7 @@ new_istring(str, name, lineno) void -Parse_FromString(str, lineno) - char *str; - unsigned long lineno; +Parse_FromString(char *str, unsigned long lineno) { if (DEBUG(FOR)) (void)fprintf(stderr, "%s\n----\n", str); @@ -175,9 +167,7 @@ Parse_FromString(str, lineno) void -Parse_FromFile(name, stream) - const char *name; - FILE *stream; +Parse_FromFile(const char *name, FILE *stream) { if (current != NULL) Lst_Push(&input_stack, current); @@ -185,7 +175,7 @@ Parse_FromFile(name, stream) } bool -Parse_NextFile() +Parse_NextFile(void) { if (current != NULL) free_ifile(current); @@ -194,7 +184,7 @@ Parse_NextFile() } static int -newline() +newline(void) { size_t len; @@ -211,7 +201,7 @@ newline() } static int -skiptoendofline() +skiptoendofline(void) { if (current->F) { if (current->end - current->ptr > 1) @@ -231,8 +221,7 @@ skiptoendofline() char * -Parse_ReadNextConditionalLine(linebuf) - Buffer linebuf; +Parse_ReadNextConditionalLine(Buffer linebuf) { int c; @@ -257,9 +246,7 @@ Parse_ReadNextConditionalLine(linebuf) } static void -ParseFoldLF(linebuf, c) - Buffer linebuf; - int c; +ParseFoldLF(Buffer linebuf, int c) { for (;;) { if (c == '\n') { @@ -291,9 +278,7 @@ ParseFoldLF(linebuf, c) } char * -Parse_ReadUnparsedLine(linebuf, type) - Buffer linebuf; - const char *type; +Parse_ReadUnparsedLine(Buffer linebuf, const char *type) { int c; @@ -329,8 +314,7 @@ Parse_ReadUnparsedLine(linebuf, type) /* This is a fairly complex function, but without it, we could not skip * blocks of comments without reading them. */ static int -ParseSkipEmptyLines(linebuf) - Buffer linebuf; +ParseSkipEmptyLines(Buffer linebuf) { int c; /* the current character */ @@ -401,18 +385,17 @@ ParseSkipEmptyLines(linebuf) } /* Parse_ReadNormalLine removes beginning and trailing blanks (but keeps - * the first tab), handles escaped newlines, and skip over uninteresting + * the first tab), handles escaped newlines, and skips over uninteresting * lines. * - * The line number is advanced, which implies that continuation - * lines are numbered with the last line no (we could do better, at a + * The line number is incremented, which implies that continuation + * lines are numbered with the last line number (we could do better, at a * price). * * Trivial comments are also removed, but we can't do more, as * we don't know which lines are shell commands or not. */ char * -Parse_ReadNormalLine(linebuf) - Buffer linebuf; +Parse_ReadNormalLine(Buffer linebuf) { int c; /* the current character */ @@ -428,27 +411,27 @@ Parse_ReadNormalLine(linebuf) } unsigned long -Parse_Getlineno() +Parse_Getlineno(void) { return current ? current->lineno : 0; } const char * -Parse_Getfilename() +Parse_Getfilename(void) { return current ? current->fname : NULL; } #ifdef CLEANUP void -LowParse_Init() +LowParse_Init(void) { Static_Lst_Init(&input_stack); current = NULL; } void -LowParse_End() +LowParse_End(void) { Lst_Destroy(&input_stack, NOFREE); /* Should be empty now */ #if 0 @@ -459,7 +442,7 @@ LowParse_End() void -Parse_ReportErrors() +Parse_ReportErrors(void) { if (fatal_errors) { #ifdef CLEANUP diff --git a/usr.bin/make/lst.lib/lstAddNew.c b/usr.bin/make/lst.lib/lstAddNew.c index ffa585f579a..194b977e2d9 100644 --- a/usr.bin/make/lst.lib/lstAddNew.c +++ b/usr.bin/make/lst.lib/lstAddNew.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstAddNew.c,v 1.3 2001/05/29 12:53:44 espie Exp $ */ +/* $OpenBSD: lstAddNew.c,v 1.4 2004/04/07 13:11:36 espie Exp $ */ /* ex:ts=8 sw=4: */ @@ -37,9 +37,7 @@ * Returns false if datum was already there. */ bool -Lst_AddNew(l, d) - Lst l; - void *d; +Lst_AddNew(Lst l, void *d) { if (Lst_Member(l, d) != NULL) return false; diff --git a/usr.bin/make/lst.lib/lstAppend.c b/usr.bin/make/lst.lib/lstAppend.c index 9c9acfb702c..54e3d1a5da5 100644 --- a/usr.bin/make/lst.lib/lstAppend.c +++ b/usr.bin/make/lst.lib/lstAppend.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstAppend.c,v 1.15 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstAppend.c,v 1.16 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstAppend.c,v 1.5 1996/11/06 17:59:31 christos Exp $ */ /* @@ -58,42 +58,37 @@ *----------------------------------------------------------------------- */ void -Lst_Append(l, ln, d) - Lst l; /* affected list */ - LstNode ln; /* node after which to append the datum */ - void *d; /* said datum */ +Lst_Append(Lst l, LstNode after, void *d) { LstNode nLNode; - if (ln == NULL && !Lst_IsEmpty(l)) + if (after == NULL && !Lst_IsEmpty(l)) return; - if (ln != NULL && Lst_IsEmpty(l)) + if (after != NULL && Lst_IsEmpty(l)) return; PAlloc(nLNode, LstNode); nLNode->datum = d; - if (ln == NULL) { + if (after == NULL) { nLNode->nextPtr = nLNode->prevPtr = NULL; l->firstPtr = l->lastPtr = nLNode; } else { - nLNode->prevPtr = ln; - nLNode->nextPtr = ln->nextPtr; + nLNode->prevPtr = after; + nLNode->nextPtr = after->nextPtr; - ln->nextPtr = nLNode; + after->nextPtr = nLNode; if (nLNode->nextPtr != NULL) nLNode->nextPtr->prevPtr = nLNode; - if (ln == l->lastPtr) + if (after == l->lastPtr) l->lastPtr = nLNode; } } void -Lst_AtEnd(l, d) - Lst l; - void *d; +Lst_AtEnd(Lst l, void *d) { LstNode ln; diff --git a/usr.bin/make/lst.lib/lstConcat.c b/usr.bin/make/lst.lib/lstConcat.c index a1b990c8137..585a45a560e 100644 --- a/usr.bin/make/lst.lib/lstConcat.c +++ b/usr.bin/make/lst.lib/lstConcat.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstConcat.c,v 1.15 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstConcat.c,v 1.16 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstConcat.c,v 1.6 1996/11/06 17:59:34 christos Exp $ */ /* @@ -54,13 +54,11 @@ * should be called first. * * Side Effects: - * New elements are created and appended the the first list. + * New elements are created and appended to the first list. *----------------------------------------------------------------------- */ void -Lst_Concat(l1, l2) - Lst l1; /* The list to which l2 is to be appended */ - Lst l2; /* The list to append to l1 */ +Lst_Concat(Lst l1, Lst l2) { LstNode ln; /* original LstNode */ LstNode nln; /* new LstNode */ diff --git a/usr.bin/make/lst.lib/lstConcatDestroy.c b/usr.bin/make/lst.lib/lstConcatDestroy.c index 6b5ec0329a3..e1abf31a85f 100644 --- a/usr.bin/make/lst.lib/lstConcatDestroy.c +++ b/usr.bin/make/lst.lib/lstConcatDestroy.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstConcatDestroy.c,v 1.6 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstConcatDestroy.c,v 1.7 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstConcat.c,v 1.6 1996/11/06 17:59:34 christos Exp $ */ /* @@ -55,9 +55,7 @@ *----------------------------------------------------------------------- */ void -Lst_ConcatDestroy(l1, l2) - Lst l1; /* The list to which l2 is to be appended */ - Lst l2; /* The list to append to l1 */ +Lst_ConcatDestroy(Lst l1, Lst l2) { if (l2->firstPtr != NULL) { /* diff --git a/usr.bin/make/lst.lib/lstDeQueue.c b/usr.bin/make/lst.lib/lstDeQueue.c index 70d44569813..573a6ca26f3 100644 --- a/usr.bin/make/lst.lib/lstDeQueue.c +++ b/usr.bin/make/lst.lib/lstDeQueue.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstDeQueue.c,v 1.14 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstDeQueue.c,v 1.15 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstDeQueue.c,v 1.5 1996/11/06 17:59:36 christos Exp $ */ /* @@ -55,8 +55,7 @@ *----------------------------------------------------------------------- */ void * -Lst_DeQueue(l) - Lst l; +Lst_DeQueue(Lst l) { void *rd; LstNode tln; diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c index c077bdeea2a..42a280834b7 100644 --- a/usr.bin/make/lst.lib/lstDestroy.c +++ b/usr.bin/make/lst.lib/lstDestroy.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstDestroy.c,v 1.15 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstDestroy.c,v 1.16 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstDestroy.c,v 1.6 1996/11/06 17:59:37 christos Exp $ */ /* @@ -55,9 +55,7 @@ *----------------------------------------------------------------------- */ void -Lst_Destroy(l, freeProc) - Lst l; - SimpleProc freeProc; +Lst_Destroy(Lst l, SimpleProc freeProc) { LstNode ln; LstNode tln; diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c index 4816cd9f9a3..9689423a4f0 100644 --- a/usr.bin/make/lst.lib/lstDupl.c +++ b/usr.bin/make/lst.lib/lstDupl.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstDupl.c,v 1.17 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstDupl.c,v 1.18 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstDupl.c,v 1.6 1996/11/06 17:59:37 christos Exp $ */ /* @@ -57,10 +57,7 @@ *----------------------------------------------------------------------- */ Lst -Lst_Clone(nl, l, copyProc) - Lst nl; - Lst l; /* the list to duplicate */ - DuplicateProc copyProc; /* A function to duplicate each void * */ +Lst_Clone(Lst nl, Lst l, DuplicateProc copyProc) { LstNode ln; diff --git a/usr.bin/make/lst.lib/lstFindFrom.c b/usr.bin/make/lst.lib/lstFindFrom.c index b13aa47c346..8bdb564c245 100644 --- a/usr.bin/make/lst.lib/lstFindFrom.c +++ b/usr.bin/make/lst.lib/lstFindFrom.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstFindFrom.c,v 1.13 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstFindFrom.c,v 1.14 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstFindFrom.c,v 1.6 1996/11/06 17:59:40 christos Exp $ */ /* @@ -54,10 +54,7 @@ *----------------------------------------------------------------------- */ LstNode -Lst_FindFrom(ln, cProc, d) - LstNode ln; - FindProc cProc; - void *d; +Lst_FindFrom(LstNode ln, FindProc cProc, void *d) { LstNode tln; diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c index 24407f77e56..7ef94f4ad62 100644 --- a/usr.bin/make/lst.lib/lstForEachFrom.c +++ b/usr.bin/make/lst.lib/lstForEachFrom.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstForEachFrom.c,v 1.13 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstForEachFrom.c,v 1.14 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstForEachFrom.c,v 1.5 1996/11/06 17:59:42 christos Exp $ */ /* @@ -55,10 +55,7 @@ *----------------------------------------------------------------------- */ void -Lst_ForEachFrom(ln, proc, d) - LstNode ln; - ForEachProc proc; - void *d; +Lst_ForEachFrom(LstNode ln, ForEachProc proc, void *d) { LstNode tln; @@ -67,9 +64,7 @@ Lst_ForEachFrom(ln, proc, d) } void -Lst_Every(l, proc) - Lst l; - SimpleProc proc; +Lst_Every(Lst l, SimpleProc proc) { LstNode tln; diff --git a/usr.bin/make/lst.lib/lstInit.c b/usr.bin/make/lst.lib/lstInit.c index 6bc6ea73a97..fecea57ed5d 100644 --- a/usr.bin/make/lst.lib/lstInit.c +++ b/usr.bin/make/lst.lib/lstInit.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstInit.c,v 1.14 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstInit.c,v 1.15 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstInit.c,v 1.5 1996/11/06 17:59:43 christos Exp $ */ /* @@ -49,8 +49,7 @@ *----------------------------------------------------------------------- */ void -Lst_Init(l) - Lst l; +Lst_Init(Lst l) { l->firstPtr = NULL; l->lastPtr = NULL; diff --git a/usr.bin/make/lst.lib/lstInsert.c b/usr.bin/make/lst.lib/lstInsert.c index a4321e7cc16..5b9c89fd493 100644 --- a/usr.bin/make/lst.lib/lstInsert.c +++ b/usr.bin/make/lst.lib/lstInsert.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstInsert.c,v 1.15 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstInsert.c,v 1.16 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstInsert.c,v 1.5 1996/11/06 17:59:44 christos Exp $ */ /* @@ -57,44 +57,39 @@ *----------------------------------------------------------------------- */ void -Lst_Insert(l, ln, d) - Lst l; /* list to manipulate */ - LstNode ln; /* node before which to insert d */ - void *d; /* datum to be inserted */ +Lst_Insert(Lst l, LstNode before, void *d) { LstNode nLNode; /* new lnode for d */ - if (ln == NULL && !Lst_IsEmpty(l)) + if (before == NULL && !Lst_IsEmpty(l)) return; - if (ln != NULL && Lst_IsEmpty(l)) + if (before != NULL && Lst_IsEmpty(l)) return; PAlloc(nLNode, LstNode); nLNode->datum = d; - if (ln == NULL) { + if (before == NULL) { nLNode->prevPtr = nLNode->nextPtr = NULL; l->firstPtr = l->lastPtr = nLNode; } else { - nLNode->prevPtr = ln->prevPtr; - nLNode->nextPtr = ln; + nLNode->prevPtr = before->prevPtr; + nLNode->nextPtr = before; if (nLNode->prevPtr != NULL) nLNode->prevPtr->nextPtr = nLNode; - ln->prevPtr = nLNode; + before->prevPtr = nLNode; - if (ln == l->firstPtr) + if (before == l->firstPtr) l->firstPtr = nLNode; } } void -Lst_AtFront(l, d) - Lst l; - void *d; +Lst_AtFront(Lst l, void *d) { LstNode ln; diff --git a/usr.bin/make/lst.lib/lstMember.c b/usr.bin/make/lst.lib/lstMember.c index 6f7228fd3cc..bd1cdf4c0d3 100644 --- a/usr.bin/make/lst.lib/lstMember.c +++ b/usr.bin/make/lst.lib/lstMember.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstMember.c,v 1.12 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstMember.c,v 1.13 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstMember.c,v 1.5 1996/11/06 17:59:48 christos Exp $ */ /* @@ -43,9 +43,7 @@ #include <stddef.h> LstNode -Lst_Member(l, d) - Lst l; - void *d; +Lst_Member(Lst l, void *d) { LstNode lNode; diff --git a/usr.bin/make/lst.lib/lstRemove.c b/usr.bin/make/lst.lib/lstRemove.c index 3edb07dcbc0..25802d493e0 100644 --- a/usr.bin/make/lst.lib/lstRemove.c +++ b/usr.bin/make/lst.lib/lstRemove.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstRemove.c,v 1.14 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstRemove.c,v 1.15 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstRemove.c,v 1.5 1996/11/06 17:59:50 christos Exp $ */ /* @@ -56,9 +56,7 @@ *----------------------------------------------------------------------- */ void -Lst_Remove(l, ln) - Lst l; - LstNode ln; +Lst_Remove(Lst l, LstNode ln) { if (ln == NULL) return; diff --git a/usr.bin/make/lst.lib/lstReplace.c b/usr.bin/make/lst.lib/lstReplace.c index 5f88f6c7357..897b650aefe 100644 --- a/usr.bin/make/lst.lib/lstReplace.c +++ b/usr.bin/make/lst.lib/lstReplace.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstReplace.c,v 1.13 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstReplace.c,v 1.14 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstReplace.c,v 1.5 1996/11/06 17:59:51 christos Exp $ */ /* @@ -49,9 +49,7 @@ *----------------------------------------------------------------------- */ void -Lst_Replace(ln, d) - LstNode ln; - void *d; +Lst_Replace(LstNode ln, void *d) { if (ln != NULL) ln->datum = d; diff --git a/usr.bin/make/lst.lib/lstSucc.c b/usr.bin/make/lst.lib/lstSucc.c index 96a32d4e497..6db016dbb2e 100644 --- a/usr.bin/make/lst.lib/lstSucc.c +++ b/usr.bin/make/lst.lib/lstSucc.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lstSucc.c,v 1.12 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: lstSucc.c,v 1.13 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: lstSucc.c,v 1.5 1996/11/06 17:59:52 christos Exp $ */ /* @@ -53,8 +53,7 @@ *----------------------------------------------------------------------- */ LstNode -Lst_Succ(ln) - LstNode ln; +Lst_Succ(LstNode ln) { if (ln == NULL) return NULL; diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 27f36304bff..dce07939f69 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: main.c,v 1.63 2004/01/30 17:37:37 espie Exp $ */ +/* $OpenBSD: main.c,v 1.64 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */ /* @@ -103,7 +103,7 @@ bool oldVars; /* variable substitution style */ bool checkEnvFirst; /* -e flag */ static void MainParseArgs(int, char **); -static char * chdir_verify_path(char *); +static char * chdir_verify_path(const char *); static int ReadMakefile(void *, void *); static void add_dirpath(Lst, const char *); static void usage(void); @@ -114,9 +114,7 @@ static char *curdir; /* startup directory */ static char *objdir; /* where we chdir'ed to */ -static void record_option(c, arg) - int c; - const char *arg; +static void record_option(int c, const char *arg) { char opt[3]; @@ -129,8 +127,7 @@ static void record_option(c, arg) } static void -posixParseOptLetter(c) - int c; +posixParseOptLetter(int c) { switch(c) { case 'B': @@ -186,9 +183,7 @@ posixParseOptLetter(c) * given */ static void -MainParseArgs(argc, argv) - int argc; - char **argv; +MainParseArgs(int argc, char **argv) { int c, optend; int forceJobs = 0; @@ -341,8 +336,7 @@ MainParseArgs(argc, argv) * Only those that come from the various arguments. */ void -Main_ParseArgLine(line) - const char *line; /* Line to fracture */ +Main_ParseArgLine(const char *line) /* Line to fracture */ { char **argv; /* Manufactured argument vector */ int argc; /* Number of arguments in argv */ @@ -385,8 +379,7 @@ Main_ParseArgLine(line) } char * -chdir_verify_path(path) - char *path; +chdir_verify_path(const char *path) { struct stat sb; @@ -409,9 +402,7 @@ chdir_verify_path(path) /* Add a :-separated path to a Lst of directories. */ static void -add_dirpath(l, n) - Lst l; - const char *n; +add_dirpath(Lst l, const char *n) { const char *start; const char *cp; @@ -446,9 +437,7 @@ int main(int, char **); * The program exits when done. Targets are created. etc. etc. etc. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { static LIST targs; /* target nodes to create */ bool outOfDate = true; /* false if all targets up to date */ @@ -782,11 +771,9 @@ main(argc, argv) * lots */ static bool -ReadMakefile(p, q) - void * p; - void * q UNUSED; +ReadMakefile(void *p, void *q UNUSED) { - char *fname = p; /* makefile to read */ + char *fname = (char *)p; /* makefile to read */ FILE *stream; char *name; diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 4c56f97bea2..1a6d1687af0 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: make.c,v 1.34 2003/11/08 19:17:29 jmc Exp $ */ +/* $OpenBSD: make.c,v 1.35 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -113,9 +113,9 @@ static void MakePrintStatus(void *, void *); *----------------------------------------------------------------------- */ void -Make_TimeStamp(pgn, cgn) - GNode *pgn; /* the current parent */ - GNode *cgn; /* the child we've just examined */ +Make_TimeStamp( + GNode *pgn, /* the current parent */ + GNode *cgn) /* the child we've just examined */ { if (is_strictly_before(pgn->cmtime, cgn->mtime)) pgn->cmtime = cgn->mtime; @@ -123,9 +123,9 @@ Make_TimeStamp(pgn, cgn) /* Wrapper to call Make_TimeStamp from a forEach loop. */ static void -MakeTimeStamp(pgn, cgn) - void *pgn; /* the current parent */ - void *cgn; /* the child we've just examined */ +MakeTimeStamp( + void *pgn, /* the current parent */ + void *cgn) /* the child we've just examined */ { Make_TimeStamp((GNode *)pgn, (GNode *)cgn); } @@ -149,8 +149,7 @@ MakeTimeStamp(pgn, cgn) *----------------------------------------------------------------------- */ bool -Make_OODate(gn) - GNode *gn; /* the node to check */ +Make_OODate(GNode *gn) /* the node to check */ { bool oodate; @@ -284,9 +283,9 @@ Make_OODate(gn) *----------------------------------------------------------------------- */ static void -MakeAddChild(gnp, lp) - void *gnp; /* the node to add */ - void *lp; /* the list to which to add it */ +MakeAddChild( + void *gnp, /* the node to add */ + void *lp) /* the list to which to add it */ { GNode *gn = (GNode *)gnp; Lst l = (Lst)lp; @@ -316,9 +315,9 @@ MakeAddChild(gnp, lp) *----------------------------------------------------------------------- */ void -Make_HandleUse(cgn, pgn) - GNode *cgn; /* The .USE node */ - GNode *pgn; /* The target of the .USE node */ +Make_HandleUse( + GNode *cgn, /* The .USE node */ + GNode *pgn) /* The target of the .USE node */ { GNode *gn; /* A child of the .USE node */ LstNode ln; /* An element in the children list */ @@ -354,9 +353,9 @@ Make_HandleUse(cgn, pgn) } } static void -MakeHandleUse(pgn, cgn) - void *pgn; /* the current parent */ - void *cgn; /* the child we've just examined */ +MakeHandleUse( + void *pgn, /* the current parent */ + void *cgn) /* the child we've just examined */ { Make_HandleUse((GNode *)pgn, (GNode *)cgn); } @@ -387,8 +386,7 @@ MakeHandleUse(pgn, cgn) *----------------------------------------------------------------------- */ void -Make_Update(cgn) - GNode *cgn; /* the child node */ +Make_Update(GNode *cgn) /* the child node */ { GNode *pgn; /* the parent node */ char *cname; /* the child's name */ @@ -533,9 +531,9 @@ Make_Update(cgn) *----------------------------------------------------------------------- */ static void -MakeAddAllSrc(cgnp, pgnp) - void *cgnp; /* The child to add */ - void *pgnp; /* The parent to whose ALLSRC variable it should be */ +MakeAddAllSrc( + void *cgnp, /* The child to add */ + void *pgnp) /* The parent to whose ALLSRC variable it should be */ /* added */ { GNode *cgn = (GNode *)cgnp; @@ -600,8 +598,7 @@ MakeAddAllSrc(cgnp, pgnp) *----------------------------------------------------------------------- */ void -Make_DoAllVar(gn) - GNode *gn; +Make_DoAllVar(GNode *gn) { Lst_ForEach(&gn->children, MakeAddAllSrc, gn); @@ -630,7 +627,7 @@ Make_DoAllVar(gn) *----------------------------------------------------------------------- */ static bool -MakeStartJobs() +MakeStartJobs(void) { GNode *gn; @@ -709,9 +706,9 @@ MakeStartJobs() *----------------------------------------------------------------------- */ static void -MakePrintStatus(gnp, cyclep) - void *gnp; /* Node to examine */ - void *cyclep; /* True if gn->unmade being non-zero implies +MakePrintStatus( + void *gnp, /* Node to examine */ + void *cyclep) /* True if gn->unmade being non-zero implies * a cycle in the graph, not an error in an * inferior */ { @@ -770,8 +767,7 @@ MakePrintStatus(gnp, cyclep) *----------------------------------------------------------------------- */ bool -Make_Run(targs) - Lst targs; /* the initial list of targets */ +Make_Run(Lst targs) /* the initial list of targets */ { GNode *gn; /* a temporary pointer */ LIST examine; /* List of targets to examine */ diff --git a/usr.bin/make/memory.c b/usr.bin/make/memory.c index 4b756ca5435..64833e006cf 100644 --- a/usr.bin/make/memory.c +++ b/usr.bin/make/memory.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: memory.c,v 1.2 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: memory.c,v 1.3 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -52,13 +52,12 @@ static void enomem(size_t); * malloc, but die on error. */ void * -emalloc(len) - size_t len; +emalloc(size_t size) { void *p; - if ((p = malloc(len)) == NULL) - enomem(len); + if ((p = malloc(size)) == NULL) + enomem(size); return p; } @@ -67,8 +66,7 @@ emalloc(len) * strdup, but die on error. */ char * -estrdup(str) - const char *str; +estrdup(const char *str) { char *p; size_t size; @@ -85,9 +83,7 @@ estrdup(str) * realloc, but die on error. */ void * -erealloc(ptr, size) - void *ptr; - size_t size; +erealloc(void *ptr, size_t size) { if ((ptr = realloc(ptr, size)) == NULL) enomem(size); @@ -95,9 +91,7 @@ erealloc(ptr, size) } void * -ecalloc(s1, s2) - size_t s1; - size_t s2; +ecalloc(size_t s1, size_t s2) { void *p; @@ -108,26 +102,19 @@ ecalloc(s1, s2) /* Support routines for hash tables. */ void * -hash_alloc(s, u) - size_t s; - void *u UNUSED; +hash_alloc(size_t s, void *u UNUSED) { return ecalloc(s, 1); } void -hash_free(p, s, u) - void *p; - size_t s UNUSED; - void *u UNUSED; +hash_free(void *p, size_t s UNUSED, void *u UNUSED) { free(p); } void * -element_alloc(s, u) - size_t s; - void *u UNUSED; +element_alloc(size_t s, void *u UNUSED) { return emalloc(s); } @@ -139,8 +126,7 @@ element_alloc(s, u) * die when out of memory. */ void -enomem(size) - size_t size; +enomem(size_t size) { fprintf(stderr, "make: %s (%lu)\n", strerror(errno), (u_long)size); exit(2); @@ -151,9 +137,7 @@ enomem(size) * change environment, die on error. */ void -esetenv(name, value) - const char *name; - const char *value; +esetenv(const char *name, const char *value) { if (setenv(name, value, 1) == 0) return; @@ -168,8 +152,7 @@ esetenv(name, value) * Remove a file carefully, avoiding directories. */ int -eunlink(file) - const char *file; +eunlink(const char *file) { struct stat st; diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 40e50ef896f..8b3be5f39b9 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: parse.c,v 1.68 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: parse.c,v 1.69 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -233,8 +233,7 @@ static void ParseDoCommands(const char *); *---------------------------------------------------------------------- */ static int -ParseFindKeyword(str) - const char *str; /* String to find */ +ParseFindKeyword(const char *str) /* keyword to look up */ { int start, end, @@ -272,9 +271,9 @@ ParseFindKeyword(str) *--------------------------------------------------------------------- */ static void -ParseLinkSrc(pgn, cgn) - GNode *pgn; /* The parent node */ - GNode *cgn; /* The child node */ +ParseLinkSrc( + GNode *pgn, /* The parent node */ + GNode *cgn) /* The child node */ { if (Lst_AddNew(&pgn->children, cgn)) { if (specType == Not) @@ -297,10 +296,9 @@ ParseLinkSrc(pgn, cgn) *--------------------------------------------------------------------- */ static int -ParseDoOp(gn, op) - GNode *gn; /* The node to which the operator is to be - * applied */ - int op; /* The operator to apply */ +ParseDoOp( + GNode *gn, /* The node to which the operator is to be applied */ + int op) /* The operator to apply */ { /* * If the dependency mask of the operator and the node don't match and @@ -367,9 +365,7 @@ ParseDoOp(gn, op) *--------------------------------------------------------------------- */ static int -ParseAddDep(p, s) - GNode *p; - GNode *s; +ParseAddDep(GNode *p, GNode *s) { if (p->order < s->order) { /* XXX: This can cause loops, and loops can cause unmade targets, @@ -399,10 +395,9 @@ ParseAddDep(p, s) *--------------------------------------------------------------------- */ static void -ParseDoSrc(tOp, src) - int tOp; /* operator (if any) from special targets */ - const char *src; /* name of the source to handle */ - +ParseDoSrc( + int tOp, /* operator (if any) from special targets */ + const char *src) /* name of the source to handle */ { GNode *gn = NULL; @@ -511,9 +506,9 @@ ParseDoSrc(tOp, src) *----------------------------------------------------------------------- */ static int -ParseFindMain(gnp, dummy) - void *gnp; /* Node to examine */ - void *dummy UNUSED; +ParseFindMain( + void *gnp, /* Node to examine */ + void *dummy UNUSED) { GNode *gn = (GNode *)gnp; if ((gn->type & OP_NOTARGET) == 0) { @@ -535,9 +530,7 @@ ParseFindMain(gnp, dummy) *----------------------------------------------------------------------- */ static void -ParseAddDir(path, name) - void *path; - void *name; +ParseAddDir(void *path, void *name) { Dir_AddDir((Lst)path, (char *)name); } @@ -549,8 +542,7 @@ ParseAddDir(path, name) *----------------------------------------------------------------------- */ static void -ParseClearPath(p) - void *p; +ParseClearPath(void *p) { Lst path = (Lst)p; @@ -590,8 +582,7 @@ ParseClearPath(p) *--------------------------------------------------------------------- */ static void -ParseDoDependency(line) - char *line; /* the line to parse */ +ParseDoDependency(char *line) /* the line to parse */ { char *cp; /* our current position */ GNode *gn; /* a general purpose temporary node */ @@ -1081,9 +1072,9 @@ ParseDoDependency(line) * A new element is added to the commands list of the node. */ static void -ParseAddCmd(gnp, cmd) - void *gnp; /* the node to which the command is to be added */ - void *cmd; /* the command to add */ +ParseAddCmd( + void *gnp, /* the node to which the command is to be added */ + void *cmd) /* the command to add */ { GNode *gn = (GNode *)gnp; /* if target already supplied, ignore commands */ @@ -1109,8 +1100,7 @@ ParseAddCmd(gnp, cmd) *----------------------------------------------------------------------- */ static void -ParseHasCommands(gnp) - void *gnp; /* Node to examine */ +ParseHasCommands(void *gnp) /* Node to examine */ { GNode *gn = (GNode *)gnp; if (!Lst_IsEmpty(&gn->commands)) { @@ -1126,8 +1116,7 @@ ParseHasCommands(gnp) *----------------------------------------------------------------------- */ void -Parse_AddIncludeDir(dir) - const char *dir; /* The name of the directory to add */ +Parse_AddIncludeDir(const char *dir) /* The name of the directory to add */ { Dir_AddDir(parseIncPath, dir); } @@ -1148,8 +1137,7 @@ Parse_AddIncludeDir(dir) *--------------------------------------------------------------------- */ static void -ParseDoInclude(file) - char *file; /* file specification */ +ParseDoInclude(char *file)/* file specification */ { char endc; /* the character which ends the file spec */ char *cp; /* current position in file spec */ @@ -1204,8 +1192,7 @@ ParseDoInclude(file) *--------------------------------------------------------------------- */ static void -ParseTraditionalInclude(file) - char *file; /* file specification */ +ParseTraditionalInclude(char *file) /* file specification */ { char *cp; /* current position in file spec */ @@ -1234,8 +1221,7 @@ ParseTraditionalInclude(file) *--------------------------------------------------------------------- */ static void -ParseConditionalInclude(file) - char *file; /* file specification */ +ParseConditionalInclude(char *file)/* file specification */ { char *cp; /* current position in file spec */ @@ -1256,11 +1242,8 @@ ParseConditionalInclude(file) /* Common part to lookup and read an include file. */ static void -ParseLookupIncludeFile(spec, endSpec, isSystem, errIfNotFound) - char *spec; - char *endSpec; - bool isSystem; - bool errIfNotFound; +ParseLookupIncludeFile(char *spec, char *endSpec, bool isSystem, + bool errIfNotFound) { char *file; char *fullname; @@ -1342,9 +1325,7 @@ ParseLookupIncludeFile(spec, endSpec, isSystem, errIfNotFound) /* Strip comments from the line. May return either a copy of the line, or * the line itself. */ static char * -strip_comments(copy, line) - Buffer copy; - const char *line; +strip_comments(Buffer copy, const char *line) { const char *comment; const char *p; @@ -1375,10 +1356,7 @@ strip_comments(copy, line) } static bool -ParseIsCond(linebuf, copy, line) - Buffer linebuf; - Buffer copy; - char *line; +ParseIsCond(Buffer linebuf, Buffer copy, char *line) { char *stripped; @@ -1456,7 +1434,7 @@ ParseIsCond(linebuf, copy, line) *----------------------------------------------------------------------- */ static void -ParseFinishDependency() +ParseFinishDependency(void) { Array_Every(>argets, Suff_EndTransform); Array_Every(>argets, ParseHasCommands); @@ -1464,8 +1442,7 @@ ParseFinishDependency() } static void -ParseDoCommands(line) - const char *line; +ParseDoCommands(const char *line) { /* add the command to the list of * commands of all targets in the dependency spec */ @@ -1478,9 +1455,9 @@ ParseDoCommands(line) } void -Parse_File(name, stream) - const char *name; /* the name of the file being read */ - FILE *stream; /* Stream open to makefile to parse */ +Parse_File( + const char *name, /* the name of the file being read */ + FILE *stream) /* Stream open to makefile to parse */ { char *cp, /* pointer into the line */ *line; /* the line we're working on */ @@ -1584,7 +1561,7 @@ Parse_File(name, stream) } void -Parse_Init() +Parse_Init(void) { mainNode = NULL; Static_Lst_Init(parseIncPath); @@ -1600,7 +1577,7 @@ Parse_Init() #ifdef CLEANUP void -Parse_End() +Parse_End(void) { Lst_Destroy(&targCmds, (SimpleProc)free); Lst_Destroy(sysIncPath, Dir_Destroy); @@ -1611,8 +1588,7 @@ Parse_End() void -Parse_MainName(listmain) - Lst listmain; /* result list */ +Parse_MainName(Lst listmain) /* result list */ { if (mainNode == NULL) { diff --git a/usr.bin/make/parse.h b/usr.bin/make/parse.h index 95d5802c5a0..3106fd390c4 100644 --- a/usr.bin/make/parse.h +++ b/usr.bin/make/parse.h @@ -1,7 +1,7 @@ #ifndef PARSE_H #define PARSE_H /* $OpenPackages$ */ -/* $OpenBSD: parse.h,v 1.1 2001/05/23 12:34:47 espie Exp $ */ +/* $OpenBSD: parse.h,v 1.2 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -45,7 +45,7 @@ extern Lst parseIncPath; /* The user include"" path. */ * Parses stream filehandle, use filename when reporting error * messages. Builds a graph of GNode and Suffixes. This modules * acquires ownership of the filename and filehandle, and will - * close/free them when it sees fit. */ + * free/close them when it sees fit. */ extern void Parse_File(const char *, FILE *); /* Parse_AddIncludeDir(dir); diff --git a/usr.bin/make/parsevar.c b/usr.bin/make/parsevar.c index a6dba3803de..659c290ec5f 100644 --- a/usr.bin/make/parsevar.c +++ b/usr.bin/make/parsevar.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: parsevar.c,v 1.1 2001/05/23 12:34:48 espie Exp $ */ +/* $OpenBSD: parsevar.c,v 1.2 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -43,8 +43,7 @@ static const char *find_op1(const char *); static const char *find_op2(const char *); static const char * -find_op1(p) - const char *p; +find_op1(const char *p) { for(;; p++) { if (isspace(*p) || *p == '$' || *p == '\0') @@ -58,8 +57,7 @@ find_op1(p) } static const char * -find_op2(p) - const char *p; +find_op2(const char *p) { for(;; p++) { if (isspace(*p) || *p == '$' || *p == '\0') @@ -71,9 +69,8 @@ find_op2(p) } bool -Parse_DoVar(line, ctxt) - const char *line; - GSymT *ctxt; /* Context in which to do the assignment */ +Parse_DoVar(const char *line, + GSymT *ctxt) /* Context in which to do the assignment */ { const char *arg; char *res1 = NULL, *res2 = NULL; diff --git a/usr.bin/make/regress.c b/usr.bin/make/regress.c index cfd5502aef6..4dfb7ceb504 100644 --- a/usr.bin/make/regress.c +++ b/usr.bin/make/regress.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: regress.c,v 1.4 2001/05/23 12:34:48 espie Exp $ */ +/* $OpenBSD: regress.c,v 1.5 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie. @@ -47,7 +47,7 @@ do { \ } while (0); int -main() +main(void) { unsigned int errors = 0; diff --git a/usr.bin/make/stats.c b/usr.bin/make/stats.c index 4f8b173968e..37edb4c6df1 100644 --- a/usr.bin/make/stats.c +++ b/usr.bin/make/stats.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: stats.c,v 1.6 2002/08/12 00:42:56 aaron Exp $ */ +/* $OpenBSD: stats.c,v 1.7 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie. @@ -57,14 +57,13 @@ unsigned long *statarray; static bool mmapped = false; static float -average_runs(val) - unsigned long val; +average_runs(unsigned long val) { return (float)val / STAT_INVOCATIONS; } static void -print_stats() +print_stats(void) { struct rusage ru; @@ -132,7 +131,7 @@ print_stats() } void -Init_Stats() +Init_Stats(void) { char *name; int fd; diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 3e0d56427a7..ee1ab5f76bf 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: str.c,v 1.20 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: str.c,v 1.21 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ /*- @@ -45,9 +45,8 @@ #include "buf.h" char * -Str_concati(s1, e1, s2, e2, sep) - const char *s1, *e1, *s2, *e2; - int sep; +Str_concati(const char *s1, const char *e1, const char *s2, const char *e2, + int sep) { size_t len1, len2; char *result; @@ -85,10 +84,7 @@ Str_concati(s1, e1, s2, e2, sep) * the first word is always the value of the .MAKE variable. */ char ** -brk_string(str, store_argc, buffer) - const char *str; - int *store_argc; - char **buffer; +brk_string(const char *str, int *store_argc, char **buffer) { int argc; char ch; @@ -196,8 +192,7 @@ done: const char * -iterate_words(end) - const char **end; +iterate_words(const char **end) { const char *start, *p; char state = 0; @@ -235,13 +230,10 @@ iterate_words(end) } bool -Str_Matchi(string, estring, pattern, end) - const char *string; /* String */ - const char *estring; /* End of string */ - const char *pattern; /* Pattern */ - const char *end; /* End of Pattern */ +Str_Matchi(const char *string, const char *estring, + const char *pattern, const char *epattern) { - while (pattern != end) { + while (pattern != epattern) { /* Check for a "*" as the next pattern character. It matches * any substring. We handle this by calling ourselves * recursively for each postfix of string, until either we @@ -250,7 +242,8 @@ Str_Matchi(string, estring, pattern, end) pattern++; /* Skip over contiguous sequences of `?*', so that recursive * calls only occur on `real' characters. */ - while (pattern != end && (*pattern == '?' || *pattern == '*')) { + while (pattern != epattern && + (*pattern == '?' || *pattern == '*')) { if (*pattern == '?') { if (string == estring) return false; @@ -259,10 +252,10 @@ Str_Matchi(string, estring, pattern, end) } pattern++; } - if (pattern == end) + if (pattern == epattern) return true; for (; string != estring; string++) - if (Str_Matchi(string, estring, pattern, end)) + if (Str_Matchi(string, estring, pattern, epattern)) return true; return false; } else if (string == estring) @@ -272,22 +265,22 @@ Str_Matchi(string, estring, pattern, end) * by a range (two characters separated by "-"). */ else if (*pattern == '[') { pattern++; - if (pattern == end) + if (pattern == epattern) return false; if (*pattern == '!' || *pattern == '^') { pattern++; - if (pattern == end) + if (pattern == epattern) return false; /* Negative match */ for (;;) { if (*pattern == '\\') { - if (++pattern == end) + if (++pattern == epattern) return false; } if (*pattern == *string) return false; if (pattern[1] == '-') { - if (pattern + 2 == end) + if (pattern + 2 == epattern) return false; if (*pattern < *string && *string <= pattern[2]) return false; @@ -296,7 +289,7 @@ Str_Matchi(string, estring, pattern, end) pattern += 3; } else pattern++; - if (pattern == end) + if (pattern == epattern) return false; /* The test for ']' is done at the end so that ']' * can be used at the start of the range without '\' */ @@ -306,13 +299,13 @@ Str_Matchi(string, estring, pattern, end) } else { for (;;) { if (*pattern == '\\') { - if (++pattern == end) + if (++pattern == epattern) return false; } if (*pattern == *string) break; if (pattern[1] == '-') { - if (pattern + 2 == end) + if (pattern + 2 == epattern) return false; if (*pattern < *string && *string <= pattern[2]) break; @@ -323,7 +316,7 @@ Str_Matchi(string, estring, pattern, end) pattern++; /* The test for ']' is done at the end so that ']' * can be used at the start of the range without '\' */ - if (pattern == end || *pattern == ']') + if (pattern == epattern || *pattern == ']') return false; } /* Found matching character, skip over rest of class. */ @@ -331,7 +324,7 @@ Str_Matchi(string, estring, pattern, end) if (*pattern == '\\') pattern++; /* A non-terminated character class is ok. */ - if (pattern == end) + if (pattern == epattern) break; pattern++; } @@ -342,7 +335,7 @@ Str_Matchi(string, estring, pattern, end) /* If the next pattern character is '\', just strip off the * '\' so we do exact matching on the character that follows. */ if (*pattern == '\\') { - if (++pattern == end) + if (++pattern == epattern) return false; } /* There's no special character. Just make sure that @@ -371,10 +364,7 @@ Str_Matchi(string, estring, pattern, end) *----------------------------------------------------------------------- */ const char * -Str_SYSVMatch(word, pattern, len) - const char *word; /* Word to examine */ - const char *pattern; /* Pattern to examine against */ - size_t *len; /* Number of characters to substitute */ +Str_SYSVMatch(const char *word, const char *pattern, size_t *len) { const char *p = pattern; const char *w = word; @@ -419,20 +409,16 @@ Str_SYSVMatch(word, pattern, len) /*- *----------------------------------------------------------------------- * Str_SYSVSubst -- - * Substitute '%' on the pattern with len characters from src. + * Substitute '%' in the pattern with len characters from src. * If the pattern does not contain a '%' prepend len characters * from src. * * Side Effects: - * Places result on buf + * Adds result to buf *----------------------------------------------------------------------- */ void -Str_SYSVSubst(buf, pat, src, len) - Buffer buf; - const char *pat; - const char *src; - size_t len; +Str_SYSVSubst(Buffer buf, const char *pat, const char *src, size_t len) { const char *m; @@ -451,9 +437,7 @@ Str_SYSVSubst(buf, pat, src, len) } char * -Str_dupi(begin, end) - const char *begin; - const char *end; +Str_dupi(const char *begin, const char *end) { char *s; @@ -464,10 +448,7 @@ Str_dupi(begin, end) } char * -escape_dupi(begin, end, set) - const char *begin; - const char *end; - const char *set; +escape_dupi(const char *begin, const char *end, const char *set) { char *s, *t; @@ -489,15 +470,12 @@ escape_dupi(begin, end, set) } char * -Str_rchri(s, e, c) - const char *s; - const char *e; - int c; +Str_rchri(const char *begin, const char *end, int c) { - if (s != e) + if (begin != end) do { - if (*--e == c) - return (char *)e; - } while (e != s); + if (*--end == c) + return (char *)end; + } while (end != begin); return NULL; } diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 86be942717a..f25620b63d9 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: suff.c,v 1.50 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: suff.c,v 1.51 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -198,23 +198,21 @@ static void PrintAddr(void *); /*- *----------------------------------------------------------------------- * SuffStrIsPrefix -- - * See if pref is a prefix of str. + * See if prefix is a prefix of str. * * Results: * NULL if it ain't, pointer to character in str after prefix if so *----------------------------------------------------------------------- */ static char * -SuffStrIsPrefix(pref, str) - const char *pref; /* possible prefix */ - const char *str; /* string to check */ +SuffStrIsPrefix(const char *prefix, const char *str) { - while (*str && *pref == *str) { - pref++; + while (*str && *prefix == *str) { + prefix++; str++; } - return *pref ? NULL : (char *)str; + return *prefix ? NULL : (char *)str; } /*- @@ -229,9 +227,7 @@ SuffStrIsPrefix(pref, str) *----------------------------------------------------------------------- */ static char * -SuffSuffIsSuffix(s, str) - Suff *s; /* possible suffix */ - const char *str; /* string to examine */ +SuffSuffIsSuffix(Suff *s, const char *str) { const char *p1; /* Pointer into suffix name */ const char *p2; /* Pointer into string being examined */ @@ -260,9 +256,7 @@ SuffSuffIsSuffix(s, str) *----------------------------------------------------------------------- */ static int -SuffSuffIsSuffixP(s, str) - void *s; - const void *str; +SuffSuffIsSuffixP(void *s, const void *str) { return !SuffSuffIsSuffix((Suff *)s, (const char *)str); } @@ -278,9 +272,7 @@ SuffSuffIsSuffixP(s, str) *----------------------------------------------------------------------- */ static int -SuffSuffHasNameP(s, sname) - void *s; /* Suffix to check */ - const void *sname; /* Desired name */ +SuffSuffHasNameP(void *s, const void *sname) { return strcmp((const char *)sname, ((Suff *)s)->name); } @@ -298,9 +290,7 @@ SuffSuffHasNameP(s, sname) *----------------------------------------------------------------------- */ static int -SuffSuffIsPrefix(s, str) - void *s; /* suffix to compare */ - const void *str; /* string to examine */ +SuffSuffIsPrefix(void *s, const void *str) { return SuffStrIsPrefix(((Suff *)s)->name, (const char *)str) == NULL ? 1 : 0; } @@ -315,9 +305,7 @@ SuffSuffIsPrefix(s, str) *----------------------------------------------------------------------- */ static int -SuffGNHasNameP(gn, name) - void *gn; /* current node we're looking at */ - const void *name; /* name we're looking for */ +SuffGNHasNameP(void *gn, const void *name) { return strcmp((const char *)name, ((GNode *)gn)->name); } @@ -325,9 +313,7 @@ SuffGNHasNameP(gn, name) /*********** Maintenance Functions ************/ static void -SuffUnRef(l, sp) - Lst l; - Suff *sp; +SuffUnRef(Lst l, Suff *sp) { LstNode ln = Lst_Member(l, sp); if (ln != NULL) @@ -345,8 +331,7 @@ SuffUnRef(l, sp) *----------------------------------------------------------------------- */ static void -SuffFree(sp) - void *sp; +SuffFree(void *sp) { Suff *s = (Suff *)sp; @@ -378,9 +363,7 @@ SuffFree(sp) *----------------------------------------------------------------------- */ static void -SuffInsert(l, s) - Lst l; /* the list where in s should be inserted */ - Suff *s; /* the suffix to insert */ +SuffInsert(Lst l, Suff *s) { LstNode ln; /* current element in l we're examining */ Suff *s2 = NULL; /* the suffix descriptor in this element */ @@ -426,7 +409,7 @@ SuffInsert(l, s) *----------------------------------------------------------------------- */ void -Suff_ClearSuffixes() +Suff_ClearSuffixes(void) { #ifdef CLEANUP Lst_ConcatDestroy(&suffClean, &sufflist); @@ -449,10 +432,10 @@ Suff_ClearSuffixes() *----------------------------------------------------------------------- */ static bool -SuffParseTransform(str, srcPtr, targPtr) - const char *str; /* String being parsed */ - Suff **srcPtr; /* Place to store source of trans. */ - Suff **targPtr; /* Place to store target of trans. */ +SuffParseTransform( + const char *str, /* String being parsed */ + Suff **srcPtr, /* Place to store source of trans. */ + Suff **targPtr) /* Place to store target of trans. */ { LstNode srcLn; /* element in suffix list of trans source*/ Suff *src; /* Source of transformation */ @@ -524,8 +507,7 @@ SuffParseTransform(str, srcPtr, targPtr) *----------------------------------------------------------------------- */ bool -Suff_IsTransform(str) - const char *str; /* string to check */ +Suff_IsTransform(const char *str) { Suff *src, *targ; @@ -547,8 +529,7 @@ Suff_IsTransform(str) *----------------------------------------------------------------------- */ GNode * -Suff_AddTransform(line) - const char *line; /* name of transformation to add */ +Suff_AddTransform(const char *line) { GNode *gn; /* GNode of transformation rule */ Suff *s, /* source suffix */ @@ -608,8 +589,7 @@ Suff_AddTransform(line) *----------------------------------------------------------------------- */ void -Suff_EndTransform(gnp) - void *gnp; /* Node for transformation */ +Suff_EndTransform(void *gnp) { GNode *gn = (GNode *)gnp; @@ -659,9 +639,9 @@ Suff_EndTransform(gnp) *----------------------------------------------------------------------- */ static void -SuffRebuildGraph(transformp, sp) - void *transformp; /* Transformation to test */ - void *sp; /* Suffix to rebuild */ +SuffRebuildGraph( + void *transformp, /* Transformation to test */ + void *sp) /* Suffix to rebuild */ { GNode *transform = (GNode *)transformp; Suff *s = (Suff *)sp; @@ -712,8 +692,7 @@ SuffRebuildGraph(transformp, sp) *----------------------------------------------------------------------- */ void -Suff_AddSuffix(str) - char *str; /* the name of the suffix to add */ +Suff_AddSuffix(char *str) { Suff *s; /* new suffix descriptor */ LstNode ln; @@ -751,8 +730,7 @@ Suff_AddSuffix(str) *----------------------------------------------------------------------- */ Lst -Suff_GetPath(sname) - char *sname; +Suff_GetPath(char *sname) { LstNode ln; Suff *s; @@ -782,7 +760,7 @@ Suff_GetPath(sname) *----------------------------------------------------------------------- */ void -Suff_DoPaths() +Suff_DoPaths(void) { Suff *s; LstNode ln; @@ -832,8 +810,7 @@ Suff_DoPaths() *----------------------------------------------------------------------- */ void -Suff_AddInclude(sname) - char *sname; /* Name of suffix to mark */ +Suff_AddInclude(char *sname) /* Name of suffix to mark */ { LstNode ln; Suff *s; @@ -858,8 +835,7 @@ Suff_AddInclude(sname) *----------------------------------------------------------------------- */ void -Suff_AddLib(sname) - char *sname; /* Name of suffix to mark */ +Suff_AddLib(char *sname) /* Name of suffix to mark */ { LstNode ln; Suff *s; @@ -885,9 +861,9 @@ Suff_AddLib(sname) *----------------------------------------------------------------------- */ static void -SuffAddSrc(sp, lsp) - void *sp; /* suffix for which to create a Src structure */ - void *lsp; /* list and parent for the new Src */ +SuffAddSrc( + void *sp, /* suffix for which to create a Src structure */ + void *lsp) /* list and parent for the new Src */ { Suff *s = (Suff *)sp; LstSrc *ls = (LstSrc *)lsp; @@ -948,9 +924,9 @@ SuffAddSrc(sp, lsp) *----------------------------------------------------------------------- */ static void -SuffAddLevel(l, targ) - Lst l; /* list to which to add the new level */ - Src *targ; /* Src structure to use as the parent */ +SuffAddLevel( + Lst l, /* list to which to add the new level */ + Src *targ) /* Src structure to use as the parent */ { LstSrc ls; @@ -973,8 +949,7 @@ SuffAddLevel(l, targ) *---------------------------------------------------------------------- */ static int -SuffRemoveSrc(l) - Lst l; +SuffRemoveSrc(Lst l) { LstNode ln; Src *s; @@ -1032,9 +1007,9 @@ SuffRemoveSrc(l) *----------------------------------------------------------------------- */ static Src * -SuffFindThem(srcs, slst) - Lst srcs; /* list of Src structures to search through */ - Lst slst; +SuffFindThem( + Lst srcs, /* list of Src structures to search through */ + Lst slst) { Src *s; /* current Src */ Src *rs; /* returned Src */ @@ -1097,9 +1072,9 @@ SuffFindThem(srcs, slst) *----------------------------------------------------------------------- */ static Src * -SuffFindCmds(targ, slst) - Src *targ; /* Src structure to play with */ - Lst slst; +SuffFindCmds( + Src *targ, /* Src structure to play with */ + Lst slst) { LstNode ln; /* General-purpose list node */ GNode *t, /* Target GNode */ @@ -1168,10 +1143,7 @@ SuffFindCmds(targ, slst) } static void -SuffExpandVarChildren(after, cgn, pgn) - LstNode after; - GNode *cgn; - GNode *pgn; +SuffExpandVarChildren(LstNode after, GNode *cgn, GNode *pgn) { GNode *gn; /* New source 8) */ char *cp; /* Expanded value */ @@ -1256,10 +1228,7 @@ SuffExpandVarChildren(after, cgn, pgn) } static void -SuffExpandWildChildren(after, cgn, pgn) - LstNode after; - GNode *cgn; - GNode *pgn; +SuffExpandWildChildren(LstNode after, GNode *cgn, GNode *pgn) { LstNode ln; /* List element for old source */ char *cp; /* Expanded value */ @@ -1327,9 +1296,9 @@ SuffExpandWildChildren(after, cgn, pgn) *----------------------------------------------------------------------- */ static void -SuffExpandChildren(cgnp, pgnp) - void *cgnp; /* Child to examine */ - void *pgnp; /* Parent node being processed */ +SuffExpandChildren( + void *cgnp, /* Child to examine */ + void *pgnp) /* Parent node being processed */ { GNode *cgn = (GNode *)cgnp; GNode *pgn = (GNode *)pgnp; @@ -1374,11 +1343,11 @@ SuffExpandChildren(cgnp, pgnp) *----------------------------------------------------------------------- */ static bool -SuffApplyTransform(tGn, sGn, t, s) - GNode *tGn; /* Target node */ - GNode *sGn; /* Source node */ - Suff *t; /* Target suffix */ - Suff *s; /* Source suffix */ +SuffApplyTransform( + GNode *tGn, /* Target node */ + GNode *sGn, /* Source node */ + Suff *t, /* Target suffix */ + Suff *s) /* Source suffix */ { LstNode ln; /* General node */ LstNode np; /* Next node for loop */ @@ -1456,9 +1425,9 @@ SuffApplyTransform(tGn, sGn, t, s) *----------------------------------------------------------------------- */ static void -SuffFindArchiveDeps(gn, slst) - GNode *gn; /* Node for which to locate dependencies */ - Lst slst; +SuffFindArchiveDeps( + GNode *gn, /* Node for which to locate dependencies */ + Lst slst) { char *eoarch; /* End of archive portion */ char *eoname; /* End of member portion */ @@ -1551,9 +1520,9 @@ SuffFindArchiveDeps(gn, slst) *----------------------------------------------------------------------- */ static void -SuffFindNormalDeps(gn, slst) - GNode *gn; /* Node for which to find sources */ - Lst slst; +SuffFindNormalDeps( + GNode *gn, /* Node for which to find sources */ + Lst slst) { char *eoname; /* End of name */ char *sopref; /* Start of prefix */ @@ -1873,8 +1842,7 @@ sfnd_return: */ void -Suff_FindDeps(gn) - GNode *gn; +Suff_FindDeps(GNode *gn) { SuffFindDeps(gn, &srclist); @@ -1884,9 +1852,7 @@ Suff_FindDeps(gn) static void -SuffFindDeps(gn, slst) - GNode *gn; /* node we're dealing with */ - Lst slst; +SuffFindDeps(GNode *gn, Lst slst) { if (gn->type & OP_DEPS_FOUND) { /* @@ -1947,8 +1913,7 @@ SuffFindDeps(gn, slst) *----------------------------------------------------------------------- */ void -Suff_SetNull(name) - char *name; /* Name of null suffix */ +Suff_SetNull(char *name) { Suff *s; LstNode ln; @@ -1980,7 +1945,7 @@ Suff_SetNull(name) *----------------------------------------------------------------------- */ void -Suff_Init() +Suff_Init(void) { Static_Lst_Init(&sufflist); #ifdef CLEANUP @@ -2022,7 +1987,7 @@ Suff_Init() #ifdef CLEANUP void -Suff_End() +Suff_End(void) { Lst_Destroy(&sufflist, SuffFree); Lst_Destroy(&suffClean, SuffFree); @@ -2036,15 +2001,13 @@ Suff_End() /********************* DEBUGGING FUNCTIONS **********************/ -static void SuffPrintName(s) - void *s; +static void SuffPrintName(void *s) { printf("%s ", ((Suff *)s)->name); } static void -SuffPrintSuff(sp) - void *sp; +SuffPrintSuff(void *sp) { Suff *s = (Suff *)sp; int flags; @@ -2085,8 +2048,7 @@ SuffPrintSuff(sp) } static void -SuffPrintTrans(tp) - void *tp; +SuffPrintTrans(void *tp) { GNode *t = (GNode *)tp; @@ -2098,7 +2060,7 @@ SuffPrintTrans(tp) } void -Suff_PrintAll() +Suff_PrintAll(void) { printf("#*** Suffixes:\n"); Lst_Every(&sufflist, SuffPrintSuff); @@ -2109,8 +2071,7 @@ Suff_PrintAll() #ifdef DEBUG_SRC static void -PrintAddr(a) - void *a; +PrintAddr(void *a) { printf("%lx ", (unsigned long)a); } diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index e3f04fc242d..027bac2f811 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: targ.c,v 1.38 2003/06/03 02:56:12 millert Exp $ */ +/* $OpenBSD: targ.c,v 1.39 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -142,7 +142,7 @@ static void TargFreeGN(void *); *----------------------------------------------------------------------- */ void -Targ_Init() +Targ_Init(void) { /* A small make file already creates 200 targets. */ ohash_init(&targets, 10, &gnode_info); @@ -162,7 +162,7 @@ Targ_Init() */ #ifdef CLEANUP void -Targ_End() +Targ_End(void) { Lst_Every(&allTargets, TargFreeGN); ohash_delete(&targets); @@ -183,13 +183,12 @@ Targ_End() *----------------------------------------------------------------------- */ GNode * -Targ_NewGNi(name, end) - const char *name; /* the name to stick in the new node */ - const char *end; +Targ_NewGNi(const char *name, /* the name to stick in the new node */ + const char *ename) { GNode *gn; - gn = ohash_create_entry(&gnode_info, name, &end); + gn = ohash_create_entry(&gnode_info, name, &ename); gn->path = NULL; if (name[0] == '-' && name[1] == 'l') { gn->type = OP_LIB; @@ -233,8 +232,7 @@ Targ_NewGNi(name, end) *----------------------------------------------------------------------- */ static void -TargFreeGN(gnp) - void *gnp; +TargFreeGN(void *gnp) { GNode *gn = (GNode *)gnp; @@ -267,21 +265,19 @@ TargFreeGN(gnp) *----------------------------------------------------------------------- */ GNode * -Targ_FindNodei(name, end, flags) - const char *name; /* the name to find */ - const char *end; - int flags; /* flags governing events when target not +Targ_FindNodei(const char *name, const char *ename, + int flags) /* flags governing events when target not * found */ { GNode *gn; /* node in that element */ unsigned int slot; - slot = ohash_qlookupi(&targets, name, &end); + slot = ohash_qlookupi(&targets, name, &ename); gn = ohash_find(&targets, slot); if (gn == NULL && (flags & TARG_CREATE)) { - gn = Targ_NewGNi(name, end); + gn = Targ_NewGNi(name, ename); ohash_insert(&targets, slot, gn); } @@ -302,9 +298,8 @@ Targ_FindNodei(name, end, flags) * ----------------------------------------------------------------------- */ void -Targ_FindList(nodes, names) - Lst nodes; /* result list */ - Lst names; /* list of names to find */ +Targ_FindList(Lst nodes, /* result list */ + Lst names) /* list of names to find */ { LstNode ln; /* name list element */ GNode *gn; /* node in tLn */ @@ -329,8 +324,7 @@ Targ_FindList(nodes, names) *----------------------------------------------------------------------- */ bool -Targ_Ignore(gn) - GNode *gn; /* node to check for */ +Targ_Ignore(GNode *gn) { if (ignoreErrors || gn->type & OP_IGNORE) return true; @@ -345,8 +339,7 @@ Targ_Ignore(gn) *----------------------------------------------------------------------- */ bool -Targ_Silent(gn) - GNode *gn; /* node to check for */ +Targ_Silent(GNode *gn) { if (beSilent || gn->type & OP_SILENT) return true; @@ -361,8 +354,7 @@ Targ_Silent(gn) *----------------------------------------------------------------------- */ bool -Targ_Precious(gn) - GNode *gn; /* the node to check */ +Targ_Precious(GNode *gn) { if (allPrecious || (gn->type & (OP_PRECIOUS|OP_DOUBLEDEP))) return true; @@ -384,15 +376,13 @@ static GNode *mainTarg; /* the main target, as set by Targ_SetMain */ *----------------------------------------------------------------------- */ void -Targ_SetMain(gn) - GNode *gn; /* The main target we'll create */ +Targ_SetMain(GNode *gn) { mainTarg = gn; } static void -TargPrintName(gnp) - void *gnp; +TargPrintName(void *gnp) { GNode *gn = (GNode *)gnp; printf("%s ", gn->name); @@ -400,8 +390,7 @@ TargPrintName(gnp) void -Targ_PrintCmd(cmd) - void *cmd; +Targ_PrintCmd(void *cmd) { printf("\t%s\n", (char *)cmd); } @@ -420,8 +409,7 @@ Targ_PrintCmd(cmd) *----------------------------------------------------------------------- */ char * -Targ_FmtTime(time) - TIMESTAMP time; +Targ_FmtTime(TIMESTAMP time) { struct tm *parts; static char buf[128]; @@ -443,8 +431,7 @@ Targ_FmtTime(time) *----------------------------------------------------------------------- */ void -Targ_PrintType(type) - int type; +Targ_PrintType(int type) { int tbit; @@ -483,9 +470,7 @@ Targ_PrintType(type) *----------------------------------------------------------------------- */ static void -TargPrintNode(gn, pass) - GNode *gn; - int pass; +TargPrintNode(GNode *gn, int pass) { if (!OP_NOP(gn->type)) { printf("#\n"); @@ -558,8 +543,7 @@ TargPrintNode(gn, pass) *----------------------------------------------------------------------- */ static void -TargPrintOnlySrc(gn) - GNode *gn; +TargPrintOnlySrc(GNode *gn) { if (OP_NOP(gn->type)) printf("#\t%s [%s]\n", gn->name, @@ -573,8 +557,7 @@ TargPrintOnlySrc(gn) *----------------------------------------------------------------------- */ void -Targ_PrintGraph(pass) - int pass; /* Which pass this is. 1 => no processing +Targ_PrintGraph(int pass) /* Which pass this is. 1 => no processing * 2 => processing done */ { GNode *gn; diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c index 9f518f81b6b..0fe87c4ad06 100644 --- a/usr.bin/make/timestamp.c +++ b/usr.bin/make/timestamp.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: timestamp.c,v 1.1 2001/05/23 12:34:50 espie Exp $ */ +/* $OpenBSD: timestamp.c,v 1.2 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -34,12 +34,10 @@ #include <utime.h> #endif -TIMESTAMP now; /* The time at the start of this whole - * process */ +TIMESTAMP now; /* The time at the start of this whole process */ int -set_times(f) - const char *f; +set_times(const char *f) { #ifdef USE_TIMESPEC struct timeval tv[2]; diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index e2dbb058871..114c429bdad 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: var.c,v 1.58 2003/10/07 18:33:08 fgsch Exp $ */ +/* $OpenBSD: var.c,v 1.59 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -195,8 +195,7 @@ static find_t find_pos(int); #include "varhashconsts.h" void -SymTable_Init(ctxt) - SymTable *ctxt; +SymTable_Init(SymTable *ctxt) { static SymTable sym_template; memcpy(ctxt, &sym_template, sizeof(*ctxt)); @@ -204,8 +203,7 @@ SymTable_Init(ctxt) #ifdef CLEANUP void -SymTable_Destroy(ctxt) - SymTable *ctxt; +SymTable_Destroy(SymTable *ctxt) { int i; @@ -216,15 +214,12 @@ SymTable_Destroy(ctxt) #endif static int -quick_lookup(name, end, pk) - const char *name; - const char **end; - u_int32_t *pk; +quick_lookup(const char *name, const char **enamePtr, u_int32_t *pk) { size_t len; - *pk = ohash_interval(name, end); - len = *end - name; + *pk = ohash_interval(name, enamePtr); + len = *enamePtr - name; /* substitute short version for long local name */ switch (*pk % MAGICSLOTS1) { /* MAGICSLOTS should be the */ case K_LONGALLSRC % MAGICSLOTS1: /* smallest constant yielding */ @@ -330,10 +325,7 @@ quick_lookup(name, end, pk) } void -Varq_Set(idx, val, gn) - int idx; - const char *val; - GNode *gn; +Varq_Set(int idx, const char *val, GNode *gn) { /* We only look for a variable in the given context since anything set * here will override anything in a lower context, so there's not much @@ -354,10 +346,7 @@ Varq_Set(idx, val, gn) } void -Varq_Append(idx, val, gn) - int idx; - const char *val; - GNode *gn; +Varq_Append(int idx, const char *val, GNode *gn) { Var *v = gn->context.locals[idx]; @@ -374,9 +363,7 @@ Varq_Append(idx, val, gn) } char * -Varq_Value(idx, gn) - int idx; - GNode *gn; +Varq_Value(int idx, GNode *gn) { Var *v = gn->context.locals[idx]; @@ -387,8 +374,7 @@ Varq_Value(idx, gn) } static const char * -context_name(ctxt) - GSymT *ctxt; +context_name(GSymT *ctxt) { if (ctxt == VAR_GLOBAL) return "Global"; @@ -403,18 +389,14 @@ context_name(ctxt) * This avoids looking through the environment several times. */ static Var * -create_var(name, end) - const char *name; - const char *end; +create_var(const char *name, const char *ename) { - return ohash_create_entry(&var_info, name, &end); + return ohash_create_entry(&var_info, name, &ename); } /* Set the initial value a var should have */ static void -var_init_string(v, val) - Var *v; - const char *val; +var_init_string(Var *v, const char *val) { size_t len; @@ -424,14 +406,11 @@ var_init_string(v, val) } static Var * -new_var(name, end, val) - const char *name; - const char *end; - const char *val; +new_var(const char *name, const char *ename, const char *val) { Var *v; - v = create_var(name, end); + v = create_var(name, ename); #ifdef STATS_VAR_LOOKUP STAT_VAR_CREATION++; #endif @@ -444,17 +423,14 @@ new_var(name, end, val) } static Var * -var_from_env(name, end, k) - const char *name; - const char *end; - u_int32_t k; +var_from_env(const char *name, const char *ename, u_int32_t k) { char *env; Var *v; /* getenv requires a null-terminated name, so we create the var * structure first. */ - v = create_var(name, end); + v = create_var(name, ename); env = getenv(v->name); if (env == NULL) v->flags = VAR_DUMMY; @@ -470,18 +446,14 @@ var_from_env(name, end, k) STAT_VAR_FROM_ENV++; #endif - ohash_insert(VAR_GLOBAL, ohash_lookup_interval(VAR_GLOBAL, name, end, k), v); + ohash_insert(VAR_GLOBAL, ohash_lookup_interval(VAR_GLOBAL, name, ename, k), v); return v; } static Var * -getvar(ctxt, name, end, k) - GSymT *ctxt; - const char *name; - const char *end; - u_int32_t k; +getvar(GSymT *ctxt, const char *name, const char *ename, u_int32_t k) { - return ohash_find(ctxt, ohash_lookup_interval(ctxt, name, end, k)); + return ohash_find(ctxt, ohash_lookup_interval(ctxt, name, ename, k)); } /*- @@ -497,11 +469,10 @@ getvar(ctxt, name, end, k) *----------------------------------------------------------------------- */ static Var * -VarFindi(name, end, ctxt, flags) - const char *name; /* name to find */ - const char *end; /* end of name */ - SymTable *ctxt; /* context in which to find it */ - int flags; /* FIND_MINE set means to look in the +VarFindi(const char *name, /* name to find */ + const char *ename, /* end of name */ + SymTable *ctxt, /* context in which to find it */ + int flags) /* FIND_MINE set means to look in the * CTXT_GLOBAL and CTXT_CMD contexts also. * FIND_ENV set means to look in the * environment */ @@ -513,18 +484,13 @@ VarFindi(name, end, ctxt, flags) STAT_VAR_FIND++; #endif - idx = quick_lookup(name, &end, &k); - return varfind(name, end, ctxt, flags, idx, k); + idx = quick_lookup(name, &ename, &k); + return varfind(name, ename, ctxt, flags, idx, k); } static Var * -varfind(name, end, ctxt, flags, idx, k) - const char *name; - const char *end; - SymTable *ctxt; - int flags; - int idx; - u_int32_t k; +varfind(const char *name, const char *ename, SymTable *ctxt, int flags, + int idx, u_int32_t k) { Var *v; @@ -542,7 +508,7 @@ varfind(name, end, ctxt, flags, idx, k) look for it in CTXT_CMD, CTXT_GLOBAL and the environment, depending on the FIND_* flags in 'flags' */ if (ctxt == CTXT_CMD || ctxt == CTXT_GLOBAL) - v = getvar((GSymT *)ctxt, name, end, k); + v = getvar((GSymT *)ctxt, name, ename, k); else v = NULL; @@ -552,21 +518,21 @@ varfind(name, end, ctxt, flags, idx, k) break; case FIND_MINE: if (ctxt != CTXT_CMD) - v = getvar(VAR_CMD, name, end, k); + v = getvar(VAR_CMD, name, ename, k); if (v == NULL && ctxt != CTXT_GLOBAL) - v = getvar(VAR_GLOBAL, name, end, k); + v = getvar(VAR_GLOBAL, name, ename, k); break; case FIND_ENV: - v = var_from_env(name, end, k); + v = var_from_env(name, ename, k); break; case FIND_ENV | FIND_MINE: if (ctxt != CTXT_CMD) - v = getvar(VAR_CMD, name, end, k); + v = getvar(VAR_CMD, name, ename, k); if (v == NULL) { if (ctxt != CTXT_GLOBAL) - v = getvar(VAR_GLOBAL, name, end, k); + v = getvar(VAR_GLOBAL, name, ename, k); if (v == NULL) - v = var_from_env(name, end, k); + v = var_from_env(name, ename, k); else if (checkEnvFirst && (v->flags & VAR_FROM_ENV) == 0) { char *env; @@ -600,20 +566,16 @@ varfind(name, end, ctxt, flags, idx, k) *----------------------------------------------------------------------- */ static Var * -VarAdd(name, end, k, val, ctxt) - const char *name; /* name of variable to add */ - const char *end; - u_int32_t k; - const char *val; /* value to set it to */ - GSymT *ctxt; /* context in which to set it */ +VarAdd(const char *name, const char *ename, u_int32_t k, const char *val, + GSymT *ctxt) { Var *v; - v = new_var(name, end, val); + v = new_var(name, ename, val); v->flags = 0; - ohash_insert(ctxt, ohash_lookup_interval(ctxt, name, end, k), v); + ohash_insert(ctxt, ohash_lookup_interval(ctxt, name, ename, k), v); if (DEBUG(VAR)) printf("%s:%s = %s\n", context_name(ctxt), v->name, val); return v; @@ -626,8 +588,7 @@ VarAdd(name, end, k, val, ctxt) *----------------------------------------------------------------------- */ static void -VarDelete(vp) - void *vp; +VarDelete(void *vp) { Var *v = (Var *)vp; @@ -639,23 +600,22 @@ VarDelete(vp) void -Var_Delete(name) - const char *name; +Var_Delete(const char *name) { Var *v; u_int32_t k; unsigned int slot; - const char *end = NULL; + const char *ename = NULL; int idx; if (DEBUG(VAR)) printf("delete %s\n", name); - idx = quick_lookup(name, &end, &k); + idx = quick_lookup(name, &ename, &k); if (idx != -1) Parse_Error(PARSE_FATAL, "Trying to delete dynamic variable"); - slot = ohash_lookup_interval(VAR_GLOBAL, name, end, k); + slot = ohash_lookup_interval(VAR_GLOBAL, name, ename, k); v = ohash_find(VAR_GLOBAL, slot); if (v != NULL && (v->flags & VAR_READ_ONLY) == 0) { ohash_remove(VAR_GLOBAL, slot); @@ -669,17 +629,13 @@ Var_Delete(name) * CTXT_CMD is searched. */ void -Var_Seti(name, end, val, ctxt) - const char *name; /* name of variable to set */ - const char *end; - const char *val; /* value to give to the variable */ - GSymT *ctxt; /* context in which to set it */ +Var_Seti(const char *name, const char *ename, const char *val, GSymT *ctxt) { Var *v; u_int32_t k; int idx; - idx = quick_lookup(name, &end, &k); + idx = quick_lookup(name, &ename, &k); if (idx != -1) Parse_Error(PARSE_FATAL, "Trying to set dynamic variable $%s", varnames[idx]); @@ -687,9 +643,9 @@ Var_Seti(name, end, val, ctxt) /* We only look for a variable in the given context since anything set * here will override anything in a lower context, so there's not much * point in searching them all just to save a bit of memory... */ - v = varfind(name, end, (SymTable *)ctxt, 0, idx, k); + v = varfind(name, ename, (SymTable *)ctxt, 0, idx, k); if (v == NULL) - v = VarAdd(name, end, k, val, ctxt); + v = VarAdd(name, ename, k, val, ctxt); else { if ((v->flags & VAR_READ_ONLY) == 0) { if ((v->flags & VAR_DUMMY) == 0) { @@ -711,11 +667,7 @@ Var_Seti(name, end, val, ctxt) } void -Var_Appendi(name, end, val, ctxt) - const char *name; /* Name of variable to modify */ - const char *end; - const char *val; /* String to append to it */ - GSymT *ctxt; /* Context in which this should occur */ +Var_Appendi(const char *name, const char *ename, const char *val, GSymT *ctxt) { Var *v; u_int32_t k; @@ -723,12 +675,12 @@ Var_Appendi(name, end, val, ctxt) assert(ctxt == VAR_GLOBAL || ctxt == VAR_CMD); - idx = quick_lookup(name, &end, &k); + idx = quick_lookup(name, &ename, &k); if (idx != -1) Parse_Error(PARSE_FATAL, "Trying to append to dynamic variable $%s", varnames[idx]); - v = varfind(name, end, (SymTable *)ctxt, FIND_ENV, idx, k); + v = varfind(name, ename, (SymTable *)ctxt, FIND_ENV, idx, k); if ((v->flags & VAR_READ_ONLY) == 0) { if ((v->flags & VAR_DUMMY) == 0) { @@ -745,13 +697,11 @@ Var_Appendi(name, end, val, ctxt) } char * -Var_Valuei(name, end) - const char *name; /* name to find */ - const char *end; +Var_Valuei(const char *name, const char *ename) { Var *v; - v = VarFindi(name, end, NULL, FIND_ENV | FIND_MINE); + v = VarFindi(name, ename, NULL, FIND_ENV | FIND_MINE); if (v != NULL && (v->flags & VAR_DUMMY) == 0) return VarValue(v); else @@ -759,8 +709,7 @@ Var_Valuei(name, end) } static const char * -find_0(p) - const char *p; +find_0(const char *p) { while (*p != '$' && *p != '\0' && *p != ':') p++; @@ -768,8 +717,7 @@ find_0(p) } static const char * -find_rparen(p) - const char *p; +find_rparen(const char *p) { while (*p != '$' && *p != '\0' && *p != ')' && *p != ':') p++; @@ -777,8 +725,7 @@ find_rparen(p) } static const char * -find_ket(p) - const char *p; +find_ket(const char *p) { while (*p != '$' && *p != '\0' && *p != '}' && *p != ':') p++; @@ -786,8 +733,7 @@ find_ket(p) } static find_t -find_pos(c) - int c; +find_pos(int c) { switch(c) { case '\0': @@ -802,10 +748,7 @@ find_pos(c) } size_t -Var_ParseSkip(str, ctxt, result) - const char *str; - SymTable *ctxt; - bool *result; +Var_ParseSkip(const char *str, SymTable *ctxt, bool *result) { const char *tstr; /* Pointer into str */ Var *v; /* Variable in invocation */ @@ -850,12 +793,8 @@ Var_ParseSkip(str, ctxt, result) * speed, it may be better to revisit the implementation to do things * directly. */ bool -Var_ParseBuffer(buf, str, ctxt, err, lengthPtr) - Buffer buf; - const char *str; - SymTable *ctxt; - bool err; - size_t *lengthPtr; +Var_ParseBuffer(Buffer buf, const char *str, SymTable *ctxt, bool err, + size_t *lengthPtr) { char *result; bool freeIt; @@ -871,12 +810,11 @@ Var_ParseBuffer(buf, str, ctxt, err, lengthPtr) } char * -Var_Parse(str, ctxt, err, lengthPtr, freePtr) - const char *str; /* The string to parse */ - SymTable *ctxt; /* The context for the variable */ - bool err; /* true if undefined variables are an error */ - size_t *lengthPtr; /* OUT: The length of the specification */ - bool *freePtr; /* OUT: true if caller should free result */ +Var_Parse(const char *str, /* The string to parse */ + SymTable *ctxt, /* The context for the variable */ + bool err, /* true if undefined variables are an error */ + size_t *lengthPtr, /* OUT: The length of the specification */ + bool *freePtr) /* OUT: true if caller should free result */ { const char *tstr; /* Pointer into str */ Var *v; /* Variable in invocation */ @@ -979,22 +917,21 @@ Var_Parse(str, ctxt, err, lengthPtr, freePtr) } char * -Var_Subst(str, ctxt, undefErr) - const char *str; /* the string in which to substitute */ - SymTable *ctxt; /* the context wherein to find variables */ - bool undefErr; /* true if undefineds are an error */ +Var_Subst(const char *str, /* the string in which to substitute */ + SymTable *ctxt, /* the context wherein to find variables */ + bool undefErr) /* true if undefineds are an error */ { - BUFFER buf; /* Buffer for forming things */ - static bool errorReported; /* Set true if an error has already - * been reported to prevent a plethora - * of messages when recursing */ + BUFFER buf; /* Buffer for forming things */ + static bool errorReported; /* Set true if an error has already + * been reported to prevent a plethora + * of messages when recursing */ Buf_Init(&buf, MAKE_BSIZE); errorReported = false; for (;;) { - char *val; /* Value to substitute for a variable */ - size_t length; /* Length of the variable invocation */ + char *val; /* Value to substitute for a variable */ + size_t length; /* Length of the variable invocation */ bool doFree; /* Set true if val should be freed */ const char *cp; @@ -1051,11 +988,10 @@ Var_Subst(str, ctxt, undefErr) } void -Var_SubstVar(buf, str, var, val) - Buffer buf; - const char *str; /* The string in which to substitute */ - const char *var; /* Named variable */ - const char *val; /* Its value */ +Var_SubstVar(Buffer buf, /* To store result */ + const char *str, /* The string in which to substitute */ + const char *var, /* Named variable */ + const char *val) /* Its value */ { assert(*var != '\0'); @@ -1148,7 +1084,7 @@ Var_SubstVar(buf, str, var, val) *----------------------------------------------------------------------- */ void -Var_Init() +Var_Init(void) { static GSymT global_vars, cmd_vars; @@ -1165,7 +1101,7 @@ Var_Init() #ifdef CLEANUP void -Var_End() +Var_End(void) { Var *v; unsigned int i; @@ -1182,8 +1118,7 @@ Var_End() static const char *interpret(int); static const char * -interpret(f) - int f; +interpret(int f) { if (f & VAR_DUMMY) return "(D)"; @@ -1193,15 +1128,14 @@ interpret(f) /****************** PRINT DEBUGGING INFO *****************/ static void -VarPrintVar(v) - Var *v; +VarPrintVar(Var *v) { printf("%-16s%s = %s\n", v->name, interpret(v->flags), (v->flags & VAR_DUMMY) == 0 ? VarValue(v) : "(none)"); } void -Var_Dump() +Var_Dump(void) { Var *v; unsigned int i; @@ -1224,8 +1158,7 @@ static const char *quotable = " \t\n\\'\""; * propagated to sub makes through MAKEFLAGS. */ void -Var_AddCmdline(name) - const char *name; +Var_AddCmdline(const char *name) { Var *v; unsigned int i; diff --git a/usr.bin/make/varmodifiers.c b/usr.bin/make/varmodifiers.c index 81b651c422b..490006d04e5 100644 --- a/usr.bin/make/varmodifiers.c +++ b/usr.bin/make/varmodifiers.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: varmodifiers.c,v 1.12 2003/10/07 18:33:08 fgsch Exp $ */ +/* $OpenBSD: varmodifiers.c,v 1.13 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -263,11 +263,7 @@ VarModifiers_Init() *----------------------------------------------------------------------- */ static bool -VarHead(word, addSpace, buf, dummy) - struct Name *word; - bool addSpace; - Buffer buf; - void *dummy UNUSED; +VarHead(struct Name *word, bool addSpace, Buffer buf, void *dummy UNUSED) { const char *slash; @@ -294,11 +290,7 @@ VarHead(word, addSpace, buf, dummy) *----------------------------------------------------------------------- */ static bool -VarTail(word, addSpace, buf, dummy) - struct Name *word; - bool addSpace; - Buffer buf; - void *dummy UNUSED; +VarTail(struct Name *word, bool addSpace, Buffer buf, void *dummy UNUSED) { const char *slash; @@ -319,11 +311,7 @@ VarTail(word, addSpace, buf, dummy) *----------------------------------------------------------------------- */ static bool -VarSuffix(word, addSpace, buf, dummy) - struct Name *word; - bool addSpace; - Buffer buf; - void *dummy UNUSED; +VarSuffix(struct Name *word, bool addSpace, Buffer buf, void *dummy UNUSED) { const char *dot; @@ -345,11 +333,7 @@ VarSuffix(word, addSpace, buf, dummy) *----------------------------------------------------------------------- */ static bool -VarRoot(word, addSpace, buf, dummy) - struct Name *word; - bool addSpace; - Buffer buf; - void *dummy UNUSED; +VarRoot(struct Name *word, bool addSpace, Buffer buf, void *dummy UNUSED) { const char *dot; @@ -370,11 +354,8 @@ VarRoot(word, addSpace, buf, dummy) *----------------------------------------------------------------------- */ static bool -VarMatch(word, addSpace, buf, pattern) - struct Name *word; - bool addSpace; - Buffer buf; - void *pattern; /* Pattern the word must match */ +VarMatch(struct Name *word, bool addSpace, Buffer buf, + void *pattern) /* Pattern the word must match */ { const char *pat = (const char *)pattern; @@ -394,11 +375,8 @@ VarMatch(word, addSpace, buf, pattern) *----------------------------------------------------------------------- */ static bool -VarNoMatch(word, addSpace, buf, pattern) - struct Name *word; - bool addSpace; - Buffer buf; - void *pattern; /* Pattern the word must not match */ +VarNoMatch(struct Name *word, bool addSpace, Buffer buf, + void *pattern) /* Pattern the word must not match */ { const char *pat = (const char *)pattern; @@ -412,11 +390,7 @@ VarNoMatch(word, addSpace, buf, pattern) } static bool -VarUniq(word, addSpace, buf, lastp) - struct Name *word; - bool addSpace; - Buffer buf; - void *lastp; +VarUniq(struct Name *word, bool addSpace, Buffer buf, void *lastp) { struct Name *last = (struct Name *)lastp; @@ -434,11 +408,7 @@ VarUniq(word, addSpace, buf, lastp) } static bool -VarLoop(word, addSpace, buf, vp) - struct Name *word; - bool addSpace; - Buffer buf; - void *vp; +VarLoop(struct Name *word, bool addSpace, Buffer buf, void *vp) { struct LoopStuff *v = (struct LoopStuff *)vp; @@ -449,10 +419,7 @@ VarLoop(word, addSpace, buf, vp) } static char * -finish_loop(s, n, p) - const char *s; - const struct Name *n UNUSED; - void *p; +finish_loop(const char *s, const struct Name *n UNUSED , void *p) { struct LoopStuff *l = (struct LoopStuff *)p; @@ -460,9 +427,7 @@ finish_loop(s, n, p) } static int -NameCompare(ap, bp) - const void *ap; - const void *bp; +NameCompare(const void *ap, const void *bp) { struct Name *a, *b; size_t n, m; @@ -489,10 +454,7 @@ NameCompare(ap, bp) } static char * -do_sort(s, dummy, arg) - const char *s; - const struct Name *dummy UNUSED; - void *arg UNUSED; +do_sort(const char *s, const struct Name *dummy UNUSED, void *arg UNUSED) { struct Name *t; unsigned long n, i, j; @@ -533,19 +495,13 @@ do_sort(s, dummy, arg) } static char * -do_label(s, n, arg) - const char *s UNUSED; - const struct Name *n; - void *arg UNUSED; +do_label(const char *s UNUSED, const struct Name *n, void *arg UNUSED) { return Str_dupi(n->s, n->e); } static char * -do_path(s, n, arg) - const char *s UNUSED; - const struct Name *n; - void *arg UNUSED; +do_path(const char *s UNUSED, const struct Name *n, void *arg UNUSED) { GNode *gn; @@ -557,10 +513,7 @@ do_path(s, n, arg) } static char * -do_def(s, n, arg) - const char *s; - const struct Name *n UNUSED; - void *arg; +do_def(const char *s, const struct Name *n UNUSED, void *arg) { VarPattern *v = (VarPattern *)arg; if (s == NULL) { @@ -571,10 +524,7 @@ do_def(s, n, arg) } static char * -do_undef(s, n, arg) - const char *s; - const struct Name *n UNUSED; - void *arg; +do_undef(const char *s, const struct Name *n UNUSED, void *arg) { VarPattern *v = (VarPattern *)arg; if (s != NULL) { @@ -585,10 +535,7 @@ do_undef(s, n, arg) } static char * -do_assign(s, n, arg) - const char *s; - const struct Name *n; - void *arg; +do_assign(const char *s, const struct Name *n, void *arg) { VarPattern *v = (VarPattern *)arg; char *msg; @@ -622,10 +569,7 @@ do_assign(s, n, arg) } static char * -do_exec(s, n, arg) - const char *s UNUSED; - const struct Name *n UNUSED; - void *arg; +do_exec(const char *s UNUSED, const struct Name *n UNUSED, void *arg) { VarPattern *v = (VarPattern *)arg; char *msg; @@ -645,11 +589,8 @@ do_exec(s, n, arg) *----------------------------------------------------------------------- */ static bool -VarSYSVMatch(word, addSpace, buf, patp) - struct Name *word; - bool addSpace; - Buffer buf; - void *patp; /* Pattern the word must match */ +VarSYSVMatch(struct Name *word, bool addSpace, Buffer buf, + void *patp) /* Pattern the word must match */ { size_t len; const char *ptr; @@ -668,11 +609,8 @@ VarSYSVMatch(word, addSpace, buf, patp) } void * -get_sysvpattern(p, ctxt, err, endc) - const char **p; - SymTable *ctxt UNUSED; - bool err UNUSED; - int endc; +get_sysvpattern(const char **p, SymTable *ctxt UNUSED, bool err UNUSED, + int endc) { VarPattern *pattern; const char *cp, *cp2; @@ -723,11 +661,8 @@ get_sysvpattern(p, ctxt, err, endc) *----------------------------------------------------------------------- */ static bool -VarSubstitute(word, addSpace, buf, patternp) - struct Name *word; - bool addSpace; - Buffer buf; - void *patternp; /* Pattern for substitution */ +VarSubstitute(struct Name *word, bool addSpace, Buffer buf, + void *patternp) /* Pattern for substitution */ { size_t wordLen; /* Length of word */ const char *cp; /* General pointer */ @@ -856,10 +791,7 @@ VarSubstitute(word, addSpace, buf, patternp) *----------------------------------------------------------------------- */ static void -VarREError(err, pat, str) - int err; - regex_t *pat; - const char *str; +VarREError(int err, regex_t *pat, const char *str) { char *errbuf; int errlen; @@ -879,11 +811,7 @@ VarREError(err, pat, str) *----------------------------------------------------------------------- */ static bool -VarRESubstitute(word, addSpace, buf, patternp) - struct Name *word; - bool addSpace; - Buffer buf; - void *patternp; +VarRESubstitute(struct Name *word, bool addSpace, Buffer buf, void *patternp) { VarREPattern *pat; int xrv; @@ -996,11 +924,10 @@ VarRESubstitute(word, addSpace, buf, patternp) *----------------------------------------------------------------------- */ static char * -VarModify(str, modProc, datum) - char *str; /* String whose words should be trimmed */ +VarModify(char *str, /* String whose words should be trimmed */ /* Function to use to modify them */ - bool (*modProc)(struct Name *, bool, Buffer, void *); - void *datum; /* Datum to pass it */ + bool (*modProc)(struct Name *, bool, Buffer, void *), + void *datum) /* Datum to pass it */ { BUFFER buf; /* Buffer for the new string */ bool addSpace; /* true if need to add a space to the @@ -1041,14 +968,8 @@ VarModify(str, modProc, datum) *----------------------------------------------------------------------- */ static char * -VarGetPattern(ctxt, err, tstr, delim1, delim2, length, pattern) - SymTable *ctxt; - int err; - const char **tstr; - int delim1; - int delim2; - size_t *length; - VarPattern *pattern; +VarGetPattern(SymTable *ctxt, int err, const char **tstr, int delim1, + int delim2, size_t *length, VarPattern *pattern) { const char *cp; char *result; @@ -1116,10 +1037,7 @@ VarGetPattern(ctxt, err, tstr, delim1, delim2, length, pattern) *----------------------------------------------------------------------- */ static char * -VarQuote(str, n, dummy) - const char *str; - const struct Name *n UNUSED; - void *dummy UNUSED; +VarQuote(const char *str, const struct Name *n UNUSED, void *dummy UNUSED) { BUFFER buf; @@ -1136,11 +1054,7 @@ VarQuote(str, n, dummy) } static void * -check_empty(p, ctxt, b, endc) - const char **p; - SymTable *ctxt UNUSED; - bool b UNUSED; - int endc; +check_empty(const char **p, SymTable *ctxt UNUSED, bool b UNUSED, int endc) { dummy_arg->s = NULL; if ((*p)[1] == endc || (*p)[1] == ':') { @@ -1151,11 +1065,7 @@ check_empty(p, ctxt, b, endc) } static void * -check_shcmd(p, ctxt, b, endc) - const char **p; - SymTable *ctxt UNUSED; - bool b UNUSED; - int endc; +check_shcmd(const char **p, SymTable *ctxt UNUSED, bool b UNUSED, int endc) { if ((*p)[1] == 'h' && ((*p)[2] == endc || (*p)[2] == ':')) { (*p)+=2; @@ -1166,10 +1076,7 @@ check_shcmd(p, ctxt, b, endc) static char * -do_shcmd(s, n, arg) - const char *s; - const struct Name *n UNUSED; - void *arg UNUSED; +do_shcmd(const char *s, const struct Name *n UNUSED, void *arg UNUSED) { char *err; char *t; @@ -1181,11 +1088,7 @@ do_shcmd(s, n, arg) } static void * -get_stringarg(p, ctxt, b, endc) - const char **p; - SymTable *ctxt UNUSED; - bool b UNUSED; - int endc; +get_stringarg(const char **p, SymTable *ctxt UNUSED, bool b UNUSED, int endc) { const char *cp; char *s; @@ -1203,17 +1106,13 @@ get_stringarg(p, ctxt, b, endc) } static void -free_stringarg(arg) - void *arg; +free_stringarg(void *arg) { free(arg); } static char * -do_upper(s, n, arg) - const char *s; - const struct Name *n UNUSED; - void *arg UNUSED; +do_upper(const char *s, const struct Name *n UNUSED, void *arg UNUSED) { size_t len, i; char *t; @@ -1227,10 +1126,7 @@ do_upper(s, n, arg) } static char * -do_lower(s, n, arg) - const char *s; - const struct Name *n UNUSED; - void *arg UNUSED; +do_lower(const char *s, const struct Name *n UNUSED, void *arg UNUSED) { size_t len, i; char *t; @@ -1244,22 +1140,14 @@ do_lower(s, n, arg) } static void * -get_patternarg(p, ctxt, err, endc) - const char **p; - SymTable *ctxt; - bool err; - int endc; +get_patternarg(const char **p, SymTable *ctxt, bool err, int endc) { return common_get_patternarg(p, ctxt, err, endc, false); } /* Extract anchors */ static void * -get_spatternarg(p, ctxt, err, endc) - const char **p; - SymTable *ctxt; - bool err; - int endc; +get_spatternarg(const char **p, SymTable *ctxt, bool err, int endc) { VarPattern *pattern; @@ -1279,8 +1167,7 @@ get_spatternarg(p, ctxt, err, endc) } static void -free_looparg(arg) - void *arg; +free_looparg(void *arg) { struct LoopStuff *l = (struct LoopStuff *)arg; @@ -1289,8 +1176,7 @@ free_looparg(arg) } static char * -LoopGrab(s) - const char **s; +LoopGrab(const char **s) { const char *p, *start; @@ -1306,11 +1192,7 @@ LoopGrab(s) } static void * -get_loop(p, ctxt, err, endc) - const char **p; - SymTable *ctxt; - bool err; - int endc; +get_loop(const char **p, SymTable *ctxt, bool err, int endc) { static struct LoopStuff loop; const char *s; @@ -1334,12 +1216,8 @@ get_loop(p, ctxt, err, endc) } static void * -common_get_patternarg(p, ctxt, err, endc, dosubst) - const char **p; - SymTable *ctxt; - bool err; - int endc; - bool dosubst; +common_get_patternarg(const char **p, SymTable *ctxt, bool err, int endc, + bool dosubst) { VarPattern *pattern; char delim; @@ -1387,11 +1265,7 @@ common_get_patternarg(p, ctxt, err, endc, dosubst) } static void * -assign_get_value(p, ctxt, err, endc) - const char **p; - SymTable *ctxt; - bool err; - int endc; +assign_get_value(const char **p, SymTable *ctxt, bool err, int endc) { const char *s; int flags; @@ -1418,11 +1292,7 @@ assign_get_value(p, ctxt, err, endc) } static void * -get_value(p, ctxt, err, endc) - const char **p; - SymTable *ctxt; - bool err; - int endc; +get_value(const char **p, SymTable *ctxt, bool err, int endc) { VarPattern *pattern; const char *s; @@ -1441,11 +1311,7 @@ get_value(p, ctxt, err, endc) } static void * -get_cmd(p, ctxt, err, endc) - const char **p; - SymTable *ctxt; - bool err; - int endc UNUSED; +get_cmd(const char **p, SymTable *ctxt, bool err, int endc UNUSED) { VarPattern *pattern; const char *s; @@ -1464,8 +1330,7 @@ get_cmd(p, ctxt, err, endc) } static void -free_patternarg(p) - void *p; +free_patternarg(void *p) { VarPattern *vp = (VarPattern *)p; @@ -1476,10 +1341,7 @@ free_patternarg(p) #ifndef MAKE_BOOTSTRAP static char * -do_regex(s, n, arg) - const char *s; - const struct Name *n UNUSED; - void *arg; +do_regex(const char *s, const struct Name *n UNUSED, void *arg) { VarREPattern p2; VarPattern *p = (VarPattern *)arg; @@ -1507,15 +1369,8 @@ do_regex(s, n, arg) #endif char * -VarModifiers_Apply(str, name, ctxt, err, freePtr, start, endc, lengthPtr) - char *str; - const struct Name *name; - SymTable *ctxt; - bool err; - bool *freePtr; - const char *start; - int endc; - size_t *lengthPtr; +VarModifiers_Apply(char *str, const struct Name *name, SymTable *ctxt, + bool err, bool *freePtr, const char *start, int endc, size_t *lengthPtr) { const char *tstr; bool atstart; /* Some ODE modifiers only make sense at start */ @@ -1606,15 +1461,13 @@ VarModifiers_Apply(str, name, ctxt, err, freePtr, start, endc, lengthPtr) } char * -Var_GetHead(s) - char *s; +Var_GetHead(char *s) { return VarModify(s, VarHead, NULL); } char * -Var_GetTail(s) - char *s; +Var_GetTail(char *s) { return VarModify(s, VarTail, NULL); } diff --git a/usr.bin/make/varname.c b/usr.bin/make/varname.c index 51a30aa277e..e2f493496af 100644 --- a/usr.bin/make/varname.c +++ b/usr.bin/make/varname.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: varname.c,v 1.1 2001/05/23 12:34:52 espie Exp $ */ +/* $OpenBSD: varname.c,v 1.2 2004/04/07 13:11:36 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -33,12 +33,7 @@ #include "varname.h" const char * -VarName_Get(start, name, ctxt, err, cont) - const char *start; - struct Name *name; - SymTable *ctxt; - bool err; - const char *(*cont)(const char *); +VarName_Get(const char *start, struct Name *name, SymTable *ctxt, bool err, const char *(*cont)(const char *)) { const char *p; size_t len; @@ -74,8 +69,7 @@ VarName_Get(start, name, ctxt, err, cont) } void -VarName_Free(name) - struct Name *name; +VarName_Free(struct Name *name) { if (name->tofree) free((char *)name->s); |