File mode badly shown in smbclient (want DAHR,---R,---- etc)

Joel Hammer Joel at HammersHome.com
Thu Dec 20 05:51:07 GMT 2001


I am NOT a C programmer but:
This is an easy thing to modify in the source code.
There is a line in client.c (line 330 in 2.2.1a) like so:
 DEBUG(0,("  %-30s%7.7s %8.0f  %s",  
Change it to read:
DEBUG(0,("  <%-30s>%7.7s %8.0f  %s",  
            ^     ^
Recompile (I just have to run make, takes about 5 seconds)
and then you get output like this:
 <initrd                        >      D        0  Sat Jul  8 17:12:46 2000   
The new version will be in source/bin. Don't run make install unless you
want this to be the new, system wide version of smbclient.
I was not able to use control characters in the DEBUG string, but, this sort
of output should be easy enough to parse. It might be possible to embed
special characters which wouldn't even be in a windows file name, but I just
don't know how to do that.
I am sure it would be possible to have confusing file names with < > in
them, but, it should be possible to script around them. Or, make the
separator as bizarre as you can eg. %^&$* or some silly thing.
You could compile this special version of smblcient and use it only for your
scripts, so regular users or other programs wouldn't be confused by it.
If you want help devising a script to parse this, I am sure the sedophiliacs
at:
 sed-users at yahoogroups.com      
would be glad to help.
Joel


On Thu, Dec 20, 2001 at 01:12:07PM +0200, Ralf.Strandell at silja.com wrote:
> Hi
> 
> We are using smbclient to automatically (& remotely) monitor the sizes and
> ages of files. The file names contain spaces of course. Some files have
> attributes set. Now how do I separate between file attributes and the file
> name in the following directory listing?
> 
> EXAMPLE:
> 
>   smb: Ö> dir *file*
>     second file is called AR                    0  Fri Sep 15 12:37:54 2000
>     file name with spaces             AR        0  Fri Sep 15 12:37:54 2000
> 
> QUESTION:
> 	does the AR belong to the filename of "second file is called AR"
> 	or does it say that the attributes of "second file is called" are
> "AR"?
> 
> 	For me it's obvious, but for my scripts it isn't.
> 
> 
> FIX:	Smbclient should use this notation: DAHR or -A-R for attributes.
> 	Could somebody please include this in a future version of Smbclient.
> 
> 
> ===========================
> Ralf Strandell
> UNIX System Administrator
> Silja Line, Finland
> ===========================
> 
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  http://lists.samba.org/mailman/listinfo/samba




More information about the samba mailing list