libsmbclient and browsing: dirents and entry type ...

Richard Sharpe sharpe at ns.aus.com
Mon Jan 1 13:37:06 GMT 2001


Hi,

In thinking about browsing, especially browsing of workgroups etc, a
difficulty arises with respect to readdir and dirents ...

The normal paradigm that I expect to be used is:


   dirp = smbc_opendir("smb://");

   while (dir = readdir(dirp)) {


      /* do something with dir, like list it, or add it to a
       * gtk+ tree or something
       */

   }

The problem is that we need to type of object returned via readdir.

We can either return a type along with the directory entry returned, but
doing so requires that we return our own private dirent structure.

Alternatively, we could frob smbc_stat so that it can return a correct type
when passed something returned by smbc_readdir. The type would be from among:

  SMBC_ALL_WORKGROUPS or SMBC_TOP
  SMBC_WORKGROUP
  SMBC_SERVER
  SMBC_SHARE
  SMBC_DIR
  SMBC_FILE
  SMBC_LINK???

Any thoughts out there?


Regards
-------
Richard Sharpe, sharpe at ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba






More information about the samba-technical mailing list