summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/make/arch.c76
-rw-r--r--usr.bin/make/buf.c50
-rw-r--r--usr.bin/make/compat.c22
-rw-r--r--usr.bin/make/cond.c53
-rw-r--r--usr.bin/make/dir.c94
-rw-r--r--usr.bin/make/for.c9
-rw-r--r--usr.bin/make/hash.c43
-rw-r--r--usr.bin/make/job.c120
-rw-r--r--usr.bin/make/main.c56
-rw-r--r--usr.bin/make/make.c49
-rw-r--r--usr.bin/make/parse.c100
-rw-r--r--usr.bin/make/str.c34
-rw-r--r--usr.bin/make/suff.c144
-rw-r--r--usr.bin/make/targ.c64
-rw-r--r--usr.bin/make/var.c197
15 files changed, 340 insertions, 771 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 983dc42..063ad7a 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -136,8 +136,7 @@ static int ArchSVR4Entry(Arch *, char *, size_t, FILE *);
*-----------------------------------------------------------------------
*/
static void
-ArchFree(ap)
- void * ap;
+ArchFree(void *ap)
{
Arch *a = (Arch *) ap;
Hash_Search search;
@@ -162,7 +161,9 @@ ArchFree(ap)
* Arch_ParseArchive --
* Parse the archive specification in the given line and find/create
* the nodes for the specified archive members, placing their nodes
- * on the given list.
+ * on the given list, given the pointer to the start of the
+ * specification, a Lst on which to place the nodes, and a context
+ * in which to expand variables.
*
* Results:
* SUCCESS if it was a valid specification. The linePtr is updated
@@ -175,10 +176,7 @@ ArchFree(ap)
*-----------------------------------------------------------------------
*/
ReturnStatus
-Arch_ParseArchive (linePtr, nodeLst, ctxt)
- char **linePtr; /* Pointer to start of specification */
- Lst nodeLst; /* Lst on which to place the nodes */
- GNode *ctxt; /* Context in which to expand variables */
+Arch_ParseArchive (char **linePtr, Lst nodeLst, GNode *ctxt)
{
char *cp; /* Pointer into line */
GNode *gn; /* New node */
@@ -424,7 +422,8 @@ Arch_ParseArchive (linePtr, nodeLst, ctxt)
*-----------------------------------------------------------------------
* ArchFindArchive --
* See if the given archive is the one we are looking for. Called
- * From ArchStatMember and ArchFindMember via Lst_Find.
+ * From ArchStatMember and ArchFindMember via Lst_Find with the
+ * current list element and the name we want.
*
* Results:
* 0 if it is, non-zero if it isn't.
@@ -435,9 +434,7 @@ Arch_ParseArchive (linePtr, nodeLst, ctxt)
*-----------------------------------------------------------------------
*/
static int
-ArchFindArchive (ar, archName)
- void * ar; /* Current list element */
- void * archName; /* Name we want */
+ArchFindArchive (void *ar, void *archName)
{
return (strcmp ((char *) archName, ((Arch *) ar)->name));
}
@@ -446,7 +443,8 @@ ArchFindArchive (ar, archName)
*-----------------------------------------------------------------------
* ArchStatMember --
* Locate a member of an archive, given the path of the archive and
- * the path of the desired member.
+ * the path of the desired member, and a boolean representing whether
+ * or not the archive should be hashed (if not already hashed).
*
* Results:
* A pointer to the current struct ar_hdr structure for the member. Note
@@ -460,12 +458,7 @@ ArchFindArchive (ar, archName)
*-----------------------------------------------------------------------
*/
static struct ar_hdr *
-ArchStatMember (archive, member, hash)
- char *archive; /* Path to the archive */
- char *member; /* Name of member. If it is a path, only the
- * last component is used. */
- Boolean hash; /* TRUE if archive should be hashed if not
- * already so. */
+ArchStatMember (char *archive, char *member, Boolean hash)
{
#define AR_MAX_NAME_LEN (sizeof(arh.ar_name)-1)
FILE * arch; /* Stream to archive */
@@ -684,11 +677,7 @@ badarch:
*-----------------------------------------------------------------------
*/
static int
-ArchSVR4Entry(ar, name, size, arch)
- Arch *ar;
- char *name;
- size_t size;
- FILE *arch;
+ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE *arch)
{
#define ARLONGNAMES1 "//"
#define ARLONGNAMES2 "/ARFILENAMES"
@@ -760,7 +749,8 @@ ArchSVR4Entry(ar, name, size, arch)
* ArchFindMember --
* Locate a member of an archive, given the path of the archive and
* the path of the desired member. If the archive is to be modified,
- * the mode should be "r+", if not, it should be "r".
+ * the mode should be "r+", if not, it should be "r". arhPtr is a
+ * poitner to the header structure to fill in.
*
* Results:
* An FILE *, opened for reading and writing, positioned at the
@@ -773,12 +763,7 @@ ArchSVR4Entry(ar, name, size, arch)
*-----------------------------------------------------------------------
*/
static FILE *
-ArchFindMember (archive, member, arhPtr, mode)
- char *archive; /* Path to the archive */
- 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 */
- char *mode; /* The mode for opening the stream */
+ArchFindMember (char *archive, char *member, struct ar_hdr *arhPtr, char *mode)
{
FILE * arch; /* Stream to archive */
int size; /* Size of archive member */
@@ -921,8 +906,7 @@ skip:
*-----------------------------------------------------------------------
*/
void
-Arch_Touch (gn)
- GNode *gn; /* Node of member to touch */
+Arch_Touch (GNode *gn)
{
FILE * arch; /* Stream open to archive, positioned properly */
struct ar_hdr arh; /* Current header describing member */
@@ -957,8 +941,7 @@ Arch_Touch (gn)
*-----------------------------------------------------------------------
*/
void
-Arch_TouchLib (gn)
- GNode *gn; /* The node of the library to touch */
+Arch_TouchLib (GNode *gn)
{
#ifdef RANLIBMAG
FILE * arch; /* Stream open to archive */
@@ -981,7 +964,8 @@ Arch_TouchLib (gn)
/*-
*-----------------------------------------------------------------------
* Arch_MTime --
- * Return the modification time of a member of an archive.
+ * Return the modification time of a member of an archive, given its
+ * name.
*
* Results:
* The modification time (seconds).
@@ -993,8 +977,7 @@ Arch_TouchLib (gn)
*-----------------------------------------------------------------------
*/
int
-Arch_MTime (gn)
- GNode *gn; /* Node describing archive member */
+Arch_MTime(GNode *gn)
{
struct ar_hdr *arhPtr; /* Header of desired member */
int modTime; /* Modification time as an integer */
@@ -1031,8 +1014,7 @@ Arch_MTime (gn)
*-----------------------------------------------------------------------
*/
int
-Arch_MemMTime (gn)
- GNode *gn;
+Arch_MemMTime (GNode *gn)
{
LstNode ln;
GNode *pgn;
@@ -1079,7 +1061,7 @@ Arch_MemMTime (gn)
/*-
*-----------------------------------------------------------------------
* Arch_FindLib --
- * Search for a library along the given search path.
+ * Search for a named library along the given search path.
*
* Results:
* None.
@@ -1097,9 +1079,7 @@ Arch_MemMTime (gn)
*-----------------------------------------------------------------------
*/
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 sz;
@@ -1123,7 +1103,8 @@ Arch_FindLib (gn, path)
*-----------------------------------------------------------------------
* Arch_LibOODate --
* Decide if a node with the OP_LIB attribute is out-of-date. Called
- * from Make_OODate to make its life easier.
+ * from Make_OODate to make its life easier, with the library's
+ * graph node.
*
* There are several ways for a library to be out-of-date that are
* not available to ordinary files. In addition, there are ways
@@ -1156,8 +1137,7 @@ Arch_FindLib (gn, path)
*-----------------------------------------------------------------------
*/
Boolean
-Arch_LibOODate (gn)
- GNode *gn; /* The library's graph node */
+Arch_LibOODate (GNode *gn)
{
Boolean oodate;
@@ -1210,7 +1190,7 @@ Arch_LibOODate (gn)
*-----------------------------------------------------------------------
*/
void
-Arch_Init ()
+Arch_Init (void)
{
archives = Lst_Init (FALSE);
}
@@ -1231,7 +1211,7 @@ Arch_Init ()
*-----------------------------------------------------------------------
*/
void
-Arch_End ()
+Arch_End (void)
{
Lst_Destroy(archives, ArchFree);
}
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c
index eb6b8cb..49523af 100644
--- a/usr.bin/make/buf.c
+++ b/usr.bin/make/buf.c
@@ -92,9 +92,7 @@ __FBSDID("$FreeBSD$");
*-----------------------------------------------------------------------
*/
void
-Buf_OvAddByte (bp, byte)
- Buffer bp;
- int byte;
+Buf_OvAddByte (Buffer bp, int byte)
{
bp->left = 0;
BufExpand (bp, 1);
@@ -122,10 +120,7 @@ Buf_OvAddByte (bp, byte)
*-----------------------------------------------------------------------
*/
void
-Buf_AddBytes (bp, numBytes, bytesPtr)
- Buffer bp;
- int numBytes;
- const Byte *bytesPtr;
+Buf_AddBytes (Buffer bp, int numBytes, const Byte *bytesPtr)
{
BufExpand (bp, numBytes);
@@ -154,9 +149,7 @@ Buf_AddBytes (bp, numBytes, bytesPtr)
*-----------------------------------------------------------------------
*/
void
-Buf_UngetByte (bp, byte)
- Buffer bp;
- int byte;
+Buf_UngetByte (Buffer bp, int byte)
{
if (bp->outPtr != bp->buffer) {
@@ -204,10 +197,7 @@ Buf_UngetByte (bp, byte)
*-----------------------------------------------------------------------
*/
void
-Buf_UngetBytes (bp, numBytes, bytesPtr)
- Buffer bp;
- int numBytes;
- Byte *bytesPtr;
+Buf_UngetBytes (Buffer bp, int numBytes, Byte *bytesPtr)
{
if (bp->outPtr - bp->buffer >= numBytes) {
@@ -249,8 +239,7 @@ Buf_UngetBytes (bp, numBytes, bytesPtr)
*-----------------------------------------------------------------------
*/
int
-Buf_GetByte (bp)
- Buffer bp;
+Buf_GetByte (Buffer bp)
{
int res;
@@ -282,10 +271,7 @@ Buf_GetByte (bp)
*-----------------------------------------------------------------------
*/
int
-Buf_GetBytes (bp, numBytes, bytesPtr)
- Buffer bp;
- int numBytes;
- Byte *bytesPtr;
+Buf_GetBytes (Buffer bp, int numBytes, Byte *bytesPtr)
{
if (bp->inPtr - bp->outPtr < numBytes) {
@@ -316,9 +302,7 @@ Buf_GetBytes (bp, numBytes, bytesPtr)
*-----------------------------------------------------------------------
*/
Byte *
-Buf_GetAll (bp, numBytesPtr)
- Buffer bp;
- int *numBytesPtr;
+Buf_GetAll (Buffer bp, int *numBytesPtr)
{
if (numBytesPtr != (int *)NULL) {
@@ -342,9 +326,7 @@ Buf_GetAll (bp, numBytesPtr)
*-----------------------------------------------------------------------
*/
void
-Buf_Discard (bp, numBytes)
- Buffer bp;
- int numBytes;
+Buf_Discard (Buffer bp, int numBytes)
{
if (bp->inPtr - bp->outPtr <= numBytes) {
@@ -371,8 +353,7 @@ Buf_Discard (bp, numBytes)
*-----------------------------------------------------------------------
*/
int
-Buf_Size (buf)
- Buffer buf;
+Buf_Size (Buffer buf)
{
return (buf->inPtr - buf->outPtr);
}
@@ -393,8 +374,7 @@ Buf_Size (buf)
*-----------------------------------------------------------------------
*/
Buffer
-Buf_Init (size)
- int size; /* Initial size for the buffer */
+Buf_Init (int size)
{
Buffer bp; /* New Buffer */
@@ -414,7 +394,7 @@ Buf_Init (size)
/*-
*-----------------------------------------------------------------------
* Buf_Destroy --
- * Nuke a buffer and all its resources.
+ * Destroy a buffer, and optionally free its data, too.
*
* Results:
* None.
@@ -425,9 +405,7 @@ Buf_Init (size)
*-----------------------------------------------------------------------
*/
void
-Buf_Destroy (buf, freeData)
- Buffer buf; /* Buffer to destroy */
- Boolean freeData; /* TRUE if the data should be destroyed as well */
+Buf_Destroy (Buffer buf, Boolean freeData)
{
if (freeData) {
@@ -451,9 +429,7 @@ Buf_Destroy (buf, freeData)
*-----------------------------------------------------------------------
*/
void
-Buf_ReplaceLastByte (buf, byte)
- Buffer buf; /* buffer to augment */
- int byte; /* byte to be written */
+Buf_ReplaceLastByte (Buffer buf, int byte)
{
if (buf->inPtr == buf->outPtr)
Buf_AddByte(buf, byte);
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index c329760..29e89a6 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -104,8 +104,7 @@ static char *sh_builtin[] = {
*-----------------------------------------------------------------------
*/
static void
-CompatInterrupt (signo)
- int signo;
+CompatInterrupt (int signo)
{
GNode *gn;
@@ -149,8 +148,7 @@ CompatInterrupt (signo)
*-----------------------------------------------------------------------
*/
static int
-shellneed (cmd)
- char *cmd;
+shellneed (char *cmd)
{
char **av, **p;
int ac;
@@ -167,6 +165,7 @@ shellneed (cmd)
* CompatRunCommand --
* Execute the next command for a target. If the command returns an
* error, the node's made field is set to ERROR and creation stops.
+ * The node from which the command came is also given.
*
* Results:
* 0 if the command succeeded, 1 if an error occurred.
@@ -177,9 +176,7 @@ shellneed (cmd)
*-----------------------------------------------------------------------
*/
static int
-CompatRunCommand (cmdp, gnp)
- void * cmdp; /* Command to execute */
- void * gnp; /* Node from which the command came */
+CompatRunCommand (void *cmdp, void *gnp)
{
char *cmdStart; /* Start of expanded command */
char *cp;
@@ -399,7 +396,7 @@ CompatRunCommand (cmdp, gnp)
/*-
*-----------------------------------------------------------------------
* CompatMake --
- * Make a target.
+ * Make a target, given the parent, to abort if necessary.
*
* Results:
* 0
@@ -410,9 +407,7 @@ CompatRunCommand (cmdp, gnp)
*-----------------------------------------------------------------------
*/
static int
-CompatMake (gnp, pgnp)
- void * gnp; /* The node to make */
- void * pgnp; /* Parent to abort if necessary */
+CompatMake (void *gnp, void *pgnp)
{
GNode *gn = (GNode *) gnp;
GNode *pgn = (GNode *) pgnp;
@@ -617,7 +612,7 @@ CompatMake (gnp, pgnp)
/*-
*-----------------------------------------------------------------------
* Compat_Run --
- * Initialize this mode and start making.
+ * Start making again, given a list of target nodes.
*
* Results:
* None.
@@ -628,8 +623,7 @@ CompatMake (gnp, pgnp)
*-----------------------------------------------------------------------
*/
void
-Compat_Run(targs)
- Lst targs; /* List of target nodes to re-create */
+Compat_Run(Lst targs)
{
char *cp; /* Pointer to string of shell meta-characters */
GNode *gn = NULL;/* Current root target */
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 029c48c..a6eb9a9 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -153,8 +153,7 @@ static Boolean skipLine = FALSE; /* Whether the parse module is skipping
*-----------------------------------------------------------------------
*/
static void
-CondPushBack (t)
- Token t; /* Token to push back into the "stream" */
+CondPushBack (Token t)
{
condPushBack = t;
}
@@ -162,7 +161,8 @@ CondPushBack (t)
/*-
*-----------------------------------------------------------------------
* CondGetArg --
- * Find the argument of a built-in function.
+ * Find the argument of a built-in function. parens is set to TRUE
+ * if the arguments are bounded by parens.
*
* Results:
* The length of the argument and the address of the argument.
@@ -174,11 +174,7 @@ CondPushBack (t)
*-----------------------------------------------------------------------
*/
static int
-CondGetArg (linePtr, argPtr, func, parens)
- char **linePtr;
- char **argPtr;
- char *func;
- Boolean parens; /* TRUE if arg should be bounded by parens */
+CondGetArg (char **linePtr, char **argPtr, char *func, Boolean parens)
{
char *cp;
int argLen;
@@ -276,9 +272,7 @@ CondGetArg (linePtr, argPtr, func, parens)
*-----------------------------------------------------------------------
*/
static Boolean
-CondDoDefined (argLen, arg)
- int argLen;
- char *arg;
+CondDoDefined (int argLen, char *arg)
{
char savec = arg[argLen];
char *p1;
@@ -310,9 +304,7 @@ CondDoDefined (argLen, arg)
*-----------------------------------------------------------------------
*/
static int
-CondStrMatch(string, pattern)
- void * string;
- void * pattern;
+CondStrMatch(void *string, void *pattern)
{
return(!Str_Match((char *) string,(char *) pattern));
}
@@ -331,9 +323,7 @@ CondStrMatch(string, pattern)
*-----------------------------------------------------------------------
*/
static Boolean
-CondDoMake (argLen, arg)
- int argLen;
- char *arg;
+CondDoMake (int argLen, char *arg)
{
char savec = arg[argLen];
Boolean result;
@@ -362,9 +352,7 @@ CondDoMake (argLen, arg)
*-----------------------------------------------------------------------
*/
static Boolean
-CondDoExists (argLen, arg)
- int argLen;
- char *arg;
+CondDoExists (int argLen, char *arg)
{
char savec = arg[argLen];
Boolean result;
@@ -396,9 +384,7 @@ CondDoExists (argLen, arg)
*-----------------------------------------------------------------------
*/
static Boolean
-CondDoTarget (argLen, arg)
- int argLen;
- char *arg;
+CondDoTarget (int argLen, char *arg)
{
char savec = arg[argLen];
Boolean result;
@@ -436,9 +422,7 @@ CondDoTarget (argLen, arg)
*-----------------------------------------------------------------------
*/
static char *
-CondCvtArg(str, value)
- char *str;
- double *value;
+CondCvtArg(char *str, double *value)
{
if ((*str == '0') && (str[1] == 'x')) {
long i;
@@ -477,8 +461,7 @@ CondCvtArg(str, value)
*-----------------------------------------------------------------------
*/
static Token
-CondToken(doEval)
- Boolean doEval;
+CondToken(Boolean doEval)
{
Token t;
@@ -913,8 +896,7 @@ error:
*-----------------------------------------------------------------------
*/
static Token
-CondT(doEval)
- Boolean doEval;
+CondT(Boolean doEval)
{
Token t;
@@ -962,8 +944,7 @@ CondT(doEval)
*-----------------------------------------------------------------------
*/
static Token
-CondF(doEval)
- Boolean doEval;
+CondF(Boolean doEval)
{
Token l, o;
@@ -1009,8 +990,7 @@ CondF(doEval)
*-----------------------------------------------------------------------
*/
static Token
-CondE(doEval)
- Boolean doEval;
+CondE(Boolean doEval)
{
Token l, o;
@@ -1064,8 +1044,7 @@ CondE(doEval)
*-----------------------------------------------------------------------
*/
int
-Cond_Eval (line)
- char *line; /* Line to parse */
+Cond_Eval (char *line)
{
struct If *ifp;
Boolean isElse;
@@ -1245,7 +1224,7 @@ Cond_Eval (line)
*-----------------------------------------------------------------------
*/
void
-Cond_End()
+Cond_End(void)
{
if (condTop != MAXIF) {
Parse_Error(PARSE_FATAL, "%d open conditional%s", MAXIF-condTop,
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 8c63ee0..49a3cf9 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -209,7 +209,7 @@ static int DirPrintDir(void *, void *);
*-----------------------------------------------------------------------
*/
void
-Dir_Init ()
+Dir_Init (void)
{
dirSearchPath = Lst_Init (FALSE);
openDirectories = Lst_Init (FALSE);
@@ -246,7 +246,7 @@ Dir_Init ()
*-----------------------------------------------------------------------
*/
void
-Dir_End()
+Dir_End(void)
{
dot->refCount -= 1;
Dir_Destroy((void *) dot);
@@ -272,9 +272,7 @@ Dir_End()
*-----------------------------------------------------------------------
*/
static int
-DirFindName (p, dname)
- void * p; /* Current name */
- void * dname; /* Desired name */
+DirFindName (void *p, void *dname)
{
return (strcmp (((Path *)p)->name, (char *) dname));
}
@@ -282,7 +280,7 @@ DirFindName (p, dname)
/*-
*-----------------------------------------------------------------------
* Dir_HasWildcards --
- * see if the given name has any wildcard characters in it
+ * See if the given name has any wildcard characters in it.
*
* Results:
* returns TRUE if the word should be expanded, FALSE otherwise
@@ -292,8 +290,7 @@ DirFindName (p, dname)
*-----------------------------------------------------------------------
*/
Boolean
-Dir_HasWildcards (name)
- char *name; /* name to check */
+Dir_HasWildcards (char *name)
{
char *cp;
int wild = 0, brace = 0, bracket = 0;
@@ -343,10 +340,7 @@ Dir_HasWildcards (name)
*-----------------------------------------------------------------------
*/
static int
-DirMatchFiles (pattern, p, expansions)
- char *pattern; /* Pattern to look for */
- Path *p; /* Directory to search */
- Lst expansions; /* Place to store the results */
+DirMatchFiles (char *pattern, Path *p, Lst expansions)
{
Hash_Search search; /* Index into the directory's table */
Hash_Entry *entry; /* Current entry in the table */
@@ -383,7 +377,10 @@ DirMatchFiles (pattern, p, expansions)
* Expand curly braces like the C shell. Does this recursively.
* Note the special case: if after the piece of the curly brace is
* done there are no wildcard characters in the result, the result is
- * placed on the list WITHOUT CHECKING FOR ITS EXISTENCE.
+ * placed on the list WITHOUT CHECKING FOR ITS EXISTENCE. The
+ * given arguments are the entire word to expand, the first curly
+ * brace in the word, the search path, and the list to store the
+ * expansions in.
*
* Results:
* None.
@@ -394,11 +391,7 @@ DirMatchFiles (pattern, p, expansions)
*-----------------------------------------------------------------------
*/
static void
-DirExpandCurly(word, brace, path, expansions)
- char *word; /* Entire word to expand */
- char *brace; /* First curly brace in it */
- Lst path; /* Search path to use */
- Lst expansions; /* Place to store the expansions */
+DirExpandCurly(char *word, char *brace, Lst path, Lst expansions)
{
char *end; /* Character after the closing brace */
char *cp; /* Current position in brace clause */
@@ -496,7 +489,8 @@ DirExpandCurly(word, brace, path, expansions)
* DirExpandInt --
* Internal expand routine. Passes through the directories in the
* path one by one, calling DirMatchFiles for each. NOTE: This still
- * doesn't handle patterns in directories...
+ * doesn't handle patterns in directories... Works given a word to
+ * expand, a path to look in, and a list to store expansions in.
*
* Results:
* None.
@@ -507,10 +501,7 @@ DirExpandCurly(word, brace, path, expansions)
*-----------------------------------------------------------------------
*/
static void
-DirExpandInt(word, path, expansions)
- char *word; /* Word to expand */
- Lst path; /* Path on which to look */
- Lst expansions; /* Place to store the result */
+DirExpandInt(char *word, Lst path, Lst expansions)
{
LstNode ln; /* Current node */
Path *p; /* Directory in the node */
@@ -539,13 +530,11 @@ DirExpandInt(word, path, expansions)
*-----------------------------------------------------------------------
*/
static int
-DirPrintWord(word, dummy)
- void * word;
- void * dummy;
+DirPrintWord(void *word, void *dummy __unused)
{
DEBUGF(DIR, ("%s ", (char *) word));
- return(dummy ? 0 : 0);
+ return (0);
}
/*-
@@ -556,18 +545,14 @@ DirPrintWord(word, dummy)
*
* Results:
* A list of words consisting of the files which exist along the search
- * path matching the given pattern.
+ * path matching the given pattern is placed in expansions.
*
* Side Effects:
* Directories may be opened. Who knows?
*-----------------------------------------------------------------------
*/
void
-Dir_Expand (word, path, expansions)
- char *word; /* the word to expand */
- Lst path; /* the list of directories in which to find
- * the resulting files */
- Lst expansions; /* the list on which to place the results */
+Dir_Expand (char *word, Lst path, Lst expansions)
{
char *cp;
@@ -678,9 +663,7 @@ Dir_Expand (word, path, expansions)
*-----------------------------------------------------------------------
*/
char *
-Dir_FindFile (name, path)
- char *name; /* the file to find */
- Lst path; /* the Lst of directories to search */
+Dir_FindFile (char *name, Lst path)
{
char *p1; /* pointer into p->name */
char *p2; /* pointer into name */
@@ -936,9 +919,7 @@ Dir_FindFile (name, path)
*-----------------------------------------------------------------------
*/
int
-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 */
@@ -1000,10 +981,7 @@ Dir_MTime (gn)
*-----------------------------------------------------------------------
*/
void
-Dir_AddDir (path, name)
- Lst path; /* the path to which the directory should be
- * added */
- char *name; /* the name of the directory to add */
+Dir_AddDir (Lst path, char *name)
{
LstNode ln; /* node in case Path structure is found */
Path *p; /* pointer to new Path structure */
@@ -1074,8 +1052,7 @@ Dir_AddDir (path, name)
*-----------------------------------------------------------------------
*/
void *
-Dir_CopyDir(p)
- void * p;
+Dir_CopyDir(void *p)
{
((Path *) p)->refCount += 1;
@@ -1100,9 +1077,7 @@ Dir_CopyDir(p)
*-----------------------------------------------------------------------
*/
char *
-Dir_MakeFlags (flag, path)
- char *flag; /* flag which should precede each directory */
- Lst path; /* list of directories */
+Dir_MakeFlags (char *flag, Lst path)
{
char *str; /* the string which will be returned */
char *tstr; /* the current directory preceded by 'flag' */
@@ -1139,8 +1114,7 @@ Dir_MakeFlags (flag, path)
*-----------------------------------------------------------------------
*/
void
-Dir_Destroy (pp)
- void * pp; /* The directory descriptor to nuke */
+Dir_Destroy (void *pp)
{
Path *p = (Path *) pp;
p->refCount -= 1;
@@ -1172,8 +1146,7 @@ Dir_Destroy (pp)
*-----------------------------------------------------------------------
*/
void
-Dir_ClearPath(path)
- Lst path; /* Path to clear */
+Dir_ClearPath(Lst path)
{
Path *p;
while (!Lst_IsEmpty(path)) {
@@ -1198,9 +1171,7 @@ Dir_ClearPath(path)
*-----------------------------------------------------------------------
*/
void
-Dir_Concat(path1, path2)
- Lst path1; /* Dest */
- Lst path2; /* Source */
+Dir_Concat(Lst path1, Lst path2)
{
LstNode ln;
Path *p;
@@ -1216,7 +1187,7 @@ Dir_Concat(path1, path2)
/********** DEBUG INFO **********/
void
-Dir_PrintDirectories()
+Dir_PrintDirectories(void)
{
LstNode ln;
Path *p;
@@ -1236,17 +1207,16 @@ Dir_PrintDirectories()
}
}
-static int DirPrintDir (p, dummy)
- void * p;
- void * dummy;
+static int
+DirPrintDir (void *p, void *dummy __unused)
{
printf ("%s ", ((Path *) p)->name);
- return (dummy ? 0 : 0);
+
+ return (0);
}
void
-Dir_PrintPath (path)
- Lst path;
+Dir_PrintPath (Lst path)
{
Lst_ForEach (path, DirPrintDir, (void *)0);
}
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index c152008..87890af 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -106,8 +106,7 @@ static int ForExec(void *, void *);
*-----------------------------------------------------------------------
*/
int
-For_Eval (line)
- char *line; /* Line to parse */
+For_Eval (char *line)
{
char *ptr = line, *sub, *wrd;
int level; /* Level at which to report errors. */
@@ -247,9 +246,7 @@ For_Eval (line)
*-----------------------------------------------------------------------
*/
static int
-ForExec(namep, argp)
- void * namep;
- void * argp;
+ForExec(void *namep, void *argp)
{
char *name = (char *) namep;
For *arg = (For *) argp;
@@ -278,7 +275,7 @@ ForExec(namep, argp)
*-----------------------------------------------------------------------
*/
void
-For_Run()
+For_Run(void)
{
For arg;
diff --git a/usr.bin/make/hash.c b/usr.bin/make/hash.c
index bc55c5d..7d2c64d 100644
--- a/usr.bin/make/hash.c
+++ b/usr.bin/make/hash.c
@@ -72,8 +72,11 @@ static void RebuildTable(Hash_Table *);
*---------------------------------------------------------
*
* Hash_InitTable --
+ *
+ * Set up the hash table t with a given number of buckets, or a
+ * reasonable default if the number requested is less than or
+ * equal to zero. Hash tables will grow in size as needed.
*
- * This routine just sets up the hash table.
*
* Results:
* None.
@@ -85,13 +88,7 @@ static void RebuildTable(Hash_Table *);
*/
void
-Hash_InitTable(t, numBuckets)
- Hash_Table *t; /* Structure to use to hold table. */
- int numBuckets; /* How many buckets to create for starters.
- * This number is rounded up to a power of
- * two. If <= 0, a reasonable default is
- * chosen. The table will grow in size later
- * as needed. */
+Hash_InitTable(Hash_Table *t, int numBuckets)
{
int i;
struct Hash_Entry **hp;
@@ -132,8 +129,7 @@ Hash_InitTable(t, numBuckets)
*/
void
-Hash_DeleteTable(t)
- Hash_Table *t;
+Hash_DeleteTable(Hash_Table *t)
{
struct Hash_Entry **hp, *h, *nexth = NULL;
int i;
@@ -172,9 +168,7 @@ Hash_DeleteTable(t)
*/
Hash_Entry *
-Hash_FindEntry(t, key)
- Hash_Table *t; /* Hash table to search. */
- char *key; /* A hash key. */
+Hash_FindEntry(Hash_Table *t, char *key)
{
Hash_Entry *e;
unsigned h;
@@ -209,14 +203,10 @@ Hash_FindEntry(t, key)
*/
Hash_Entry *
-Hash_CreateEntry(t, key, newPtr)
- Hash_Table *t; /* Hash table to search. */
- char *key; /* A hash key. */
- Boolean *newPtr; /* Filled in with TRUE if new entry created,
- * FALSE otherwise. */
+Hash_CreateEntry(Hash_Table *t, char *key, Boolean *newPtr)
{
Hash_Entry *e;
- unsigned h;
+ unsigned int h;
char *p;
int keylen;
struct Hash_Entry **hp;
@@ -276,9 +266,7 @@ Hash_CreateEntry(t, key, newPtr)
*/
void
-Hash_DeleteEntry(t, e)
- Hash_Table *t;
- Hash_Entry *e;
+Hash_DeleteEntry(Hash_Table *t, Hash_Entry *e)
{
Hash_Entry **hp, *p;
@@ -317,10 +305,7 @@ Hash_DeleteEntry(t, e)
*/
Hash_Entry *
-Hash_EnumFirst(t, searchPtr)
- Hash_Table *t; /* Table to be searched. */
- Hash_Search *searchPtr; /* Area in which to keep state
- * about search.*/
+Hash_EnumFirst(Hash_Table *t, Hash_Search *searchPtr)
{
searchPtr->tablePtr = t;
searchPtr->nextIndex = 0;
@@ -347,8 +332,7 @@ Hash_EnumFirst(t, searchPtr)
*/
Hash_Entry *
-Hash_EnumNext(searchPtr)
- Hash_Search *searchPtr; /* Area used to keep state about search. */
+Hash_EnumNext(Hash_Search *searchPtr)
{
Hash_Entry *e;
Hash_Table *t = searchPtr->tablePtr;
@@ -392,8 +376,7 @@ Hash_EnumNext(searchPtr)
*/
static void
-RebuildTable(t)
- Hash_Table *t;
+RebuildTable(Hash_Table *t)
{
Hash_Entry *e, *next = NULL, **hp, **xp;
int i, mask;
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 7026b88..d83f8eb 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -342,9 +342,7 @@ static void JobRestartJobs(void);
*-----------------------------------------------------------------------
*/
static int
-JobCondPassSig(jobp, signop)
- void * jobp; /* Job to biff */
- void * signop; /* Signal to send it */
+JobCondPassSig(void *jobp, void *signop)
{
Job *job = (Job *) jobp;
int signo = *(int *) signop;
@@ -380,8 +378,7 @@ JobCondPassSig(jobp, signop)
*-----------------------------------------------------------------------
*/
static void
-JobPassSig(signo)
- int signo; /* The signal number we've received */
+JobPassSig(int signo)
{
sigset_t nmask, omask;
struct sigaction act;
@@ -450,9 +447,7 @@ JobPassSig(signo)
*-----------------------------------------------------------------------
*/
static int
-JobCmpPid(job, pid)
- void * job; /* job to examine */
- void * pid; /* process id desired */
+JobCmpPid(void *job, void *pid)
{
return *(int *) pid - ((Job *) job)->pid;
}
@@ -472,9 +467,7 @@ JobCmpPid(job, pid)
*-----------------------------------------------------------------------
*/
static int
-JobCmpRmtID(job, rmtID)
- void * job; /* job to examine */
- void * rmtID; /* remote id desired */
+JobCmpRmtID(void *job, void *rmtID)
{
return(*(int *) rmtID - *(int *) job->rmtID);
}
@@ -508,9 +501,7 @@ JobCmpRmtID(job, rmtID)
*-----------------------------------------------------------------------
*/
static int
-JobPrintCommand(cmdp, jobp)
- void * cmdp; /* command string to print */
- void * jobp; /* job for which to print it */
+JobPrintCommand(void *cmdp, void *jobp)
{
Boolean noSpecials; /* true if we shouldn't worry about
* inserting special commands into
@@ -667,9 +658,7 @@ JobPrintCommand(cmdp, jobp)
*-----------------------------------------------------------------------
*/
static int
-JobSaveCommand(cmd, gn)
- void * cmd;
- void * gn;
+JobSaveCommand(void *cmd, void *gn)
{
cmd = (void *) Var_Subst(NULL, (char *) cmd, (GNode *) gn, FALSE);
(void) Lst_AtEnd(postCommands->commands, cmd);
@@ -691,8 +680,7 @@ JobSaveCommand(cmd, gn)
*-----------------------------------------------------------------------
*/
static void
-JobClose(job)
- Job *job;
+JobClose(Job *job)
{
if (usePipes) {
#ifdef RMT_WILL_WATCH
@@ -736,9 +724,7 @@ JobClose(job)
*/
/*ARGSUSED*/
static void
-JobFinish(job, status)
- Job *job; /* job to finish */
- int *status; /* sub-why job went away */
+JobFinish(Job *job, int *status)
{
Boolean done;
@@ -983,7 +969,7 @@ JobFinish(job, status)
*-----------------------------------------------------------------------
* Job_Touch --
* Touch the given target. Called by JobStart when the -t flag was
- * given
+ * given. Prints messages unless told to be silent.
*
* Results:
* None
@@ -994,9 +980,7 @@ JobFinish(job, status)
*-----------------------------------------------------------------------
*/
void
-Job_Touch(gn, silent)
- GNode *gn; /* the node of the file to touch */
- Boolean silent; /* TRUE if should not print messages */
+Job_Touch(GNode *gn, Boolean silent)
{
int streamID; /* ID of stream opened to do the touch */
struct utimbuf times; /* Times for utime() call */
@@ -1065,11 +1049,7 @@ Job_Touch(gn, silent)
*-----------------------------------------------------------------------
*/
Boolean
-Job_CheckCommands(gn, abortProc)
- GNode *gn; /* The target whose commands need
- * verifying */
- void (*abortProc)(const char *, ...);
- /* Function to abort with message */
+Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
{
if (OP_NOP(gn->type) && Lst_IsEmpty(gn->commands) &&
(gn->type & OP_LIB) == 0) {
@@ -1137,9 +1117,7 @@ Job_CheckCommands(gn, abortProc)
*/
/*ARGSUSED*/
static void
-JobLocalInput(stream, job)
- int stream; /* Stream that's ready (ignored) */
- Job *job; /* Job to which the stream belongs */
+JobLocalInput(int stream, Job *job)
{
JobDoOutput(job, FALSE);
}
@@ -1161,9 +1139,7 @@ JobLocalInput(stream, job)
*-----------------------------------------------------------------------
*/
static void
-JobExec(job, argv)
- Job *job; /* Job to execute */
- char **argv;
+JobExec(Job *job, char **argv)
{
int cpid; /* ID of new child */
@@ -1340,9 +1316,7 @@ jobExecFinish:
*-----------------------------------------------------------------------
*/
static void
-JobMakeArgv(job, argv)
- Job *job;
- char **argv;
+JobMakeArgv(Job *job, char **argv)
{
int argc;
static char args[10]; /* For merged arguments */
@@ -1396,8 +1370,7 @@ JobMakeArgv(job, argv)
*-----------------------------------------------------------------------
*/
static void
-JobRestart(job)
- Job *job; /* Job to restart */
+JobRestart(Job *job)
{
#ifdef REMOTE
int host;
@@ -1615,12 +1588,7 @@ JobRestart(job)
*-----------------------------------------------------------------------
*/
static int
-JobStart(gn, flags, previous)
- 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,
- * if any. */
+JobStart(GNode *gn, int flags, Job *previous)
{
Job *job; /* new job descriptor */
char *argv[4]; /* Argument vector to shell */
@@ -1904,10 +1872,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;
@@ -1977,10 +1942,7 @@ JobOutput(job, cp, endp, msg)
*-----------------------------------------------------------------------
*/
STATIC void
-JobDoOutput(job, finish)
- Job *job; /* the job whose output needs printing */
- Boolean finish; /* TRUE if this is the last time we'll be
- * called for this job */
+JobDoOutput(Job *job, Boolean finish)
{
Boolean gotNL = FALSE; /* true if got a newline */
Boolean fbuf; /* true if our buffer filled up */
@@ -2171,8 +2133,7 @@ end_loop:
*-----------------------------------------------------------------------
*/
void
-Job_CatchChildren(block)
- Boolean block; /* TRUE if should block on the wait. */
+Job_CatchChildren(Boolean block)
{
int pid; /* pid of dead child */
Job *job; /* job descriptor for dead child */
@@ -2243,7 +2204,7 @@ Job_CatchChildren(block)
* -----------------------------------------------------------------------
*/
void
-Job_CatchOutput()
+Job_CatchOutput(void)
{
int nfds;
#ifdef USE_KQUEUE
@@ -2346,8 +2307,7 @@ Job_CatchOutput()
*-----------------------------------------------------------------------
*/
void
-Job_Make(gn)
- GNode *gn;
+Job_Make(GNode *gn)
{
(void) JobStart(gn, 0, NULL);
}
@@ -2355,7 +2315,8 @@ Job_Make(gn)
/*-
*-----------------------------------------------------------------------
* Job_Init --
- * Initialize the process module
+ * Initialize the process module, given a maximum number of jobs, and
+ * a maximum number of local jobs.
*
* Results:
* none
@@ -2365,11 +2326,7 @@ Job_Make(gn)
*-----------------------------------------------------------------------
*/
void
-Job_Init(maxproc, maxlocal)
- int maxproc; /* the greatest number of jobs which may be
- * running at one time */
- int maxlocal; /* the greatest number of local jobs which may
- * be running at once. */
+Job_Init(int maxproc, int maxlocal)
{
GNode *begin; /* node for commands to do at the very start */
@@ -2491,7 +2448,7 @@ Job_Init(maxproc, maxlocal)
*-----------------------------------------------------------------------
*/
Boolean
-Job_Full()
+Job_Full(void)
{
return(aborting || jobFull);
}
@@ -2513,7 +2470,7 @@ Job_Full()
* -----------------------------------------------------------------------
*/
Boolean
-Job_Empty()
+Job_Empty(void)
{
if (nJobs == 0) {
if (!Lst_IsEmpty(stoppedJobs) && !aborting) {
@@ -2546,8 +2503,7 @@ Job_Empty()
*-----------------------------------------------------------------------
*/
static Shell *
-JobMatchShell(name)
- char *name; /* Final component of shell path */
+JobMatchShell(char *name)
{
Shell *sh; /* Pointer into shells table */
Shell *match; /* Longest-matching shell */
@@ -2618,8 +2574,7 @@ JobMatchShell(name)
*-----------------------------------------------------------------------
*/
ReturnStatus
-Job_ParseShell(line)
- char *line; /* The shell spec */
+Job_ParseShell(char *line)
{
char **words;
int wordCount;
@@ -2747,10 +2702,7 @@ Job_ParseShell(line)
*-----------------------------------------------------------------------
*/
static void
-JobInterrupt(runINTERRUPT, signo)
- int runINTERRUPT; /* Non-zero if commands for the .INTERRUPT
- * target should be executed */
- int signo; /* signal received */
+JobInterrupt(int runINTERRUPT, int signo)
{
LstNode ln; /* element in job table */
Job *job = NULL; /* job descriptor in that element */
@@ -2873,7 +2825,7 @@ JobInterrupt(runINTERRUPT, signo)
*-----------------------------------------------------------------------
*/
int
-Job_Finish()
+Job_Finish(void)
{
if (postCommands != NULL && !Lst_IsEmpty(postCommands->commands)) {
if (errors) {
@@ -2907,7 +2859,7 @@ Job_Finish()
*-----------------------------------------------------------------------
*/
void
-Job_Wait()
+Job_Wait(void)
{
aborting = ABORT_WAIT;
while (nJobs != 0) {
@@ -2934,7 +2886,7 @@ Job_Wait()
*-----------------------------------------------------------------------
*/
void
-Job_AbortAll()
+Job_AbortAll(void)
{
LstNode ln; /* element in job table */
Job *job; /* the job descriptor in that element */
@@ -2979,7 +2931,8 @@ Job_AbortAll()
*-----------------------------------------------------------------------
* JobFlagForMigration --
* Handle the eviction of a child. Called from RmtStatusChange.
- * Flags the child as remigratable and then suspends it.
+ * Flags the child as remigratable and then suspends it. Takes
+ * the ID of the host we used, for matching children.
*
* Results:
* none.
@@ -2990,8 +2943,7 @@ Job_AbortAll()
*-----------------------------------------------------------------------
*/
void
-JobFlagForMigration(hostID)
- int hostID; /* ID of host we used, for matching children. */
+JobFlagForMigration(int hostID)
{
Job *job; /* job descriptor for dead child */
LstNode jnode; /* list element for finding job */
@@ -3035,7 +2987,7 @@ JobFlagForMigration(hostID)
*-----------------------------------------------------------------------
*/
static void
-JobRestartJobs()
+JobRestartJobs(void)
{
while (!jobFull && !Lst_IsEmpty(stoppedJobs)) {
DEBUGF(JOB, ("Job queue is not full. Restarting a stopped job.\n"));
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 88bf15e..3a9d30d 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -160,9 +160,7 @@ static char *objdir; /* where we chdir'ed to */
* given
*/
static void
-MainParseArgs(argc, argv)
- int argc;
- char **argv;
+MainParseArgs(int argc, char **argv)
{
char *p;
int c;
@@ -394,8 +392,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
* Only those that come from the various arguments.
*/
void
-Main_ParseArgLine(line)
- char *line; /* Line to fracture */
+Main_ParseArgLine(char *line)
{
char **argv; /* Manufactured argument vector */
int argc; /* Number of arguments in argv */
@@ -412,9 +409,7 @@ Main_ParseArgLine(line)
}
char *
-chdir_verify_path(path, obpath)
- char *path;
- char *obpath;
+chdir_verify_path(char *path, char *obpath)
{
struct stat sb;
@@ -448,9 +443,7 @@ chdir_verify_path(path, obpath)
* The program exits when done. Targets are created. etc. etc. etc.
*/
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
Lst targs; /* target nodes to create -- passed to Make_Init */
Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
@@ -925,16 +918,16 @@ main(argc, argv)
* lots
*/
static Boolean
-ReadMakefile(p, q)
- void *p;
- void *q __unused;
+ReadMakefile(void *p, void *q __unused)
{
- char *fname = p; /* makefile to read */
+ char *fname; /* makefile to read */
FILE *stream;
char *name, path[MAXPATHLEN];
char *MAKEFILE;
int setMAKEFILE;
+ fname = p;
+
if (!strcmp(fname, "-")) {
Parse_File("(stdin)", stdin);
Var_Set("MAKEFILE", "", VAR_GLOBAL);
@@ -1018,9 +1011,7 @@ found:
* The string must be freed by the caller.
*/
char *
-Cmd_Exec(cmd, error)
- char *cmd;
- char **error;
+Cmd_Exec(char *cmd, char **error)
{
char *args[4]; /* Args for invoking the shell */
int fds[2]; /* Pipe streams */
@@ -1032,7 +1023,6 @@ Cmd_Exec(cmd, error)
char *cp;
int cc;
-
*error = NULL;
/*
@@ -1263,7 +1253,7 @@ Punt(const char *fmt, ...)
* A big one...
*/
void
-DieHorribly()
+DieHorribly(void)
{
if (jobsRunning)
Job_AbortAll();
@@ -1275,7 +1265,7 @@ DieHorribly()
/*
* Finish --
* Called when aborting due to errors in child shell to signal
- * abnormal exit.
+ * abnormal exit, with the number of errors encountered in Make_Make.
*
* Results:
* None
@@ -1284,8 +1274,7 @@ DieHorribly()
* The program exits
*/
void
-Finish(errors)
- int errors; /* number of errors encountered in Make_Make */
+Finish(int errors)
{
Fatal("%d error%s", errors, errors == 1 ? "" : "s");
}
@@ -1295,8 +1284,7 @@ Finish(errors)
* malloc, but die on error.
*/
void *
-emalloc(len)
- size_t len;
+emalloc(size_t len)
{
void *p;
@@ -1310,8 +1298,7 @@ emalloc(len)
* strdup, but die on error.
*/
char *
-estrdup(str)
- const char *str;
+estrdup(const char *str)
{
char *p;
@@ -1325,9 +1312,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();
@@ -1339,7 +1324,7 @@ erealloc(ptr, size)
* die when out of memory.
*/
void
-enomem()
+enomem(void)
{
err(2, NULL);
}
@@ -1349,8 +1334,7 @@ enomem()
* Remove a file carefully, avoiding directories.
*/
int
-eunlink(file)
- const char *file;
+eunlink(const char *file)
{
struct stat st;
@@ -1369,7 +1353,7 @@ eunlink(file)
* exit with usage message
*/
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: make [-Beiknqrstv] [-D variable] [-d flags] [-E variable] [-f makefile]",
@@ -1380,9 +1364,7 @@ usage()
int
-PrintAddr(a, b)
- void * a;
- void * b __unused;
+PrintAddr(void *a, void *b __unused)
{
printf("%p ", a);
return 0;
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index 4017f6c..653bd21 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -108,9 +108,7 @@ static int MakePrintStatus(void *, void *);
*-----------------------------------------------------------------------
*/
int
-Make_TimeStamp (pgn, cgn)
- GNode *pgn; /* the current parent */
- GNode *cgn; /* the child we've just examined */
+Make_TimeStamp (GNode *pgn, GNode *cgn)
{
if (cgn->mtime > pgn->cmtime) {
pgn->cmtime = cgn->mtime;
@@ -119,9 +117,7 @@ Make_TimeStamp (pgn, cgn)
}
static int
-MakeTimeStamp (pgn, cgn)
- void * pgn; /* the current parent */
- void * cgn; /* the child we've just examined */
+MakeTimeStamp (void *pgn, void *cgn)
{
return Make_TimeStamp((GNode *) pgn, (GNode *) cgn);
}
@@ -145,8 +141,7 @@ MakeTimeStamp (pgn, cgn)
*-----------------------------------------------------------------------
*/
Boolean
-Make_OODate (gn)
- GNode *gn; /* the node to check */
+Make_OODate (GNode *gn)
{
Boolean oodate;
@@ -263,9 +258,7 @@ Make_OODate (gn)
*-----------------------------------------------------------------------
*/
static int
-MakeAddChild (gnp, lp)
- void * gnp; /* the node to add */
- void * lp; /* the list to which to add it */
+MakeAddChild (void *gnp, void *lp)
{
GNode *gn = (GNode *) gnp;
Lst l = (Lst) lp;
@@ -300,9 +293,7 @@ MakeAddChild (gnp, lp)
*-----------------------------------------------------------------------
*/
int
-Make_HandleUse (cgn, pgn)
- GNode *cgn; /* The .USE node */
- GNode *pgn; /* The target of the .USE node */
+Make_HandleUse (GNode *cgn, GNode *pgn)
{
GNode *gn; /* A child of the .USE node */
LstNode ln; /* An element in the children list */
@@ -345,9 +336,7 @@ Make_HandleUse (cgn, pgn)
return (0);
}
static int
-MakeHandleUse (pgn, cgn)
- void * pgn; /* the current parent */
- void * cgn; /* the child we've just examined */
+MakeHandleUse (void *pgn, void *cgn)
{
return Make_HandleUse((GNode *) pgn, (GNode *) cgn);
}
@@ -378,8 +367,7 @@ MakeHandleUse (pgn, cgn)
*-----------------------------------------------------------------------
*/
void
-Make_Update (cgn)
- GNode *cgn; /* the child node */
+Make_Update (GNode *cgn)
{
GNode *pgn; /* the parent node */
char *cname; /* the child's name */
@@ -540,10 +528,7 @@ Make_Update (cgn)
*-----------------------------------------------------------------------
*/
static int
-MakeAddAllSrc (cgnp, pgnp)
- void * cgnp; /* The child to add */
- void * pgnp; /* The parent to whose ALLSRC variable it should be */
- /* added */
+MakeAddAllSrc (void *cgnp, void *pgnp)
{
GNode *cgn = (GNode *) cgnp;
GNode *pgn = (GNode *) pgnp;
@@ -613,8 +598,7 @@ MakeAddAllSrc (cgnp, pgnp)
*-----------------------------------------------------------------------
*/
void
-Make_DoAllVar (gn)
- GNode *gn;
+Make_DoAllVar (GNode *gn)
{
Lst_ForEach (gn->children, MakeAddAllSrc, (void *) gn);
@@ -649,7 +633,7 @@ Make_DoAllVar (gn)
*-----------------------------------------------------------------------
*/
static Boolean
-MakeStartJobs ()
+MakeStartJobs (void)
{
GNode *gn;
@@ -714,7 +698,9 @@ MakeStartJobs ()
* MakePrintStatus --
* Print the status of a top-level node, viz. it being up-to-date
* already or not created due to an error in a lower level.
- * Callback function for Make_Run via Lst_ForEach.
+ * Callback function for Make_Run via Lst_ForEach. If gn->unmade is
+ * nonzero and that is meant to imply a cycle in the graph, then
+ * cycle is TRUE.
*
* Results:
* Always returns 0.
@@ -725,11 +711,7 @@ MakeStartJobs ()
*-----------------------------------------------------------------------
*/
static int
-MakePrintStatus(gnp, cyclep)
- 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 */
+MakePrintStatus(void *gnp, void *cyclep)
{
GNode *gn = (GNode *) gnp;
Boolean cycle = *(Boolean *) cyclep;
@@ -786,8 +768,7 @@ MakePrintStatus(gnp, cyclep)
*-----------------------------------------------------------------------
*/
Boolean
-Make_Run (targs)
- Lst targs; /* the initial list of targets */
+Make_Run (Lst targs)
{
GNode *gn; /* a temporary pointer */
Lst examine; /* List of targets to examine */
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 9375022..c19f679 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -266,8 +266,7 @@ static void ParseFinishLine(void);
*----------------------------------------------------------------------
*/
static int
-ParseFindKeyword (str)
- char *str; /* String to find */
+ParseFindKeyword (char *str)
{
int start,
end,
@@ -339,9 +338,7 @@ Parse_Error(int type, const char *fmt, ...)
*---------------------------------------------------------------------
*/
static int
-ParseLinkSrc (pgnp, cgnp)
- void * pgnp; /* The parent node */
- void * cgnp; /* The child node */
+ParseLinkSrc (void *pgnp, void *cgnp)
{
GNode *pgn = (GNode *) pgnp;
GNode *cgn = (GNode *) cgnp;
@@ -372,10 +369,7 @@ ParseLinkSrc (pgnp, cgnp)
*---------------------------------------------------------------------
*/
static int
-ParseDoOp (gnp, opp)
- void * gnp; /* The node to which the operator is to be
- * applied */
- void * opp; /* The operator to apply */
+ParseDoOp (void *gnp, void *opp)
{
GNode *gn = (GNode *) gnp;
int op = *(int *) opp;
@@ -450,9 +444,7 @@ ParseDoOp (gnp, opp)
*---------------------------------------------------------------------
*/
static int
-ParseAddDep(pp, sp)
- void * pp;
- void * sp;
+ParseAddDep(void *pp, void *sp)
{
GNode *p = (GNode *) pp;
GNode *s = (GNode *) sp;
@@ -490,10 +482,7 @@ ParseAddDep(pp, sp)
*---------------------------------------------------------------------
*/
static void
-ParseDoSrc (tOp, src, allsrc)
- int tOp; /* operator (if any) from special targets */
- char *src; /* name of the source to handle */
- Lst allsrc; /* List of all sources to wait for */
+ParseDoSrc (int tOp, char *src, Lst allsrc)
{
GNode *gn = NULL;
@@ -603,17 +592,15 @@ ParseDoSrc (tOp, src, allsrc)
*-----------------------------------------------------------------------
*/
static int
-ParseFindMain(gnp, dummy)
- void * gnp; /* Node to examine */
- void * dummy;
+ParseFindMain(void *gnp, void *dummy __unused)
{
GNode *gn = (GNode *) gnp;
if ((gn->type & (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)) == 0) {
mainNode = gn;
Targ_SetMain(gn);
- return (dummy ? 1 : 1);
+ return (1);
} else {
- return (dummy ? 0 : 0);
+ return (0);
}
}
@@ -631,9 +618,7 @@ ParseFindMain(gnp, dummy)
*-----------------------------------------------------------------------
*/
static int
-ParseAddDir(path, name)
- void * path;
- void * name;
+ParseAddDir(void *path, void *name)
{
Dir_AddDir((Lst) path, (char *) name);
return(0);
@@ -653,12 +638,10 @@ ParseAddDir(path, name)
*-----------------------------------------------------------------------
*/
static int
-ParseClearPath(path, dummy)
- void * path;
- void * dummy;
+ParseClearPath(void *path, void *dummy __unused)
{
Dir_ClearPath((Lst) path);
- return(dummy ? 0 : 0);
+ return (0);
}
/*-
@@ -696,8 +679,7 @@ ParseClearPath(path, dummy)
*---------------------------------------------------------------------
*/
static void
-ParseDoDependency (line)
- char *line; /* the line to parse */
+ParseDoDependency (char *line)
{
char *cp; /* our current position */
GNode *gn; /* a general purpose temporary node */
@@ -1251,8 +1233,7 @@ ParseDoDependency (line)
*---------------------------------------------------------------------
*/
Boolean
-Parse_IsVar (line)
- char *line; /* the line to check */
+Parse_IsVar (char *line)
{
Boolean wasSpace = FALSE; /* set TRUE if found a space */
Boolean haveName = FALSE; /* Set TRUE if have a variable name */
@@ -1353,10 +1334,7 @@ Parse_IsVar (line)
*---------------------------------------------------------------------
*/
void
-Parse_DoVar (line, ctxt)
- char *line; /* a line guaranteed to be a variable
- * assignment. This reduces error checks */
- GNode *ctxt; /* Context in which to do the assignment */
+Parse_DoVar (char *line, GNode *ctxt)
{
char *cp; /* pointer into line */
enum {
@@ -1518,9 +1496,7 @@ Parse_DoVar (line, ctxt)
* A new element is added to the commands list of the node.
*/
static int
-ParseAddCmd(gnp, cmd)
- void * gnp; /* the node to which the command is to be added */
- void * cmd; /* the command to add */
+ParseAddCmd(void *gnp, void *cmd)
{
GNode *gn = (GNode *) gnp;
/* if target already supplied, ignore commands */
@@ -1550,8 +1526,7 @@ ParseAddCmd(gnp, cmd)
*-----------------------------------------------------------------------
*/
static void
-ParseHasCommands(gnp)
- void * gnp; /* Node to examine */
+ParseHasCommands(void *gnp)
{
GNode *gn = (GNode *) gnp;
if (!Lst_IsEmpty(gn->commands)) {
@@ -1574,8 +1549,7 @@ ParseHasCommands(gnp)
*-----------------------------------------------------------------------
*/
void
-Parse_AddIncludeDir (dir)
- char *dir; /* The name of the directory to add */
+Parse_AddIncludeDir (char *dir)
{
Dir_AddDir (parseIncPath, dir);
}
@@ -1591,8 +1565,7 @@ Parse_AddIncludeDir (dir)
*---------------------------------------------------------------------
*/
static void
-ParseDoError(errmsg)
- char *errmsg; /* error message */
+ParseDoError(char *errmsg)
{
if (!isspace((unsigned char) *errmsg)) {
Parse_Error(PARSE_WARNING, "invalid syntax: .error%s", errmsg);
@@ -1628,8 +1601,7 @@ ParseDoError(errmsg)
*---------------------------------------------------------------------
*/
static void
-ParseDoInclude (file)
- char *file; /* file specification */
+ParseDoInclude (char *file)
{
char *fullname; /* full pathname of file */
IFile *oldFile; /* state associated with current file */
@@ -1806,8 +1778,7 @@ ParseDoInclude (file)
*---------------------------------------------------------------------
*/
void
-Parse_FromString(str)
- char *str;
+Parse_FromString(char *str)
{
IFile *oldFile; /* state associated with this file */
@@ -1847,8 +1818,7 @@ Parse_FromString(str)
*---------------------------------------------------------------------
*/
static void
-ParseTraditionalInclude (file)
- char *file; /* file specification */
+ParseTraditionalInclude (char *file)
{
char *fullname; /* full pathname of file */
IFile *oldFile; /* state associated with current file */
@@ -1989,8 +1959,7 @@ ParseTraditionalInclude (file)
*---------------------------------------------------------------------
*/
static int
-ParseEOF (opened)
- int opened;
+ParseEOF (int opened)
{
IFile *ifile; /* the state on the top of the includes stack */
@@ -2026,7 +1995,7 @@ ParseEOF (opened)
*---------------------------------------------------------------------
*/
static int
-ParseReadc()
+ParseReadc(void)
{
if (curFILE)
return fgetc(curFILE);
@@ -2049,8 +2018,7 @@ ParseReadc()
*---------------------------------------------------------------------
*/
static void
-ParseUnreadc(c)
- int c;
+ParseUnreadc(int c)
{
if (curFILE) {
ungetc(c, curFILE);
@@ -2064,11 +2032,11 @@ ParseUnreadc(c)
/* ParseSkipLine():
- * Grab the next line
+ * Grab the next line unless it begins with a dot (`.') and we're told to
+ * ignore such lines.
*/
static char *
-ParseSkipLine(skip)
- int skip; /* Skip lines that don't start with . */
+ParseSkipLine(int skip)
{
char *line;
int c, lastc, lineLength = 0;
@@ -2131,7 +2099,7 @@ ParseSkipLine(skip)
*---------------------------------------------------------------------
*/
static char *
-ParseReadLine ()
+ParseReadLine (void)
{
Buffer buf; /* Buffer for current line */
int c; /* the current character */
@@ -2390,7 +2358,7 @@ test_char:
*-----------------------------------------------------------------------
*/
static void
-ParseFinishLine()
+ParseFinishLine(void)
{
if (inLine) {
Lst_ForEach(targets, Suff_EndTransform, (void *)NULL);
@@ -2417,9 +2385,7 @@ ParseFinishLine()
*---------------------------------------------------------------------
*/
void
-Parse_File(name, stream)
- char *name; /* the name of the file being read */
- FILE * stream; /* Stream open to makefile to parse */
+Parse_File(char *name, FILE *stream)
{
char *cp, /* pointer into the line */
*line; /* the line we're working on */
@@ -2602,7 +2568,7 @@ Parse_File(name, stream)
*---------------------------------------------------------------------
*/
void
-Parse_Init ()
+Parse_Init (void)
{
mainNode = NULL;
parseIncPath = Lst_Init (FALSE);
@@ -2612,7 +2578,7 @@ Parse_Init ()
}
void
-Parse_End()
+Parse_End (void)
{
Lst_Destroy(targCmds, (void (*)(void *)) free);
if (targets)
@@ -2638,7 +2604,7 @@ Parse_End()
*-----------------------------------------------------------------------
*/
Lst
-Parse_MainName()
+Parse_MainName(void)
{
Lst listmain; /* result list */
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index 8ff10df..af5a239 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -52,7 +52,7 @@ static int argmax, curlen;
*
*/
void
-str_init()
+str_init(void)
{
char *p1;
argv = (char **)emalloc(((argmax = 50) + 1) * sizeof(char *));
@@ -66,7 +66,7 @@ str_init()
*
*/
void
-str_end()
+str_end(void)
{
if (argv) {
if (argv[0])
@@ -86,9 +86,7 @@ str_end()
* the resulting string in allocated space.
*/
char *
-str_concat(s1, s2, flags)
- char *s1, *s2;
- int flags;
+str_concat(char *s1, char *s2, int flags)
{
int len1, len2;
char *result;
@@ -134,10 +132,7 @@ str_concat(s1, s2, flags)
* the first word is always the value of the .MAKE variable.
*/
char **
-brk_string(str, store_argc, expand)
- char *str;
- int *store_argc;
- Boolean expand;
+brk_string(char *str, int *store_argc, Boolean expand)
{
int argc, ch;
char inquote, *p, *start, *t;
@@ -266,11 +261,11 @@ done: argv[argc] = (char *)NULL;
* character-for-character basis with no wildcards or special characters.
*
* Side effects: None.
+ *
+ * XXX should be strstr(3).
*/
char *
-Str_FindSubstring(string, substring)
- char *string; /* String to search. */
- char *substring; /* Substring to find in string */
+Str_FindSubstring(char *string, char *substring)
{
char *a, *b;
@@ -307,9 +302,7 @@ Str_FindSubstring(string, substring)
* Side effects: None.
*/
int
-Str_Match(string, pattern)
- char *string; /* String */
- char *pattern; /* Pattern */
+Str_Match(char *string, char *pattern)
{
char c2;
@@ -412,10 +405,7 @@ thisCharOK: ++pattern;
*-----------------------------------------------------------------------
*/
char *
-Str_SYSVMatch(word, pattern, len)
- char *word; /* Word to examine */
- char *pattern; /* Pattern to examine against */
- int *len; /* Number of characters to substitute */
+Str_SYSVMatch(char *word, char *pattern, int *len)
{
char *p = pattern;
char *w = word;
@@ -478,11 +468,7 @@ Str_SYSVMatch(word, pattern, len)
*-----------------------------------------------------------------------
*/
void
-Str_SYSVSubst(buf, pat, src, len)
- Buffer buf;
- char *pat;
- char *src;
- int len;
+Str_SYSVSubst(Buffer buf, char *pat, char *src, int len)
{
char *m;
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 7cc1bbf..688f320 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -192,9 +192,7 @@ static int SuffPrintTrans(void *, void *);
*-----------------------------------------------------------------------
*/
static char *
-SuffStrIsPrefix (pref, str)
- char *pref; /* possible prefix */
- char *str; /* string to check */
+SuffStrIsPrefix (char *pref, char *str)
{
while (*str && *pref == *str) {
pref++;
@@ -219,9 +217,7 @@ SuffStrIsPrefix (pref, str)
*-----------------------------------------------------------------------
*/
static char *
-SuffSuffIsSuffix (s, str)
- Suff *s; /* possible suffix */
- char *str; /* string to examine */
+SuffSuffIsSuffix (Suff *s, char *str)
{
char *p1; /* Pointer into suffix name */
char *p2; /* Pointer into string being examined */
@@ -252,9 +248,7 @@ SuffSuffIsSuffix (s, str)
*-----------------------------------------------------------------------
*/
static int
-SuffSuffIsSuffixP(s, str)
- void * s;
- void * str;
+SuffSuffIsSuffixP(void *s, void *str)
{
return(!SuffSuffIsSuffix((Suff *) s, (char *) str));
}
@@ -273,9 +267,7 @@ SuffSuffIsSuffixP(s, str)
*-----------------------------------------------------------------------
*/
static int
-SuffSuffHasNameP (s, sname)
- void * s; /* Suffix to check */
- void * sname; /* Desired name */
+SuffSuffHasNameP (void *s, void *sname)
{
return (strcmp ((char *) sname, ((Suff *) s)->name));
}
@@ -296,9 +288,7 @@ SuffSuffHasNameP (s, sname)
*-----------------------------------------------------------------------
*/
static int
-SuffSuffIsPrefix (s, str)
- void * s; /* suffix to compare */
- void * str; /* string to examine */
+SuffSuffIsPrefix (void *s, void *str)
{
return (SuffStrIsPrefix (((Suff *) s)->name, (char *) str) == NULL ? 1 : 0);
}
@@ -316,9 +306,7 @@ SuffSuffIsPrefix (s, str)
*-----------------------------------------------------------------------
*/
static int
-SuffGNHasNameP (gn, name)
- void * gn; /* current node we're looking at */
- void * name; /* name we're looking for */
+SuffGNHasNameP (void *gn, void *name)
{
return (strcmp ((char *) name, ((GNode *) gn)->name));
}
@@ -338,8 +326,7 @@ SuffGNHasNameP (gn, name)
*-----------------------------------------------------------------------
*/
static void
-SuffFree (sp)
- void * sp;
+SuffFree (void *sp)
{
Suff *s = (Suff *) sp;
@@ -371,9 +358,7 @@ SuffFree (sp)
*-----------------------------------------------------------------------
*/
static void
-SuffRemove(l, s)
- Lst l;
- Suff *s;
+SuffRemove(Lst l, Suff *s)
{
LstNode ln = Lst_Member(l, (void *)s);
if (ln != NULL) {
@@ -396,9 +381,7 @@ SuffRemove(l, s)
*-----------------------------------------------------------------------
*/
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 */
@@ -451,7 +434,7 @@ SuffInsert (l, s)
*-----------------------------------------------------------------------
*/
void
-Suff_ClearSuffixes ()
+Suff_ClearSuffixes (void)
{
Lst_Concat (suffClean, sufflist, LST_CONCLINK);
sufflist = Lst_Init(FALSE);
@@ -481,10 +464,7 @@ Suff_ClearSuffixes ()
*-----------------------------------------------------------------------
*/
static Boolean
-SuffParseTransform(str, srcPtr, targPtr)
- char *str; /* String being parsed */
- Suff **srcPtr; /* Place to store source of trans. */
- Suff **targPtr; /* Place to store target of trans. */
+SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
{
LstNode srcLn; /* element in suffix list of trans source*/
Suff *src; /* Source of transformation */
@@ -562,8 +542,7 @@ SuffParseTransform(str, srcPtr, targPtr)
*-----------------------------------------------------------------------
*/
Boolean
-Suff_IsTransform (str)
- char *str; /* string to check */
+Suff_IsTransform (char *str)
{
Suff *src, *targ;
@@ -585,8 +564,7 @@ Suff_IsTransform (str)
*-----------------------------------------------------------------------
*/
GNode *
-Suff_AddTransform (line)
- char *line; /* name of transformation to add */
+Suff_AddTransform (char *line)
{
GNode *gn; /* GNode of transformation rule */
Suff *s, /* source suffix */
@@ -648,9 +626,7 @@ Suff_AddTransform (line)
*-----------------------------------------------------------------------
*/
int
-Suff_EndTransform(gnp, dummy)
- void * gnp; /* Node for transformation */
- void * dummy; /* Node for transformation */
+Suff_EndTransform(void *gnp, void *dummy __unused)
{
GNode *gn = (GNode *) gnp;
@@ -682,7 +658,7 @@ Suff_EndTransform(gnp, dummy)
DEBUGF(SUFF, ("transformation %s complete\n", gn->name));
}
- return(dummy ? 0 : 0);
+ return (0);
}
/*-
@@ -705,9 +681,7 @@ Suff_EndTransform(gnp, dummy)
*-----------------------------------------------------------------------
*/
static int
-SuffRebuildGraph(transformp, sp)
- void * transformp; /* Transformation to test */
- void * sp; /* Suffix to rebuild */
+SuffRebuildGraph(void *transformp, void *sp)
{
GNode *transform = (GNode *) transformp;
Suff *s = (Suff *) sp;
@@ -779,8 +753,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;
@@ -822,8 +795,7 @@ Suff_AddSuffix (str)
*-----------------------------------------------------------------------
*/
Lst
-Suff_GetPath (sname)
- char *sname;
+Suff_GetPath (char *sname)
{
LstNode ln;
Suff *s;
@@ -856,7 +828,7 @@ Suff_GetPath (sname)
*-----------------------------------------------------------------------
*/
void
-Suff_DoPaths()
+Suff_DoPaths(void)
{
Suff *s;
LstNode ln;
@@ -918,8 +890,7 @@ Suff_DoPaths()
*-----------------------------------------------------------------------
*/
void
-Suff_AddInclude (sname)
- char *sname; /* Name of suffix to mark */
+Suff_AddInclude (char *sname)
{
LstNode ln;
Suff *s;
@@ -948,8 +919,7 @@ Suff_AddInclude (sname)
*-----------------------------------------------------------------------
*/
void
-Suff_AddLib (sname)
- char *sname; /* Name of suffix to mark */
+Suff_AddLib (char *sname)
{
LstNode ln;
Suff *s;
@@ -978,9 +948,7 @@ Suff_AddLib (sname)
*-----------------------------------------------------------------------
*/
static int
-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, void *lsp)
{
Suff *s = (Suff *) sp;
LstSrc *ls = (LstSrc *) lsp;
@@ -1047,9 +1015,7 @@ 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, Src *targ)
{
LstSrc ls;
@@ -1072,8 +1038,7 @@ SuffAddLevel (l, targ)
*----------------------------------------------------------------------
*/
static int
-SuffRemoveSrc (l)
- Lst l;
+SuffRemoveSrc (Lst l)
{
LstNode ln;
Src *s;
@@ -1140,9 +1105,7 @@ SuffRemoveSrc (l)
*-----------------------------------------------------------------------
*/
static Src *
-SuffFindThem (srcs, slst)
- Lst srcs; /* list of Src structures to search through */
- Lst slst;
+SuffFindThem (Lst srcs, Lst slst)
{
Src *s; /* current Src */
Src *rs; /* returned Src */
@@ -1204,9 +1167,7 @@ SuffFindThem (srcs, slst)
*-----------------------------------------------------------------------
*/
static Src *
-SuffFindCmds (targ, slst)
- Src *targ; /* Src structure to play with */
- Lst slst;
+SuffFindCmds (Src *targ, Lst slst)
{
LstNode ln; /* General-purpose list node */
GNode *t, /* Target GNode */
@@ -1296,9 +1257,7 @@ SuffFindCmds (targ, slst)
*-----------------------------------------------------------------------
*/
static int
-SuffExpandChildren(cgnp, pgnp)
- void * cgnp; /* Child to examine */
- void * pgnp; /* Parent node being processed */
+SuffExpandChildren(void *cgnp, void *pgnp)
{
GNode *cgn = (GNode *) cgnp;
GNode *pgn = (GNode *) pgnp;
@@ -1524,11 +1483,7 @@ SuffExpandChildren(cgnp, pgnp)
*-----------------------------------------------------------------------
*/
static Boolean
-SuffApplyTransform(tGn, sGn, t, s)
- GNode *tGn; /* Target node */
- GNode *sGn; /* Source node */
- Suff *t; /* Target suffix */
- Suff *s; /* Source suffix */
+SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
{
LstNode ln; /* General node */
char *tname; /* Name of transformation rule */
@@ -1628,9 +1583,7 @@ SuffApplyTransform(tGn, sGn, t, s)
*-----------------------------------------------------------------------
*/
static void
-SuffFindArchiveDeps(gn, slst)
- GNode *gn; /* Node for which to locate dependencies */
- Lst slst;
+SuffFindArchiveDeps(GNode *gn, Lst slst)
{
char *eoarch; /* End of archive portion */
char *eoname; /* End of member portion */
@@ -1761,9 +1714,7 @@ SuffFindArchiveDeps(gn, slst)
*-----------------------------------------------------------------------
*/
static void
-SuffFindNormalDeps(gn, slst)
- GNode *gn; /* Node for which to find sources */
- Lst slst;
+SuffFindNormalDeps(GNode *gn, Lst slst)
{
char *eoname; /* End of name */
char *sopref; /* Start of prefix */
@@ -2153,8 +2104,7 @@ sfnd_return:
*/
void
-Suff_FindDeps(gn)
- GNode *gn;
+Suff_FindDeps(GNode *gn)
{
SuffFindDeps(gn, srclist);
@@ -2164,9 +2114,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) {
/*
@@ -2233,8 +2181,7 @@ SuffFindDeps (gn, slst)
*-----------------------------------------------------------------------
*/
void
-Suff_SetNull(name)
- char *name; /* Name of null suffix */
+Suff_SetNull(char *name)
{
Suff *s;
LstNode ln;
@@ -2269,7 +2216,7 @@ Suff_SetNull(name)
*-----------------------------------------------------------------------
*/
void
-Suff_Init ()
+Suff_Init (void)
{
sufflist = Lst_Init (FALSE);
suffClean = Lst_Init(FALSE);
@@ -2312,7 +2259,7 @@ Suff_Init ()
*/
void
-Suff_End()
+Suff_End(void)
{
Lst_Destroy(sufflist, SuffFree);
Lst_Destroy(suffClean, SuffFree);
@@ -2325,18 +2272,15 @@ Suff_End()
/********************* DEBUGGING FUNCTIONS **********************/
-static int SuffPrintName(s, dummy)
- void * s;
- void * dummy;
+static int
+SuffPrintName(void *s, void *dummy __unused)
{
printf ("`%s' ", ((Suff *) s)->name);
- return (dummy ? 0 : 0);
+ return (0);
}
static int
-SuffPrintSuff (sp, dummy)
- void * sp;
- void * dummy;
+SuffPrintSuff (void *sp, void *dummy __unused)
{
Suff *s = (Suff *) sp;
int flags;
@@ -2376,13 +2320,11 @@ SuffPrintSuff (sp, dummy)
printf ("#\tSearch Path: ");
Dir_PrintPath (s->searchPath);
fputc ('\n', stdout);
- return (dummy ? 0 : 0);
+ return (0);
}
static int
-SuffPrintTrans (tp, dummy)
- void * tp;
- void * dummy;
+SuffPrintTrans (void *tp, void *dummy __unused)
{
GNode *t = (GNode *) tp;
@@ -2391,11 +2333,11 @@ SuffPrintTrans (tp, dummy)
fputc ('\n', stdout);
Lst_ForEach (t->commands, Targ_PrintCmd, (void *)0);
fputc ('\n', stdout);
- return(dummy ? 0 : 0);
+ return (0);
}
void
-Suff_PrintAll()
+Suff_PrintAll(void)
{
printf ("#*** Suffixes:\n");
Lst_ForEach (sufflist, SuffPrintSuff, (void *)0);
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c
index 851b7a9..2d0f1c3 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -112,7 +112,7 @@ static void TargFreeGN(void *);
*-----------------------------------------------------------------------
*/
void
-Targ_Init ()
+Targ_Init (void)
{
allTargets = Lst_Init (FALSE);
Hash_InitTable (&targets, HTSIZE);
@@ -131,7 +131,7 @@ Targ_Init ()
*-----------------------------------------------------------------------
*/
void
-Targ_End ()
+Targ_End (void)
{
Lst_Destroy(allTargets, NOFREE);
if (allGNs)
@@ -153,8 +153,7 @@ Targ_End ()
*-----------------------------------------------------------------------
*/
GNode *
-Targ_NewGN (name)
- char *name; /* the name to stick in the new node */
+Targ_NewGN (char *name)
{
GNode *gn;
@@ -202,8 +201,7 @@ Targ_NewGN (name)
*-----------------------------------------------------------------------
*/
static void
-TargFreeGN (gnp)
- void * gnp;
+TargFreeGN (void *gnp)
{
GNode *gn = (GNode *) gnp;
@@ -238,10 +236,7 @@ TargFreeGN (gnp)
*-----------------------------------------------------------------------
*/
GNode *
-Targ_FindNode (name, flags)
- char *name; /* the name to find */
- int flags; /* flags governing events when target not
- * found */
+Targ_FindNode (char *name, int flags)
{
GNode *gn; /* node in that element */
Hash_Entry *he; /* New or used hash entry for node */
@@ -283,10 +278,7 @@ Targ_FindNode (name, flags)
* -----------------------------------------------------------------------
*/
Lst
-Targ_FindList (names, flags)
- Lst names; /* list of names to find */
- int flags; /* flags used if no node is found for a given
- * name */
+Targ_FindList (Lst names, int flags)
{
Lst nodes; /* result list */
LstNode ln; /* name list element */
@@ -332,8 +324,7 @@ Targ_FindList (names, flags)
*-----------------------------------------------------------------------
*/
Boolean
-Targ_Ignore (gn)
- GNode *gn; /* node to check for */
+Targ_Ignore (GNode *gn)
{
if (ignoreErrors || gn->type & OP_IGNORE) {
return (TRUE);
@@ -355,8 +346,7 @@ Targ_Ignore (gn)
*-----------------------------------------------------------------------
*/
Boolean
-Targ_Silent (gn)
- GNode *gn; /* node to check for */
+Targ_Silent (GNode *gn)
{
if (beSilent || gn->type & OP_SILENT) {
return (TRUE);
@@ -378,8 +368,7 @@ Targ_Silent (gn)
*-----------------------------------------------------------------------
*/
Boolean
-Targ_Precious (gn)
- GNode *gn; /* the node to check */
+Targ_Precious (GNode *gn)
{
if (allPrecious || (gn->type & (OP_PRECIOUS|OP_DOUBLEDEP))) {
return (TRUE);
@@ -405,16 +394,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 int
-TargPrintName (gnp, ppath)
- void * gnp;
- void * ppath;
+TargPrintName (void *gnp, void *ppath)
{
GNode *gn = (GNode *) gnp;
printf ("%s ", gn->name);
@@ -433,12 +419,10 @@ TargPrintName (gnp, ppath)
int
-Targ_PrintCmd (cmd, dummy)
- void * cmd;
- void * dummy;
+Targ_PrintCmd (void *cmd, void *dummy __unused)
{
printf ("\t%s\n", (char *) cmd);
- return (dummy ? 0 : 0);
+ return (0);
}
/*-
@@ -456,8 +440,7 @@ Targ_PrintCmd (cmd, dummy)
*-----------------------------------------------------------------------
*/
char *
-Targ_FmtTime (modtime)
- time_t modtime;
+Targ_FmtTime (time_t modtime)
{
struct tm *parts;
static char buf[128];
@@ -482,8 +465,7 @@ Targ_FmtTime (modtime)
*-----------------------------------------------------------------------
*/
void
-Targ_PrintType (type)
- int type;
+Targ_PrintType (int type)
{
int tbit;
@@ -522,9 +504,7 @@ Targ_PrintType (type)
*-----------------------------------------------------------------------
*/
static int
-TargPrintNode (gnp, passp)
- void * gnp;
- void * passp;
+TargPrintNode (void *gnp, void *passp)
{
GNode *gn = (GNode *) gnp;
int pass = *(int *) passp;
@@ -606,21 +586,19 @@ TargPrintNode (gnp, passp)
*-----------------------------------------------------------------------
*/
static int
-TargPrintOnlySrc(gnp, dummy)
- void * gnp;
- void * dummy;
+TargPrintOnlySrc(void *gnp, void *dummy __unused)
{
GNode *gn = (GNode *) gnp;
if (OP_NOP(gn->type))
printf("#\t%s [%s]\n", gn->name, gn->path ? gn->path : gn->name);
- return (dummy ? 0 : 0);
+ return (0);
}
/*-
*-----------------------------------------------------------------------
* Targ_PrintGraph --
- * print the entire graph. heh heh
+ * Print the entire graph.
*
* Results:
* none
@@ -630,9 +608,7 @@ TargPrintOnlySrc(gnp, dummy)
*-----------------------------------------------------------------------
*/
void
-Targ_PrintGraph (pass)
- int pass; /* Which pass this is. 1 => no processing
- * 2 => processing done */
+Targ_PrintGraph (int pass)
{
printf("#*** Input graph:\n");
Lst_ForEach (allTargets, TargPrintNode, (void *)&pass);
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 3587a70..3bd17ca 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -204,9 +204,7 @@ static int VarPrintVar(void *, void *);
*-----------------------------------------------------------------------
*/
static int
-VarCmp (v, name)
- void * v; /* VAR structure to compare */
- void * name; /* name to look for */
+VarCmp (void *v, void *name)
{
return (strcmp ((char *) name, ((Var *) v)->name));
}
@@ -224,9 +222,7 @@ VarCmp (v, name)
*-----------------------------------------------------------------------
*/
static void
-VarPossiblyExpand(name, ctxt)
- char **name;
- GNode *ctxt;
+VarPossiblyExpand(char **name, GNode *ctxt)
{
if (strchr(*name, '$') != NULL)
*name = Var_Subst(NULL, *name, ctxt, 0);
@@ -240,6 +236,11 @@ VarPossiblyExpand(name, ctxt)
* Find the given variable in the given context and any other contexts
* indicated.
*
+ * Flags:
+ * FIND_GLOBAL set means look in the VAR_GLOBAL context too
+ * FIND_CMD set means to look in the VAR_CMD context too
+ * FIND_ENV set means to look in the environment
+ *
* Results:
* A pointer to the structure describing the desired variable or
* NULL if the variable does not exist.
@@ -249,15 +250,7 @@ VarPossiblyExpand(name, ctxt)
*-----------------------------------------------------------------------
*/
static Var *
-VarFind (name, ctxt, flags)
- char *name; /* name to find */
- GNode *ctxt; /* context in which to find it */
- int flags; /* FIND_GLOBAL set means to look in the
- * VAR_GLOBAL context as well.
- * FIND_CMD set means to look in the VAR_CMD
- * context also.
- * FIND_ENV set means to look in the
- * environment */
+VarFind (char *name, GNode *ctxt, int flags)
{
Boolean localCheckEnvFirst;
LstNode var;
@@ -364,7 +357,7 @@ VarFind (name, ctxt, flags)
/*-
*-----------------------------------------------------------------------
* VarAdd --
- * Add a new variable of name name and value val to the given context
+ * Add a new variable of name name and value val to the given context.
*
* Results:
* None
@@ -376,10 +369,7 @@ VarFind (name, ctxt, flags)
*-----------------------------------------------------------------------
*/
static void
-VarAdd (name, val, ctxt)
- char *name; /* name of variable to add */
- char *val; /* value to set it to */
- GNode *ctxt; /* context in which to set it */
+VarAdd (char *name, char *val, GNode *ctxt)
{
Var *v;
int len;
@@ -413,8 +403,7 @@ VarAdd (name, val, ctxt)
*-----------------------------------------------------------------------
*/
static void
-VarDelete(vp)
- void * vp;
+VarDelete(void *vp)
{
Var *v = (Var *) vp;
free(v->name);
@@ -438,9 +427,7 @@ VarDelete(vp)
*-----------------------------------------------------------------------
*/
void
-Var_Delete(name, ctxt)
- char *name;
- GNode *ctxt;
+Var_Delete(char *name, GNode *ctxt)
{
LstNode ln;
@@ -479,10 +466,7 @@ Var_Delete(name, ctxt)
*-----------------------------------------------------------------------
*/
void
-Var_Set (name, val, ctxt)
- char *name; /* name of variable to set */
- char *val; /* value to give to the variable */
- GNode *ctxt; /* context in which to set it */
+Var_Set (char *name, char *val, GNode *ctxt)
{
Var *v;
@@ -534,10 +518,7 @@ Var_Set (name, val, ctxt)
*-----------------------------------------------------------------------
*/
void
-Var_Append (name, val, ctxt)
- char *name; /* Name of variable to modify */
- char *val; /* String to append to it */
- GNode *ctxt; /* Context in which this should occur */
+Var_Append (char *name, char *val, GNode *ctxt)
{
Var *v;
@@ -581,9 +562,7 @@ Var_Append (name, val, ctxt)
*-----------------------------------------------------------------------
*/
Boolean
-Var_Exists(name, ctxt)
- char *name; /* Variable to find */
- GNode *ctxt; /* Context in which to start search */
+Var_Exists(char *name, GNode *ctxt)
{
Var *v;
@@ -614,10 +593,7 @@ Var_Exists(name, ctxt)
*-----------------------------------------------------------------------
*/
char *
-Var_Value (name, ctxt, frp)
- char *name; /* name to find */
- GNode *ctxt; /* context in which to search for it */
- char **frp;
+Var_Value (char *name, GNode *ctxt, char **frp)
{
Var *v;
@@ -654,12 +630,7 @@ Var_Value (name, ctxt, frp)
*-----------------------------------------------------------------------
*/
static Boolean
-VarHead (word, addSpace, buf, dummy)
- char *word; /* Word to trim */
- Boolean addSpace; /* True if need to add a space to the buffer
- * before sticking in the head */
- Buffer buf; /* Buffer in which to store it */
- void * dummy;
+VarHead (char *word, Boolean addSpace, Buffer buf, void *dummy __unused)
{
char *slash;
@@ -682,7 +653,7 @@ VarHead (word, addSpace, buf, dummy)
Buf_AddByte(buf, (Byte)'.');
}
}
- return(dummy ? TRUE : TRUE);
+ return (TRUE);
}
/*-
@@ -701,12 +672,7 @@ VarHead (word, addSpace, buf, dummy)
*-----------------------------------------------------------------------
*/
static Boolean
-VarTail (word, addSpace, buf, dummy)
- char *word; /* Word to trim */
- Boolean addSpace; /* TRUE if need to stick a space in the
- * buffer before adding the tail */
- Buffer buf; /* Buffer in which to store it */
- void * dummy;
+VarTail (char *word, Boolean addSpace, Buffer buf, void *dummy __unused)
{
char *slash;
@@ -722,7 +688,7 @@ VarTail (word, addSpace, buf, dummy)
} else {
Buf_AddBytes (buf, strlen(word), (Byte *)word);
}
- return (dummy ? TRUE : TRUE);
+ return (TRUE);
}
/*-
@@ -740,12 +706,7 @@ VarTail (word, addSpace, buf, dummy)
*-----------------------------------------------------------------------
*/
static Boolean
-VarSuffix (word, addSpace, buf, dummy)
- char *word; /* Word to trim */
- Boolean addSpace; /* TRUE if need to add a space before placing
- * the suffix in the buffer */
- Buffer buf; /* Buffer in which to store it */
- void * dummy;
+VarSuffix (char *word, Boolean addSpace, Buffer buf, void *dummy __unused)
{
char *dot;
@@ -759,7 +720,7 @@ VarSuffix (word, addSpace, buf, dummy)
dot[-1] = '.';
addSpace = TRUE;
}
- return (dummy ? addSpace : addSpace);
+ return (addSpace);
}
/*-
@@ -778,12 +739,7 @@ VarSuffix (word, addSpace, buf, dummy)
*-----------------------------------------------------------------------
*/
static Boolean
-VarRoot (word, addSpace, buf, dummy)
- char *word; /* Word to trim */
- Boolean addSpace; /* TRUE if need to add a space to the buffer
- * before placing the root in it */
- Buffer buf; /* Buffer in which to store it */
- void * dummy;
+VarRoot (char *word, Boolean addSpace, Buffer buf, void *dummy __unused)
{
char *dot;
@@ -799,7 +755,7 @@ VarRoot (word, addSpace, buf, dummy)
} else {
Buf_AddBytes (buf, strlen(word), (Byte *)word);
}
- return (dummy ? TRUE : TRUE);
+ return (TRUE);
}
/*-
@@ -807,6 +763,8 @@ VarRoot (word, addSpace, buf, dummy)
* VarMatch --
* Place the word in the buffer if it matches the given pattern.
* Callback function for VarModify to implement the :M modifier.
+ * A space will be added if requested. A pattern is supplied
+ * which the word must match.
*
* Results:
* TRUE if a space should be placed in the buffer before the next
@@ -818,13 +776,7 @@ VarRoot (word, addSpace, buf, dummy)
*-----------------------------------------------------------------------
*/
static Boolean
-VarMatch (word, addSpace, buf, pattern)
- char *word; /* Word to examine */
- Boolean addSpace; /* TRUE if need to add a space to the
- * buffer before adding the word, if it
- * matches */
- Buffer buf; /* Buffer in which to store it */
- void * pattern; /* Pattern the word must match */
+VarMatch (char *word, Boolean addSpace, Buffer buf, void *pattern)
{
if (Str_Match(word, (char *) pattern)) {
if (addSpace) {
@@ -842,7 +794,7 @@ VarMatch (word, addSpace, buf, pattern)
* VarSYSVMatch --
* Place the word in the buffer if it matches the given pattern.
* Callback function for VarModify to implement the System V %
- * modifiers.
+ * modifiers. A space is added if requested.
*
* Results:
* TRUE if a space should be placed in the buffer before the next
@@ -854,13 +806,7 @@ VarMatch (word, addSpace, buf, pattern)
*-----------------------------------------------------------------------
*/
static Boolean
-VarSYSVMatch (word, addSpace, buf, patp)
- char *word; /* Word to examine */
- Boolean addSpace; /* TRUE if need to add a space to the
- * buffer before adding the word, if it
- * matches */
- Buffer buf; /* Buffer in which to store it */
- void * patp; /* Pattern the word must match */
+VarSYSVMatch (char *word, Boolean addSpace, Buffer buf, void *patp)
{
int len;
char *ptr;
@@ -885,7 +831,8 @@ VarSYSVMatch (word, addSpace, buf, patp)
*-----------------------------------------------------------------------
* VarNoMatch --
* Place the word in the buffer if it doesn't match the given pattern.
- * Callback function for VarModify to implement the :N modifier.
+ * Callback function for VarModify to implement the :N modifier. A
+ * space is added if requested.
*
* Results:
* TRUE if a space should be placed in the buffer before the next
@@ -897,13 +844,7 @@ VarSYSVMatch (word, addSpace, buf, patp)
*-----------------------------------------------------------------------
*/
static Boolean
-VarNoMatch (word, addSpace, buf, pattern)
- char *word; /* Word to examine */
- Boolean addSpace; /* TRUE if need to add a space to the
- * buffer before adding the word, if it
- * matches */
- Buffer buf; /* Buffer in which to store it */
- void * pattern; /* Pattern the word must match */
+VarNoMatch (char *word, Boolean addSpace, Buffer buf, void *pattern)
{
if (!Str_Match(word, (char *) pattern)) {
if (addSpace) {
@@ -920,7 +861,7 @@ VarNoMatch (word, addSpace, buf, pattern)
*-----------------------------------------------------------------------
* VarSubstitute --
* Perform a string-substitution on the given word, placing the
- * result in the passed buffer.
+ * result in the passed buffer. A space is added if requested.
*
* Results:
* TRUE if a space is needed before more characters are added.
@@ -931,12 +872,7 @@ VarNoMatch (word, addSpace, buf, pattern)
*-----------------------------------------------------------------------
*/
static Boolean
-VarSubstitute (word, addSpace, buf, patternp)
- char *word; /* Word to modify */
- Boolean addSpace; /* True if space should be added before
- * other characters */
- Buffer buf; /* Buffer for result */
- void * patternp; /* Pattern for substitution */
+VarSubstitute (char *word, Boolean addSpace, Buffer buf, void *patternp)
{
int wordLen; /* Length of word */
char *cp; /* General pointer */
@@ -1098,10 +1034,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;
@@ -1118,7 +1051,7 @@ VarREError(err, pat, str)
*-----------------------------------------------------------------------
* VarRESubstitute --
* Perform a regex substitution on the given word, placing the
- * result in the passed buffer.
+ * result in the passed buffer. A space is added if requested.
*
* Results:
* TRUE if a space is needed before more characters are added.
@@ -1129,11 +1062,7 @@ VarREError(err, pat, str)
*-----------------------------------------------------------------------
*/
static Boolean
-VarRESubstitute(word, addSpace, buf, patternp)
- char *word;
- Boolean addSpace;
- Buffer buf;
- void * patternp;
+VarRESubstitute(char *word, Boolean addSpace, Buffer buf, void *patternp)
{
VarREPattern *pat;
int xrv;
@@ -1261,11 +1190,8 @@ VarRESubstitute(word, addSpace, buf, patternp)
*-----------------------------------------------------------------------
*/
static char *
-VarModify (str, modProc, datum)
- char *str; /* String whose words should be trimmed */
- /* Function to use to modify them */
- Boolean (*modProc)(char *, Boolean, Buffer, void *);
- void * datum; /* Datum to pass it */
+VarModify (char *str, Boolean (*modProc)(char *, Boolean, Buffer, void *),
+ void *datum)
{
Buffer buf; /* Buffer for the new string */
Boolean addSpace; /* TRUE if need to add a space to the
@@ -1311,14 +1237,8 @@ VarModify (str, modProc, datum)
*-----------------------------------------------------------------------
*/
static char *
-VarGetPattern(ctxt, err, tstr, delim, flags, length, pattern)
- GNode *ctxt;
- int err;
- char **tstr;
- int delim;
- int *flags;
- int *length;
- VarPattern *pattern;
+VarGetPattern(GNode *ctxt, int err, char **tstr, int delim, int *flags,
+ int *length, VarPattern *pattern)
{
char *cp;
Buffer buf = Buf_Init(0);
@@ -1431,8 +1351,7 @@ VarGetPattern(ctxt, err, tstr, delim, flags, length, pattern)
*-----------------------------------------------------------------------
*/
static char *
-VarQuote(str)
- char *str;
+VarQuote(char *str)
{
Buffer buf;
@@ -1472,12 +1391,7 @@ VarQuote(str)
*-----------------------------------------------------------------------
*/
char *
-Var_Parse (str, ctxt, err, lengthPtr, freePtr)
- char *str; /* The string to parse */
- GNode *ctxt; /* The context for the variable */
- Boolean err; /* TRUE if undefined variables are an error */
- int *lengthPtr; /* OUT: The length of the specification */
- Boolean *freePtr; /* OUT: TRUE if caller should free result */
+Var_Parse(char *str, GNode *ctxt, Boolean err, int *lengthPtr, Boolean *freePtr)
{
char *tstr; /* Pointer into str */
Var *v; /* Variable in invocation */
@@ -2327,11 +2241,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
*-----------------------------------------------------------------------
*/
char *
-Var_Subst (var, str, ctxt, undefErr)
- char *var; /* Named variable || NULL for all */
- char *str; /* the string in which to substitute */
- GNode *ctxt; /* the context wherein to find variables */
- Boolean undefErr; /* TRUE if undefineds are an error */
+Var_Subst (char *var, char *str, GNode *ctxt, Boolean undefErr)
{
Buffer buf; /* Buffer for forming things */
char *val; /* Value to substitute for a variable */
@@ -2493,8 +2403,7 @@ Var_Subst (var, str, ctxt, undefErr)
*-----------------------------------------------------------------------
*/
char *
-Var_GetTail(file)
- char *file; /* Filename to modify */
+Var_GetTail(char *file)
{
return(VarModify(file, VarTail, (void *)0));
}
@@ -2515,8 +2424,7 @@ Var_GetTail(file)
*-----------------------------------------------------------------------
*/
char *
-Var_GetHead(file)
- char *file; /* Filename to manipulate */
+Var_GetHead(char *file)
{
return(VarModify(file, VarHead, (void *)0));
}
@@ -2534,7 +2442,7 @@ Var_GetHead(file)
*-----------------------------------------------------------------------
*/
void
-Var_Init ()
+Var_Init (void)
{
VAR_GLOBAL = Targ_NewGN ("Global");
VAR_CMD = Targ_NewGN ("Command");
@@ -2544,7 +2452,7 @@ Var_Init ()
void
-Var_End ()
+Var_End (void)
{
Lst_Destroy(allVars, VarDelete);
}
@@ -2552,13 +2460,11 @@ Var_End ()
/****************** PRINT DEBUGGING INFO *****************/
static int
-VarPrintVar (vp, dummy)
- void * vp;
- void * dummy;
+VarPrintVar (void *vp, void *dummy __unused)
{
Var *v = (Var *) vp;
printf ("%-16s = %s\n", v->name, (char *) Buf_GetAll(v->val, (int *)NULL));
- return (dummy ? 0 : 0);
+ return (0);
}
/*-
@@ -2568,8 +2474,7 @@ VarPrintVar (vp, dummy)
*-----------------------------------------------------------------------
*/
void
-Var_Dump (ctxt)
- GNode *ctxt;
+Var_Dump (GNode *ctxt)
{
Lst_ForEach (ctxt->context, VarPrintVar, (void *) 0);
}
OpenPOWER on IntegriCloud