svn commit: trunk/busybox/findutils
vda at busybox.net
vda at busybox.net
Sun Oct 29 19:03:57 UTC 2006
Author: vda
Date: 2006-10-29 11:03:56 -0800 (Sun, 29 Oct 2006)
New Revision: 16468
Log:
find: small improvement
Modified:
trunk/busybox/findutils/find.c
Changeset:
Modified: trunk/busybox/findutils/find.c
===================================================================
--- trunk/busybox/findutils/find.c 2006-10-29 00:21:47 UTC (rev 16467)
+++ trunk/busybox/findutils/find.c 2006-10-29 19:03:56 UTC (rev 16468)
@@ -30,6 +30,8 @@
* file.txt file.txt
* file.txt
* /tmp
+ * # find -name '*.c' -o -name '*.h'
+ * [shows files, *.c and *.h intermixed]
*/
#include "busybox.h"
@@ -93,7 +95,6 @@
{
char *buf, *dst, *end;
int flen = strlen(filename);
-//puts(src);
/* we replace each '{}' with filename: growth by strlen-2 */
buf = dst = xmalloc(strlen(src) + count*(flen-2) + 1);
while ((end = strstr(src, "{}"))) {
@@ -104,7 +105,6 @@
dst += flen;
}
strcpy(dst, src);
-//puts(buf);
return buf;
}
@@ -363,16 +363,20 @@
}
if (firstopt == 1) {
- if (!recursive_action(".", TRUE, dereference, FALSE, fileAction,
- fileAction, NULL, 0))
+ static const char *const dot[] = { ".", NULL };
+ firstopt++;
+ argv = (char**)dot - 1;
+ }
+ for (i = 1; i < firstopt; i++) {
+ if (!recursive_action(argv[i],
+ TRUE, // recurse
+ dereference, // follow links
+ FALSE, // depth first
+ fileAction, // file action
+ fileAction, // dir action
+ NULL, // user data
+ 0)) // depth
status = EXIT_FAILURE;
- } else {
- for (i = 1; i < firstopt; i++) {
- if (!recursive_action(argv[i], TRUE, dereference, FALSE,
- fileAction, fileAction, NULL, 0))
- status = EXIT_FAILURE;
- }
}
-
return status;
}
More information about the busybox-cvs
mailing list