Find -maxdepth
Robert Dahlem
Robert.Dahlem at gmx.net
Thu Dec 14 17:31:21 GMT 2000
Derk-Jan,
On Thu, 14 Dec 2000 12:56:13 +0000, The DJ wrote:
>I'm working on a port of Samba to macos X.
>As far as I can tell, most is working except one thing.
>When you upload a directory to another server with smbclient,
>smbclient calls find -maxdepth to look at the dir you want to upload.
>The OSX version of find (which is basicly the FreeBSD version) does
>not know the -maxdepth option and therefore I cannot upload
>directories.
>
>Can I edit the source, so that it doesn't need the -maxdepth option?
>What would I change to let it work with BSD like systems?
Calling find from a program is bad practice in my eyes, especially
when using options not available on all systems. Looks a little like a
Q&D hack. :-)
There is a library function ftw() ("file tree walk") doing the inner
part of what find does. I think the best way would be to rewrite
client/client.c:cmd_mput() to use ftw() for recursive and getdents()
for non-recursive runs. Note that this may be a bad choice if ftw() is
not available on all systems ... this could be detected by configure
and handled with
#ifdef HAVE_FTW
ftw();
#else
sprintf(cmd, "find ...", ...);
#endif
Expect your own pizza voucher if you recode the stuff and push it back
to the team. :-)
Regards,
Robert
--
---------------------------------------------------------------
Robert.Dahlem at gmx.net Fax +49-69-432647
---------------------------------------------------------------
Sent using PMMail (http://www.pmmail2000.com) - fast, decent, email
software; far better than Outlook. Try it sometime.
More information about the samba-technical
mailing list