(fts_open): Use prototypes for COMPAR decl.

This commit is contained in:
Roland McGrath 1996-01-24 03:02:14 +00:00
parent 6d5cbf7b35
commit 8ebd0a71be

View File

@ -90,7 +90,7 @@ FTS *
fts_open(argv, options, compar) fts_open(argv, options, compar)
char * const *argv; char * const *argv;
register int options; register int options;
int (*compar)(); int (*compar) __P((const FTSENT **, const FTSENT **));
{ {
register FTS *sp; register FTS *sp;
register FTSENT *p, *root; register FTSENT *p, *root;
@ -108,7 +108,7 @@ fts_open(argv, options, compar)
if ((sp = malloc((u_int)sizeof(FTS))) == NULL) if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
return (NULL); return (NULL);
bzero(sp, sizeof(FTS)); bzero(sp, sizeof(FTS));
sp->fts_compar = compar; sp->fts_compar = (int (*) __P((const void *, const void *))) compar;
sp->fts_options = options; sp->fts_options = options;
/* Logical walks turn on NOCHDIR; symbolic links are too hard. */ /* Logical walks turn on NOCHDIR; symbolic links are too hard. */
@ -333,7 +333,7 @@ fts_read(sp)
} }
p->fts_info = FTS_DP; p->fts_info = FTS_DP;
return (p); return (p);
} }
/* Rebuild if only read the names and now traversing. */ /* Rebuild if only read the names and now traversing. */
if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) { if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) {
@ -528,7 +528,7 @@ fts_children(sp, instr)
if (instr == FTS_NAMEONLY) { if (instr == FTS_NAMEONLY) {
sp->fts_options |= FTS_NAMEONLY; sp->fts_options |= FTS_NAMEONLY;
instr = BNAMES; instr = BNAMES;
} else } else
instr = BCHILD; instr = BCHILD;
/* /*
@ -700,7 +700,7 @@ mem1: saved_errno = errno;
p->fts_accpath = cur->fts_accpath; p->fts_accpath = cur->fts_accpath;
} else if (nlinks == 0 } else if (nlinks == 0
#ifdef DT_DIR #ifdef DT_DIR
|| nlinks > 0 && || nlinks > 0 &&
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
#endif #endif
) { ) {
@ -790,7 +790,7 @@ fts_stat(sp, p, follow)
/* If user needs stat info, stat buffer already allocated. */ /* If user needs stat info, stat buffer already allocated. */
sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp; sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
/* /*
* If doing a logical walk, or application requested FTS_FOLLOW, do * If doing a logical walk, or application requested FTS_FOLLOW, do
* a stat(2). If that fails, check for a non-existent symlink. If * a stat(2). If that fails, check for a non-existent symlink. If
@ -802,7 +802,7 @@ fts_stat(sp, p, follow)
if (!lstat(p->fts_accpath, sbp)) { if (!lstat(p->fts_accpath, sbp)) {
errno = 0; errno = 0;
return (FTS_SLNONE); return (FTS_SLNONE);
} }
p->fts_errno = saved_errno; p->fts_errno = saved_errno;
goto err; goto err;
} }
@ -935,7 +935,7 @@ fts_lfree(head)
* Allow essentially unlimited paths; find, rm, ls should all work on any tree. * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
* Most systems will allow creation of paths much longer than MAXPATHLEN, even * Most systems will allow creation of paths much longer than MAXPATHLEN, even
* though the kernel won't resolve them. Add the size (not just what's needed) * though the kernel won't resolve them. Add the size (not just what's needed)
* plus 256 bytes so don't realloc the path 2 bytes at a time. * plus 256 bytes so don't realloc the path 2 bytes at a time.
*/ */
static int static int
fts_palloc(sp, more) fts_palloc(sp, more)