[BusyBox] strip double / in find output
Christophe Boyanique
totof at raceme.org
Wed Mar 7 14:38:56 UTC 2001
Hello,
I made a patch to suppress the double / in a filename from find output.
But this patch modify utility.c so I'd like to have your opinion about
breaking other functions by doing that.
Examples without the patch:
[alcove at w034 busybox]$ ./busybox find / -name proc
//proc
//proc/sys/proc
[alcove at w034 busybox]$ ./busybox find /bin/ -name ls
/bin//ls
[alcove at w034 busybox]$ ./busybox find /bin -name ls
/bin/ls
Examples with the patch:
[alcove at w034 busybox]$ ./busybox find / -name proc
/proc
/proc/sys/proc
[alcove at w034 busybox]$ ./busybox find /bin/ -name ls
/bin/ls
[alcove at w034 busybox]$ ./busybox find /bin -name ls
/bin/ls
Christophe.
-------------- next part --------------
--- utility.c.orig Wed Mar 7 15:22:03 2001
+++ utility.c Wed Mar 7 15:25:06 2001
@@ -715,7 +715,10 @@
return FALSE;
}
memset(nextFile, 0, sizeof(nextFile));
- sprintf(nextFile, "%s/%s", fileName, next->d_name);
+ if (fileName[strlen(fileName)-1] == '/')
+ sprintf(nextFile, "%s%s", fileName, next->d_name);
+ else
+ sprintf(nextFile, "%s/%s", fileName, next->d_name);
status =
recursive_action(nextFile, TRUE, followLinks, depthFirst,
fileAction, dirAction, userData);
More information about the busybox
mailing list