//config: If the file is a directory, don't descend into it. Useful for
//config: exclusion .svn and CVS directories.
//config:
+//config:config FEATURE_FIND_QUIT
+//config: bool "Enable -quit: exit"
+//config: default y
+//config: depends on FIND
+//config: help
+//config: If this action is reached, 'find' exits.
+//config:
//config:config FEATURE_FIND_DELETE
//config: bool "Enable -delete: delete files/dirs"
//config: default y
//usage: IF_FEATURE_FIND_DELETE(
//usage: "\n -delete Delete current file/directory. Turns on -depth option"
//usage: )
+//usage: IF_FEATURE_FIND_QUIT(
+//usage: "\n -quit Exit"
+//usage: )
//usage:
//usage:#define find_example_usage
//usage: "$ find / -name passwd\n"
IF_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;))
IF_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;))
IF_FEATURE_FIND_PRUNE( ACTS(prune))
+IF_FEATURE_FIND_QUIT( ACTS(quit))
IF_FEATURE_FIND_DELETE( ACTS(delete))
IF_FEATURE_FIND_EXEC( ACTS(exec,
char **exec_argv; /* -exec ARGS */
action ***actions;
smallint need_print;
smallint xdev_on;
+ smalluint exitstatus;
recurse_flags_t recurse_flags;
IF_FEATURE_FIND_EXEC_PLUS(unsigned max_argv_len;)
} FIX_ALIASING;
return SKIP + TRUE;
}
#endif
+#if ENABLE_FEATURE_FIND_QUIT
+ACTF(quit)
+{
+ exit(G.exitstatus);
+}
+#endif
#if ENABLE_FEATURE_FIND_DELETE
ACTF(delete)
{
PARM_print ,
IF_FEATURE_FIND_PRINT0( PARM_print0 ,)
IF_FEATURE_FIND_PRUNE( PARM_prune ,)
+ IF_FEATURE_FIND_QUIT( PARM_quit ,)
IF_FEATURE_FIND_DELETE( PARM_delete ,)
IF_FEATURE_FIND_EXEC( PARM_exec ,)
IF_FEATURE_FIND_PAREN( PARM_char_brace,)
"-print\0"
IF_FEATURE_FIND_PRINT0( "-print0\0" )
IF_FEATURE_FIND_PRUNE( "-prune\0" )
+ IF_FEATURE_FIND_QUIT( "-quit\0" )
IF_FEATURE_FIND_DELETE( "-delete\0" )
IF_FEATURE_FIND_EXEC( "-exec\0" )
IF_FEATURE_FIND_PAREN( "(\0" )
(void) ALLOC_ACTION(prune);
}
#endif
+#if ENABLE_FEATURE_FIND_QUIT
+ else if (parm == PARM_quit) {
+ dbg("%d", __LINE__);
+ (void) ALLOC_ACTION(quit);
+ }
+#endif
#if ENABLE_FEATURE_FIND_DELETE
else if (parm == PARM_delete) {
dbg("%d", __LINE__);
int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int find_main(int argc UNUSED_PARAM, char **argv)
{
- int i, firstopt, status = EXIT_SUCCESS;
+ int i, firstopt;
char **past_HLP, *saved;
INIT_G();
NULL, /* user data */
0) /* depth */
) {
- status |= EXIT_FAILURE;
+ G.exitstatus |= EXIT_FAILURE;
}
}
- IF_FEATURE_FIND_EXEC_PLUS(status |= flush_exec_plus();)
- return status;
+ IF_FEATURE_FIND_EXEC_PLUS(G.exitstatus |= flush_exec_plus();)
+ return G.exitstatus;
}