fix .Nm usage, deprecate register, mostly WARNSify (needs minor rewrite to fix)
This commit is contained in:
parent
ebf03fd00c
commit
403b699b0b
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: extern.h,v 1.5 1997/01/09 20:19:09 tls Exp $ */
|
/* $NetBSD: extern.h,v 1.6 1997/10/19 11:52:12 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -33,7 +33,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)extern.h 8.1 (Berkeley) 6/6/93
|
* from: @(#)extern.h 8.1 (Berkeley) 6/6/93
|
||||||
* $NetBSD: extern.h,v 1.5 1997/01/09 20:19:09 tls Exp $
|
* $NetBSD: extern.h,v 1.6 1997/10/19 11:52:12 lukem Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
@ -43,6 +43,7 @@ void *emalloc __P((unsigned int));
|
|||||||
PLAN *find_create __P((char ***));
|
PLAN *find_create __P((char ***));
|
||||||
void find_execute __P((PLAN *, char **));
|
void find_execute __P((PLAN *, char **));
|
||||||
PLAN *find_formplan __P((char **));
|
PLAN *find_formplan __P((char **));
|
||||||
|
int f_expr __P((PLAN *, FTSENT *));
|
||||||
PLAN *not_squish __P((PLAN *));
|
PLAN *not_squish __P((PLAN *));
|
||||||
OPTION *option __P((char *));
|
OPTION *option __P((char *));
|
||||||
PLAN *or_squish __P((PLAN *));
|
PLAN *or_squish __P((PLAN *));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: find.1,v 1.11 1997/01/09 20:19:09 tls Exp $
|
.\" $NetBSD: find.1,v 1.12 1997/10/19 11:52:22 lukem Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1990, 1993
|
.\" Copyright (c) 1990, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -35,7 +35,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" from: @(#)find.1 8.1 (Berkeley) 6/6/93
|
.\" from: @(#)find.1 8.1 (Berkeley) 6/6/93
|
||||||
.\" $NetBSD: find.1,v 1.11 1997/01/09 20:19:09 tls Exp $
|
.\" $NetBSD: find.1,v 1.12 1997/10/19 11:52:22 lukem Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd June 6, 1993
|
.Dd June 6, 1993
|
||||||
.Dt FIND 1
|
.Dt FIND 1
|
||||||
@ -44,13 +44,13 @@
|
|||||||
.Nm find
|
.Nm find
|
||||||
.Nd walk a file hierarchy
|
.Nd walk a file hierarchy
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm find
|
.Nm
|
||||||
.Op Fl HdhXx
|
.Op Fl HdhXx
|
||||||
.Op Fl f Ar file
|
.Op Fl f Ar file
|
||||||
.Op Ar file ...
|
.Op Ar file ...
|
||||||
.Ar expression
|
.Ar expression
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Find
|
.Nm
|
||||||
recursively descends the directory tree for each
|
recursively descends the directory tree for each
|
||||||
.Ar file
|
.Ar file
|
||||||
listed, evaluating an
|
listed, evaluating an
|
||||||
@ -75,12 +75,12 @@ the command line is that of the link itself.
|
|||||||
The
|
The
|
||||||
.Fl d
|
.Fl d
|
||||||
option causes
|
option causes
|
||||||
.Nm find
|
.Nm
|
||||||
to perform a depth\-first traversal, i.e. directories
|
to perform a depth\-first traversal, i.e. directories
|
||||||
are visited in post\-order and all entries in a directory will be acted
|
are visited in post\-order and all entries in a directory will be acted
|
||||||
on before the directory itself.
|
on before the directory itself.
|
||||||
By default,
|
By default,
|
||||||
.Nm find
|
.Nm
|
||||||
visits directories in pre\-order, i.e. before their contents.
|
visits directories in pre\-order, i.e. before their contents.
|
||||||
Note, the default is
|
Note, the default is
|
||||||
.Ar not
|
.Ar not
|
||||||
@ -89,7 +89,7 @@ a breadth\-first traversal.
|
|||||||
The
|
The
|
||||||
.Fl f
|
.Fl f
|
||||||
option specifies a file hierarchy for
|
option specifies a file hierarchy for
|
||||||
.Nm find
|
.Nm
|
||||||
to traverse.
|
to traverse.
|
||||||
File hierarchies may also be specified as the operands immediately
|
File hierarchies may also be specified as the operands immediately
|
||||||
following the options.
|
following the options.
|
||||||
@ -119,7 +119,7 @@ quotes, backslash (``\e''), space, tab and newline characters.
|
|||||||
The
|
The
|
||||||
.Fl x
|
.Fl x
|
||||||
option prevents
|
option prevents
|
||||||
.Nm find
|
.Nm
|
||||||
from descending into directories that have a device number different
|
from descending into directories that have a device number different
|
||||||
than that of the file from which the descent began.
|
than that of the file from which the descent began.
|
||||||
.El
|
.El
|
||||||
@ -127,14 +127,14 @@ than that of the file from which the descent began.
|
|||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Ic -atime Ar n
|
.It Ic -atime Ar n
|
||||||
True if the difference between the file last access time and the time
|
True if the difference between the file last access time and the time
|
||||||
.Nm find
|
.Nm
|
||||||
was started, rounded up to the next full 24\-hour period, is
|
was started, rounded up to the next full 24\-hour period, is
|
||||||
.Ar n
|
.Ar n
|
||||||
24\-hour periods.
|
24\-hour periods.
|
||||||
.It Ic -ctime Ar n
|
.It Ic -ctime Ar n
|
||||||
True if the difference between the time of last change of file status
|
True if the difference between the time of last change of file status
|
||||||
information and the time
|
information and the time
|
||||||
.Nm find
|
.Nm
|
||||||
was started, rounded up to the next full 24\-hour period, is
|
was started, rounded up to the next full 24\-hour period, is
|
||||||
.Ar n
|
.Ar n
|
||||||
24\-hour periods.
|
24\-hour periods.
|
||||||
@ -148,7 +148,7 @@ If the string ``{}'' appears anywhere in the utility name or the
|
|||||||
arguments it is replaced by the pathname of the current file.
|
arguments it is replaced by the pathname of the current file.
|
||||||
.Ar Utility
|
.Ar Utility
|
||||||
will be executed from the directory from which
|
will be executed from the directory from which
|
||||||
.Nm find
|
.Nm
|
||||||
was executed.
|
was executed.
|
||||||
.It Ic -follow
|
.It Ic -follow
|
||||||
Follow symbolic links.
|
Follow symbolic links.
|
||||||
@ -159,7 +159,7 @@ Two special file system types are recognized: ``local'' and ``rdonly''.
|
|||||||
These do not describe actual file system types;
|
These do not describe actual file system types;
|
||||||
the former matches any file system physically mounted on the system where
|
the former matches any file system physically mounted on the system where
|
||||||
the
|
the
|
||||||
.Nm find
|
.Nm
|
||||||
is being executed, and the latter matches any file system which is
|
is being executed, and the latter matches any file system which is
|
||||||
mounted read-only.
|
mounted read-only.
|
||||||
.It Ic -group Ar gname
|
.It Ic -group Ar gname
|
||||||
@ -189,7 +189,7 @@ displayed preceded by ``\->''.
|
|||||||
The format is identical to that produced by ``ls \-dgils''.
|
The format is identical to that produced by ``ls \-dgils''.
|
||||||
.It Ic -mtime Ar n
|
.It Ic -mtime Ar n
|
||||||
True if the difference between the file last modification time and the time
|
True if the difference between the file last modification time and the time
|
||||||
.Nm find
|
.Nm
|
||||||
was started, rounded up to the next full 24\-hour period, is
|
was started, rounded up to the next full 24\-hour period, is
|
||||||
.Ar n
|
.Ar n
|
||||||
24\-hour periods.
|
24\-hour periods.
|
||||||
@ -199,7 +199,7 @@ The
|
|||||||
primary is identical to the
|
primary is identical to the
|
||||||
.Ic -exec
|
.Ic -exec
|
||||||
primary with the exception that
|
primary with the exception that
|
||||||
.Nm find
|
.Nm
|
||||||
requests user affirmation for the execution of the utility by printing
|
requests user affirmation for the execution of the utility by printing
|
||||||
a message to the terminal and reading a response.
|
a message to the terminal and reading a response.
|
||||||
If the response is other than ``y'' the command is not executed and the
|
If the response is other than ``y'' the command is not executed and the
|
||||||
@ -279,7 +279,7 @@ by a null character.
|
|||||||
.It Ic -prune
|
.It Ic -prune
|
||||||
This primary always evaluates to true.
|
This primary always evaluates to true.
|
||||||
It causes
|
It causes
|
||||||
.Nm find
|
.Nm
|
||||||
to not descend into the current file.
|
to not descend into the current file.
|
||||||
Note, the
|
Note, the
|
||||||
.Ic -prune
|
.Ic -prune
|
||||||
@ -370,10 +370,10 @@ The second expression is not evaluated if the first expression is true.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
All operands and primaries must be separate arguments to
|
All operands and primaries must be separate arguments to
|
||||||
.Nm find .
|
.Nm "" .
|
||||||
Primaries which themselves take arguments expect each argument
|
Primaries which themselves take arguments expect each argument
|
||||||
to be a separate argument to
|
to be a separate argument to
|
||||||
.Nm find .
|
.Nm "" .
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
.Pp
|
.Pp
|
||||||
The following examples are shown as given to the shell:
|
The following examples are shown as given to the shell:
|
||||||
@ -401,7 +401,7 @@ that are newer than ``ttt''.
|
|||||||
.Xr symlink 7
|
.Xr symlink 7
|
||||||
.Sh STANDARDS
|
.Sh STANDARDS
|
||||||
The
|
The
|
||||||
.Nm find
|
.Nm
|
||||||
utility syntax is a superset of the syntax specified by the
|
utility syntax is a superset of the syntax specified by the
|
||||||
.St -p1003.2
|
.St -p1003.2
|
||||||
standard.
|
standard.
|
||||||
@ -445,7 +445,7 @@ This version replaces it no matter where in the utility name or arguments
|
|||||||
it appears.
|
it appears.
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
The special characters used by
|
The special characters used by
|
||||||
.Nm find
|
.Nm
|
||||||
are also special characters to many shell programs.
|
are also special characters to many shell programs.
|
||||||
In particular, the characters ``*'', ``['', ``]'', ``?'', ``('', ``)'',
|
In particular, the characters ``*'', ``['', ``]'', ``?'', ``('', ``)'',
|
||||||
``!'', ``\e'' and ``;'' may have to be escaped from the shell.
|
``!'', ``\e'' and ``;'' may have to be escaped from the shell.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: find.c,v 1.8 1997/01/09 20:19:10 tls Exp $ */
|
/* $NetBSD: find.c,v 1.9 1997/10/19 11:52:27 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -36,9 +36,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)find.c 8.1 (Berkeley) 6/6/93";*/
|
#if 0
|
||||||
static char rcsid[] = "$NetBSD: find.c,v 1.8 1997/01/09 20:19:10 tls Exp $";
|
static char sccsid[] = "from: @(#)find.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: find.c,v 1.9 1997/10/19 11:52:27 lukem Exp $");
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -157,10 +161,10 @@ find_execute(plan, paths)
|
|||||||
register FTSENT *entry;
|
register FTSENT *entry;
|
||||||
PLAN *p;
|
PLAN *p;
|
||||||
|
|
||||||
if (!(tree = fts_open(paths, ftsoptions, (int (*)())NULL)))
|
if (!(tree = fts_open(paths, ftsoptions, NULL)))
|
||||||
err(1, "ftsopen");
|
err(1, "ftsopen");
|
||||||
|
|
||||||
while (entry = fts_read(tree)) {
|
while ((entry = fts_read(tree)) != NULL) {
|
||||||
switch(entry->fts_info) {
|
switch(entry->fts_info) {
|
||||||
case FTS_D:
|
case FTS_D:
|
||||||
if (isdepth)
|
if (isdepth)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: function.c,v 1.20 1997/02/01 09:51:48 matthias Exp $ */
|
/* $NetBSD: function.c,v 1.21 1997/10/19 11:52:32 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990, 1993
|
* Copyright (c) 1990, 1993
|
||||||
@ -36,9 +36,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";*/
|
#if 0
|
||||||
static char rcsid[] = "$NetBSD: function.c,v 1.20 1997/02/01 09:51:48 matthias Exp $";
|
static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: function.c,v 1.21 1997/10/19 11:52:32 lukem Exp $");
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -74,7 +78,32 @@ static char rcsid[] = "$NetBSD: function.c,v 1.20 1997/02/01 09:51:48 matthias E
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLAN *palloc __P((enum ntype, int (*) __P((PLAN *, FTSENT *))));
|
static long find_parsenum __P((PLAN *, char *, char *, char *));
|
||||||
|
int f_always_true __P((PLAN *, FTSENT *));
|
||||||
|
int f_atime __P((PLAN *, FTSENT *));
|
||||||
|
int f_ctime __P((PLAN *, FTSENT *));
|
||||||
|
int f_exec __P((PLAN *, FTSENT *));
|
||||||
|
int f_fstype __P((PLAN *, FTSENT *));
|
||||||
|
int f_group __P((PLAN *, FTSENT *));
|
||||||
|
int f_inum __P((PLAN *, FTSENT *));
|
||||||
|
int f_links __P((PLAN *, FTSENT *));
|
||||||
|
int f_ls __P((PLAN *, FTSENT *));
|
||||||
|
int f_mtime __P((PLAN *, FTSENT *));
|
||||||
|
int f_name __P((PLAN *, FTSENT *));
|
||||||
|
int f_newer __P((PLAN *, FTSENT *));
|
||||||
|
int f_nogroup __P((PLAN *, FTSENT *));
|
||||||
|
int f_nouser __P((PLAN *, FTSENT *));
|
||||||
|
int f_path __P((PLAN *, FTSENT *));
|
||||||
|
int f_perm __P((PLAN *, FTSENT *));
|
||||||
|
int f_print __P((PLAN *, FTSENT *));
|
||||||
|
int f_print0 __P((PLAN *, FTSENT *));
|
||||||
|
int f_prune __P((PLAN *, FTSENT *));
|
||||||
|
int f_size __P((PLAN *, FTSENT *));
|
||||||
|
int f_type __P((PLAN *, FTSENT *));
|
||||||
|
int f_user __P((PLAN *, FTSENT *));
|
||||||
|
int f_not __P((PLAN *, FTSENT *));
|
||||||
|
int f_or __P((PLAN *, FTSENT *));
|
||||||
|
static PLAN *palloc __P((enum ntype, int (*) __P((PLAN *, FTSENT *))));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_parsenum --
|
* find_parsenum --
|
||||||
@ -227,11 +256,11 @@ c_depth()
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
f_exec(plan, entry)
|
f_exec(plan, entry)
|
||||||
register PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
{
|
{
|
||||||
extern int dotfd;
|
extern int dotfd;
|
||||||
register int cnt;
|
int cnt;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
@ -277,8 +306,8 @@ c_exec(argvp, isok)
|
|||||||
int isok;
|
int isok;
|
||||||
{
|
{
|
||||||
PLAN *new; /* node returned */
|
PLAN *new; /* node returned */
|
||||||
register int cnt;
|
int cnt;
|
||||||
register char **argv, **ap, *p;
|
char **argv, **ap, *p;
|
||||||
|
|
||||||
isoutput = 1;
|
isoutput = 1;
|
||||||
|
|
||||||
@ -360,7 +389,7 @@ f_fstype(plan, entry)
|
|||||||
*/
|
*/
|
||||||
if (entry->fts_info == FTS_SL ||
|
if (entry->fts_info == FTS_SL ||
|
||||||
entry->fts_info == FTS_SLNONE) {
|
entry->fts_info == FTS_SLNONE) {
|
||||||
if (p = strrchr(entry->fts_accpath, '/'))
|
if ((p = strrchr(entry->fts_accpath, '/')) != NULL)
|
||||||
++p;
|
++p;
|
||||||
else
|
else
|
||||||
p = entry->fts_accpath;
|
p = entry->fts_accpath;
|
||||||
@ -403,7 +432,7 @@ PLAN *
|
|||||||
c_fstype(arg)
|
c_fstype(arg)
|
||||||
char *arg;
|
char *arg;
|
||||||
{
|
{
|
||||||
register PLAN *new;
|
PLAN *new;
|
||||||
|
|
||||||
ftsoptions &= ~FTS_NOSTAT;
|
ftsoptions &= ~FTS_NOSTAT;
|
||||||
|
|
||||||
@ -641,8 +670,6 @@ f_nogroup(plan, entry)
|
|||||||
PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
{
|
{
|
||||||
char *group_from_gid();
|
|
||||||
|
|
||||||
return (group_from_gid(entry->fts_statp->st_gid, 1) ? 0 : 1);
|
return (group_from_gid(entry->fts_statp->st_gid, 1) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,8 +692,6 @@ f_nouser(plan, entry)
|
|||||||
PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
{
|
{
|
||||||
char *user_from_uid();
|
|
||||||
|
|
||||||
return (user_from_uid(entry->fts_statp->st_uid, 1) ? 0 : 1);
|
return (user_from_uid(entry->fts_statp->st_uid, 1) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +789,7 @@ f_print(plan, entry)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
int
|
||||||
f_print0(plan, entry)
|
f_print0(plan, entry)
|
||||||
PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
@ -977,9 +1002,10 @@ f_expr(plan, entry)
|
|||||||
PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
PLAN *p;
|
||||||
register int state;
|
int state;
|
||||||
|
|
||||||
|
state = 0;
|
||||||
for (p = plan->p_data[0];
|
for (p = plan->p_data[0];
|
||||||
p && (state = (p->eval)(p, entry)); p = p->next);
|
p && (state = (p->eval)(p, entry)); p = p->next);
|
||||||
return (state);
|
return (state);
|
||||||
@ -993,13 +1019,13 @@ f_expr(plan, entry)
|
|||||||
PLAN *
|
PLAN *
|
||||||
c_openparen()
|
c_openparen()
|
||||||
{
|
{
|
||||||
return (palloc(N_OPENPAREN, (int (*)())-1));
|
return (palloc(N_OPENPAREN, (int (*) __P((PLAN *, FTSENT *)))-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *
|
PLAN *
|
||||||
c_closeparen()
|
c_closeparen()
|
||||||
{
|
{
|
||||||
return (palloc(N_CLOSEPAREN, (int (*)())-1));
|
return (palloc(N_CLOSEPAREN, (int (*) __P((PLAN *, FTSENT *)))-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1012,9 +1038,10 @@ f_not(plan, entry)
|
|||||||
PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
PLAN *p;
|
||||||
register int state;
|
int state;
|
||||||
|
|
||||||
|
state = 0;
|
||||||
for (p = plan->p_data[0];
|
for (p = plan->p_data[0];
|
||||||
p && (state = (p->eval)(p, entry)); p = p->next);
|
p && (state = (p->eval)(p, entry)); p = p->next);
|
||||||
return (!state);
|
return (!state);
|
||||||
@ -1037,9 +1064,10 @@ f_or(plan, entry)
|
|||||||
PLAN *plan;
|
PLAN *plan;
|
||||||
FTSENT *entry;
|
FTSENT *entry;
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
PLAN *p;
|
||||||
register int state;
|
int state;
|
||||||
|
|
||||||
|
state = 0;
|
||||||
for (p = plan->p_data[0];
|
for (p = plan->p_data[0];
|
||||||
p && (state = (p->eval)(p, entry)); p = p->next);
|
p && (state = (p->eval)(p, entry)); p = p->next);
|
||||||
|
|
||||||
@ -1064,13 +1092,13 @@ palloc(t, f)
|
|||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
|
|
||||||
if (new = malloc(sizeof(PLAN))) {
|
if ((new = malloc(sizeof(PLAN))) != NULL) {
|
||||||
new->type = t;
|
new->type = t;
|
||||||
new->eval = f;
|
new->eval = f;
|
||||||
new->flags = 0;
|
new->flags = 0;
|
||||||
new->next = NULL;
|
new->next = NULL;
|
||||||
return (new);
|
return (new);
|
||||||
}
|
}
|
||||||
err(1, NULL);
|
err(1, "malloc");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ls.c,v 1.8 1997/06/30 21:26:57 jtc Exp $ */
|
/* $NetBSD: ls.c,v 1.9 1997/10/19 11:52:38 lukem Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
@ -33,9 +33,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)ls.c 8.1 (Berkeley) 6/6/93";*/
|
#if 0
|
||||||
static char rcsid[] = "$NetBSD: ls.c,v 1.8 1997/06/30 21:26:57 jtc Exp $";
|
static char sccsid[] = "from: @(#)ls.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: ls.c,v 1.9 1997/10/19 11:52:38 lukem Exp $");
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -43,6 +47,9 @@ static char rcsid[] = "$NetBSD: ls.c,v 1.8 1997/06/30 21:26:57 jtc Exp $";
|
|||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fts.h>
|
||||||
|
#include <grp.h>
|
||||||
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -50,6 +57,8 @@ static char rcsid[] = "$NetBSD: ls.c,v 1.8 1997/06/30 21:26:57 jtc Exp $";
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
|
||||||
|
#include "find.h"
|
||||||
|
|
||||||
/* Derived from the print routines in the ls(1) source code. */
|
/* Derived from the print routines in the ls(1) source code. */
|
||||||
|
|
||||||
static void printlink __P((char *));
|
static void printlink __P((char *));
|
||||||
@ -61,9 +70,9 @@ printlong(name, accpath, sb)
|
|||||||
char *accpath; /* current valid path to filename */
|
char *accpath; /* current valid path to filename */
|
||||||
struct stat *sb; /* stat buffer */
|
struct stat *sb; /* stat buffer */
|
||||||
{
|
{
|
||||||
char modep[15], *user_from_uid(), *group_from_gid();
|
char modep[15];
|
||||||
|
|
||||||
(void)printf("%6lu %4qd ", sb->st_ino, sb->st_blocks);
|
(void)printf("%6lu %4qd ", (u_long)sb->st_ino, sb->st_blocks);
|
||||||
(void)strmode(sb->st_mode, modep);
|
(void)strmode(sb->st_mode, modep);
|
||||||
(void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, UT_NAMESIZE,
|
(void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, UT_NAMESIZE,
|
||||||
user_from_uid(sb->st_uid, 0), UT_NAMESIZE,
|
user_from_uid(sb->st_uid, 0), UT_NAMESIZE,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: main.c,v 1.7 1997/10/18 14:49:45 lukem Exp $ */
|
/* $NetBSD: main.c,v 1.8 1997/10/19 11:52:43 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990, 1993
|
* Copyright (c) 1990, 1993
|
||||||
@ -33,9 +33,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";*/
|
#if 0
|
||||||
static char rcsid[] = "$NetBSD: main.c,v 1.7 1997/10/18 14:49:45 lukem Exp $";
|
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: main.c,v 1.8 1997/10/19 11:52:43 lukem Exp $");
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -59,6 +63,7 @@ int isdepth; /* do directories on post-order visit */
|
|||||||
int isoutput; /* user specified output operator */
|
int isoutput; /* user specified output operator */
|
||||||
int isxargs; /* don't permit xargs delimiting chars */
|
int isxargs; /* don't permit xargs delimiting chars */
|
||||||
|
|
||||||
|
int main __P((int, char **));
|
||||||
static void usage __P((void));
|
static void usage __P((void));
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -66,7 +71,7 @@ main(argc, argv)
|
|||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
register char **p, **start;
|
char **p, **start;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
(void)time(&now); /* initialize the time-of-day */
|
(void)time(&now); /* initialize the time-of-day */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: misc.c,v 1.5 1997/01/09 20:19:15 tls Exp $ */
|
/* $NetBSD: misc.c,v 1.6 1997/10/19 11:52:50 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990, 1993
|
* Copyright (c) 1990, 1993
|
||||||
@ -36,9 +36,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)misc.c 8.1 (Berkeley) 6/6/93";*/
|
#if 0
|
||||||
static char rcsid[] = "$NetBSD: misc.c,v 1.5 1997/01/09 20:19:15 tls Exp $";
|
static char sccsid[] = "from: @(#)misc.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: misc.c,v 1.6 1997/10/19 11:52:50 lukem Exp $");
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -63,15 +67,15 @@ brace_subst(orig, store, path, len)
|
|||||||
char *orig, **store, *path;
|
char *orig, **store, *path;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
register int plen;
|
int plen;
|
||||||
register char ch, *p;
|
char ch, *p;
|
||||||
|
|
||||||
plen = strlen(path);
|
plen = strlen(path);
|
||||||
for (p = *store; ch = *orig; ++orig)
|
for (p = *store; (ch = *orig) != 0; ++orig)
|
||||||
if (ch == '{' && orig[1] == '}') {
|
if (ch == '{' && orig[1] == '}') {
|
||||||
while ((p - *store) + plen > len)
|
while ((p - *store) + plen > len)
|
||||||
if (!(*store = realloc(*store, len *= 2)))
|
if (!(*store = realloc(*store, len *= 2)))
|
||||||
err(1, NULL);
|
err(1, "realloc");
|
||||||
memmove(p, path, plen);
|
memmove(p, path, plen);
|
||||||
p += plen;
|
p += plen;
|
||||||
++orig;
|
++orig;
|
||||||
@ -87,7 +91,7 @@ brace_subst(orig, store, path, len)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
queryuser(argv)
|
queryuser(argv)
|
||||||
register char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
int ch, first, nl;
|
int ch, first, nl;
|
||||||
|
|
||||||
@ -125,7 +129,7 @@ emalloc(len)
|
|||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
if (p = malloc(len))
|
if ((p = malloc(len)) != NULL)
|
||||||
return (p);
|
return (p);
|
||||||
err(1, NULL);
|
err(1, "malloc");
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: operator.c,v 1.4 1997/01/09 20:19:15 tls Exp $ */
|
/* $NetBSD: operator.c,v 1.5 1997/10/19 11:52:55 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990, 1993
|
* Copyright (c) 1990, 1993
|
||||||
@ -36,9 +36,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)operator.c 8.1 (Berkeley) 6/6/93";*/
|
#if 0
|
||||||
static char rcsid[] = "$NetBSD: operator.c,v 1.4 1997/01/09 20:19:15 tls Exp $";
|
static char sccsid[] = "from: @(#)operator.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: operator.c,v 1.5 1997/10/19 11:52:55 lukem Exp $");
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -76,11 +80,10 @@ static PLAN *
|
|||||||
yankexpr(planp)
|
yankexpr(planp)
|
||||||
PLAN **planp; /* pointer to top of plan (modified) */
|
PLAN **planp; /* pointer to top of plan (modified) */
|
||||||
{
|
{
|
||||||
register PLAN *next; /* temp node holding subexpression results */
|
PLAN *next; /* temp node holding subexpression results */
|
||||||
PLAN *node; /* pointer to returned node or expression */
|
PLAN *node; /* pointer to returned node or expression */
|
||||||
PLAN *tail; /* pointer to tail of subplan */
|
PLAN *tail; /* pointer to tail of subplan */
|
||||||
PLAN *subplan; /* pointer to head of ( ) expression */
|
PLAN *subplan; /* pointer to head of ( ) expression */
|
||||||
int f_expr();
|
|
||||||
|
|
||||||
/* first pull the top node from the plan */
|
/* first pull the top node from the plan */
|
||||||
if ((node = yanknode(planp)) == NULL)
|
if ((node = yanknode(planp)) == NULL)
|
||||||
@ -131,8 +134,8 @@ PLAN *
|
|||||||
paren_squish(plan)
|
paren_squish(plan)
|
||||||
PLAN *plan; /* plan with ( ) nodes */
|
PLAN *plan; /* plan with ( ) nodes */
|
||||||
{
|
{
|
||||||
register PLAN *expr; /* pointer to next expression */
|
PLAN *expr; /* pointer to next expression */
|
||||||
register PLAN *tail; /* pointer to tail of result plan */
|
PLAN *tail; /* pointer to tail of result plan */
|
||||||
PLAN *result; /* pointer to head of result plan */
|
PLAN *result; /* pointer to head of result plan */
|
||||||
|
|
||||||
result = tail = NULL;
|
result = tail = NULL;
|
||||||
@ -169,9 +172,9 @@ PLAN *
|
|||||||
not_squish(plan)
|
not_squish(plan)
|
||||||
PLAN *plan; /* plan to process */
|
PLAN *plan; /* plan to process */
|
||||||
{
|
{
|
||||||
register PLAN *next; /* next node being processed */
|
PLAN *next; /* next node being processed */
|
||||||
register PLAN *node; /* temporary node used in N_NOT processing */
|
PLAN *node; /* temporary node used in N_NOT processing */
|
||||||
register PLAN *tail; /* pointer to tail of result plan */
|
PLAN *tail; /* pointer to tail of result plan */
|
||||||
PLAN *result; /* pointer to head of result plan */
|
PLAN *result; /* pointer to head of result plan */
|
||||||
|
|
||||||
tail = result = next = NULL;
|
tail = result = next = NULL;
|
||||||
@ -227,8 +230,8 @@ PLAN *
|
|||||||
or_squish(plan)
|
or_squish(plan)
|
||||||
PLAN *plan; /* plan with ors to be squished */
|
PLAN *plan; /* plan with ors to be squished */
|
||||||
{
|
{
|
||||||
register PLAN *next; /* next node being processed */
|
PLAN *next; /* next node being processed */
|
||||||
register PLAN *tail; /* pointer to tail of result plan */
|
PLAN *tail; /* pointer to tail of result plan */
|
||||||
PLAN *result; /* pointer to head of result plan */
|
PLAN *result; /* pointer to head of result plan */
|
||||||
|
|
||||||
tail = result = next = NULL;
|
tail = result = next = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user