Added -print0 (like GNU find). This will allow file names that contain
newlines to be correctly interpreted by programs that process find output.
This commit is contained in:
parent
3098ee5fbe
commit
3a2b9d8c2b
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)extern.h 5.2 (Berkeley) 5/24/91
|
||||
* $Id: extern.h,v 1.2 1993/08/01 18:16:18 mycroft Exp $
|
||||
* $Id: extern.h,v 1.3 1993/10/27 17:52:30 jtc Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
@ -65,6 +65,7 @@ PLAN *c_nogroup __P((void));
|
||||
PLAN *c_nouser __P((void));
|
||||
PLAN *c_perm __P((char *));
|
||||
PLAN *c_print __P((void));
|
||||
PLAN *c_print0 __P((void));
|
||||
PLAN *c_prune __P((void));
|
||||
PLAN *c_size __P((char *));
|
||||
PLAN *c_type __P((char *));
|
||||
|
@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)find.1 6.29 (Berkeley) 7/29/91
|
||||
.\" $Id: find.1,v 1.3 1993/08/01 07:32:54 mycroft Exp $
|
||||
.\" $Id: find.1,v 1.4 1993/10/27 17:52:37 jtc Exp $
|
||||
.\"
|
||||
.Dd July 29, 1991
|
||||
.Dt FIND 1
|
||||
@ -253,13 +253,18 @@ the bits in the mode exactly match the file's mode bits.
|
||||
Note, the first character of a symbolic mode may not be a dash (``\-'').
|
||||
.It Ic -print
|
||||
This primary always evaluates to true.
|
||||
It prints the pathname of the current file to standard output.
|
||||
It prints the pathname of the current file to standard output, followed
|
||||
by a newline character.
|
||||
The expression is appended to the user specified expression if neither
|
||||
.Ic -exec ,
|
||||
.Ic -ls
|
||||
or
|
||||
nor
|
||||
.Ic \&-ok
|
||||
is specified.
|
||||
.It Ic -print0
|
||||
This primary always evaluates to true.
|
||||
It prints the pathname of the current file to standard output, followed
|
||||
by a null character.
|
||||
.It Ic -prune
|
||||
This primary always evaluates to true.
|
||||
It causes
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)find.h 5.8 (Berkeley) 5/24/91
|
||||
* $Id: find.h,v 1.3 1993/08/01 18:16:17 mycroft Exp $
|
||||
* $Id: find.h,v 1.4 1993/10/27 17:52:39 jtc Exp $
|
||||
*/
|
||||
|
||||
/* node type */
|
||||
@ -43,7 +43,7 @@ enum ntype {
|
||||
N_ATIME, N_CLOSEPAREN, N_CTIME, N_DEPTH, N_EXEC, N_EXPR, N_FOLLOW,
|
||||
N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MTIME, N_NAME, N_NEWER,
|
||||
N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PERM, N_PRINT,
|
||||
N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV,
|
||||
N_PRINT0, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV,
|
||||
};
|
||||
|
||||
/* node definition */
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)function.c 5.17 (Berkeley) 5/24/91";*/
|
||||
static char rcsid[] = "$Id: function.c,v 1.8 1993/09/16 21:41:30 cgd Exp $";
|
||||
static char rcsid[] = "$Id: function.c,v 1.9 1993/10/27 17:52:41 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -709,6 +709,16 @@ f_print(plan, entry)
|
||||
(void)printf("%s\n", entry->fts_path);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
f_print0(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
{
|
||||
(void)fputs(entry->fts_path, stdout);
|
||||
(void)fputc('\0', stdout);
|
||||
return(1);
|
||||
}
|
||||
|
||||
PLAN *
|
||||
c_print()
|
||||
@ -717,6 +727,14 @@ c_print()
|
||||
|
||||
return(palloc(N_PRINT, f_print));
|
||||
}
|
||||
|
||||
PLAN *
|
||||
c_print0()
|
||||
{
|
||||
isoutput = 1;
|
||||
|
||||
return(palloc(N_PRINT0, f_print0));
|
||||
}
|
||||
|
||||
/*
|
||||
* -prune functions --
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)option.c 5.8 (Berkeley) 6/4/91";*/
|
||||
static char rcsid[] = "$Id: option.c,v 1.3 1993/08/01 18:16:08 mycroft Exp $";
|
||||
static char rcsid[] = "$Id: option.c,v 1.4 1993/10/27 17:52:44 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -84,6 +84,7 @@ OPTION options[] = {
|
||||
"-or", N_OR, c_or, O_ZERO,
|
||||
"-perm", N_PERM, c_perm, O_ARGV,
|
||||
"-print", N_PRINT, c_print, O_ZERO,
|
||||
"-print0", N_PRINT0, c_print0, O_ZERO,
|
||||
"-prune", N_PRUNE, c_prune, O_ZERO,
|
||||
"-size", N_SIZE, c_size, O_ARGV,
|
||||
"-type", N_TYPE, c_type, O_ARGV,
|
||||
|
Loading…
x
Reference in New Issue
Block a user