summaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 7a71af9..17a1a56 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -38,6 +38,9 @@ static const char msg_req_arg[] = "option `%s' requires an argument";
static const char msg_invalid_arg[] = "invalid argument `%s' to `%s'";
static char *pattern;
+#ifdef CONFIG_FEATURE_FIND_PRINT0
+static char printsep = '\n';
+#endif
#ifdef CONFIG_FEATURE_FIND_TYPE
static int type_mask = 0;
@@ -159,7 +162,11 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
}
#endif
+#ifdef CONFIG_FEATURE_FIND_PRINT0
+ printf("%s%c", fileName, printsep);
+#else
puts(fileName);
+#endif
no_match:
return (TRUE);
}
@@ -217,6 +224,10 @@ int find_main(int argc, char **argv)
else if (strcmp(argv[i], "-print") == 0) {
;
}
+#ifdef CONFIG_FEATURE_FIND_PRINT0
+ else if (strcmp(argv[i], "-print0") == 0)
+ printsep = '\0';
+#endif
else if (strcmp(argv[i], "-name") == 0) {
if (++i == argc)
bb_error_msg_and_die(msg_req_arg, "-name");