summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bcc2612)
to reflect same, and added an example of -print0. Also fixed ordering
of certain primaries listed in the documents. (It really helps to try printing
the documentation out!)
PLAN *c_path __P((char *));
PLAN *c_perm __P((char *));
PLAN *c_print __P((void));
PLAN *c_path __P((char *));
PLAN *c_perm __P((char *));
PLAN *c_print __P((void));
+PLAN *c_print0 __P((void));
+PLAN *c_printf __P((char *));
PLAN *c_prune __P((void));
PLAN *c_size __P((char *));
PLAN *c_type __P((char *));
PLAN *c_prune __P((void));
PLAN *c_size __P((char *));
PLAN *c_type __P((char *));
was started, rounded up to the next full 24\-hour period, is
.Ar n
24\-hour periods.
was started, rounded up to the next full 24\-hour period, is
.Ar n
24\-hour periods.
-.It Ic \&-ok Ar utility Ns Op argument ... ;
-The
-.Ic \&-ok
-primary is identical to the
-.Ic -exec
-primary with the exception that
-.Nm find
-requests user affirmation for the execution of the utility by printing
-a message to the terminal and reading a response.
-If the response is other than ``y'' the command is not executed and the
-value of the
-.Ar \&ok
-expression is false.
.It Ic -name Ar pattern
True if the last component of the pathname being examined matches
.Ar pattern .
.It Ic -name Ar pattern
True if the last component of the pathname being examined matches
.Ar pattern .
True if the file belongs to an unknown user.
.It Ic -nogroup
True if the file belongs to an unknown group.
True if the file belongs to an unknown user.
.It Ic -nogroup
True if the file belongs to an unknown group.
+.It Ic \&-ok Ar utility Ns Op argument ... ;
+The
+.Ic \&-ok
+primary is identical to the
+.Ic -exec
+primary with the exception that
+.Nm find
+requests user affirmation for the execution of the utility by printing
+a message to the terminal and reading a response.
+If the response is other than ``y'' the command is not executed and the
+value of the
+.Ar \&ok
+expression is false.
True if the pathname being examined matches
True if the pathname being examined matches
.Ar pattern .
Special shell pattern matching characters (``['', ``]'', ``*'', and ``?'')
may be used as part of
.Ar pattern .
Special shell pattern matching characters (``['', ``]'', ``*'', and ``?'')
may be used as part of
.It Ic -print
This primary always evaluates to true.
It prints the pathname of the current file to standard output.
.It Ic -print
This primary always evaluates to true.
It prints the pathname of the current file to standard output.
-The expression is appended to the user specified expression if neither
+The expression is appended to the user specified expression if none of
+.Ic -ls ,
+.Ic -print0 ,
+.Ic -printf
+and
+are specified.
+.It Ic -print0
+This primary prints the pathname of the current file to standard output,
+followed by a NUL (ASCII 0) character. No newline is output. It
+is intended for use when the files being reported may contain newlines or
+other special characters.
+.It Ic -printf
+This primary takes one argument, which is interpreted as a format string
+to be passed to
+.Xr printf 3 .
+It must contain exactly one
+.Dq Li \&%s
+format specifier, with or without modifier flags, which receives the
+full pathname of the current file. No C-style escape processing is
+performed.
.It Ic -prune
This primary always evaluates to true.
It causes
.It Ic -prune
This primary always evaluates to true.
It causes
.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
Print out a list of all the files that are either owned by ``wnj'' or
that are newer than ``ttt''.
.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
Print out a list of all the files that are either owned by ``wnj'' or
that are newer than ``ttt''.
+.It Li "find / -name \e*~ -print0 | perl -n0e unlink"
+Find all the
+.Xr emacs 1
+backup files and delete them quickly using
+.Xr perl 1 .
.El
.Sh SEE ALSO
.Xr chmod 1 ,
.Xr locate 1 ,
.El
.Sh SEE ALSO
.Xr chmod 1 ,
.Xr locate 1 ,
.Xr stat 2 ,
.Xr fts 3 ,
.Xr getpwent 3 ,
.Xr getgrent 3 ,
.Xr stat 2 ,
.Xr fts 3 ,
.Xr getpwent 3 ,
.Xr getgrent 3 ,
.Xr strmode 3 ,
.Xr symlink 7
.Sh STANDARDS
.Xr strmode 3 ,
.Xr symlink 7
.Sh STANDARDS
and
.Fl X
options and the
and
.Fl X
options and the
+.Ic -inum ,
+.Ic -ls ,
+.Ic -print0 ,
primaries are extensions to
.St -p1003.2 .
.Pp
primaries are extensions to
.St -p1003.2 .
.Pp
#define F_MTFLAG 1 /* fstype */
#define F_MTTYPE 2
#define F_ATLEAST 1 /* perm */
#define F_MTFLAG 1 /* fstype */
#define F_MTTYPE 2
#define F_ATLEAST 1 /* perm */
+#define F_PRINT0 1
+#define F_PRINTF 2
int flags; /* private flags */
enum ntype type; /* plan node type */
union {
int flags; /* private flags */
enum ntype type; /* plan node type */
union {
PLAN *plan;
FTSENT *entry;
{
PLAN *plan;
FTSENT *entry;
{
- (void)printf("%s\n", entry->fts_path);
+ if (plan->flags & F_PRINTF) {
+ printf(plan->c_data, entry->fts_path);
+ } else {
+ fputs(entry->fts_path, stdout);
+ }
+
+ if (plan->flags & F_PRINT0) {
+ fputc('\0', stdout);
+ } else {
+ fputc('\n', stdout);
+ }
return (palloc(N_PRINT, f_print));
}
return (palloc(N_PRINT, f_print));
}
+
+PLAN *
+c_print0()
+{
+ PLAN *rv = palloc(N_PRINT, f_print);
+ rv->flags = F_PRINT0;
+ isoutput = 1;
+ return rv;
+}
+
+PLAN *
+c_printf(arg)
+ char *arg;
+{
+ PLAN *rv = palloc(N_PRINT, f_print);
+ rv->flags = F_PRINTF;
+ rv->c_data = arg;
+ isoutput = 1;
+ return rv;
+}
+
{ "-path", N_PATH, c_path, O_ARGV },
{ "-perm", N_PERM, c_perm, O_ARGV },
{ "-print", N_PRINT, c_print, O_ZERO },
{ "-path", N_PATH, c_path, O_ARGV },
{ "-perm", N_PERM, c_perm, O_ARGV },
{ "-print", N_PRINT, c_print, O_ZERO },
+ { "-print0", N_PRINT, c_print0, O_ZERO },
+ { "-printf", N_PRINT, c_printf, O_ARGV },
{ "-prune", N_PRUNE, c_prune, O_ZERO },
{ "-size", N_SIZE, c_size, O_ARGV },
{ "-type", N_TYPE, c_type, O_ARGV },
{ "-prune", N_PRUNE, c_prune, O_ZERO },
{ "-size", N_SIZE, c_size, O_ARGV },
{ "-type", N_TYPE, c_type, O_ARGV },