minor fixes

This commit is contained in:
cgd 1994-04-12 03:21:35 +00:00
parent 656b05ccf6
commit 92bb6b9feb
2 changed files with 17 additions and 25 deletions

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1989, 1991, 1993
.\" Copyright (c) 1989, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -29,10 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)fts.3 8.1 (Berkeley) 6/4/93
.\" $Id: fts.3,v 1.8 1993/11/29 21:41:00 jtc Exp $
.\" from: @(#)fts.3 8.4 (Berkeley) 4/7/94
.\" $Id: fts.3,v 1.9 1994/04/12 03:21:35 cgd Exp $
.\"
.Dd June 4, 1993
.Dd April 7, 1994
.Dt FTS 3
.Os
.Sh NAME
@ -110,7 +110,7 @@ typedef struct _ftsent {
char *fts_name; /* file name */
short fts_namelen; /* strlen(fts_name) */
short fts_level; /* depth (\-1 to N) */
int fts_error; /* file errno */
int fts_errno; /* file errno */
long fts_number; /* local numeric value */
void *fts_pointer; /* local address value */
struct ftsent *fts_parent; /* parent directory */
@ -744,6 +744,6 @@ The options were invalid.
.Sh STANDARDS
The
.Nm fts
functions are expected to be a superset of those provided by a future
.St -p1003.1
specification.
utility is expected to be included in a future
.St -p1003.1-88
revision.

View File

@ -32,8 +32,8 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)fts.c 8.1 (Berkeley) 6/4/93";*/
static char *rcsid = "$Id: fts.c,v 1.5 1994/01/14 01:53:57 jtc Exp $";
/* from: static char sccsid[] = "@(#)fts.c 8.2 (Berkeley) 1/2/94"; */
static char *rcsid = "$Id: fts.c,v 1.6 1994/04/12 03:21:39 cgd Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@ -194,7 +194,7 @@ fts_load(sp, p)
*/
len = p->fts_pathlen = p->fts_namelen;
bcopy(p->fts_name, sp->fts_path, len + 1);
if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
if ((cp = rindex(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
len = strlen(++cp);
bcopy(cp, p->fts_name, len + 1);
p->fts_namelen = len;
@ -737,19 +737,10 @@ mem1: saved_errno = errno;
* fts_read and didn't find anything, get back. If can't get
* back, done.
*/
if (descend && (!nitems || type == BCHILD)) {
int error;
if (cur->fts_level == FTS_ROOTLEVEL)
error = FCHDIR(sp, sp->fts_rfd);
else
error = CHDIR(sp, "..");
if (error) {
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
return (NULL);
}
if (descend && (!nitems || type == BCHILD) && CHDIR(sp, "..")) {
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
return (NULL);
}
/* If didn't find anything, return NULL. */
@ -948,7 +939,8 @@ fts_padjust(sp, addr)
FTSENT *p;
#define ADJUST(p) { \
(p)->fts_accpath = addr + ((p)->fts_accpath - (p)->fts_path); \
(p)->fts_accpath = \
(char *)addr + ((p)->fts_accpath - (p)->fts_path); \
(p)->fts_path = addr; \
}
/* Adjust the current set of children. */