Questions re libsmbclient etc

Michael Sweet mike at easysw.com
Tue Dec 19 13:50:50 GMT 2000


Richard Sharpe wrote:
> ...
> Should I insist that users of the library must include these files,
> or should I simply included them in libsmbclient.h?

Unless you plan on generating libsmbclient.h from your configure
script, I'd advise against including <dirent.h>; the others are
pretty much standard, but the directory stuff varies widely; for
example, the typical dirent check in an autoconf-style script uses
the "AC_HEADER_DIRENT" rule, which then requires the following
(or similar) conditional stuff in your code to use:

    #if HAVE_DIRENT_H
    #  include <dirent.h>
    typedef struct dirent DIRENT;
    #  define NAMLEN(dirent) strlen((dirent)->d_name)
    #else
    #  if HAVE_SYS_NDIR_H
    #    include <sys/ndir.h>
    #  endif
    #  if HAVE_SYS_DIR_H
    #    include <sys/dir.h>
    #  endif
    #  if HAVE_NDIR_H
    #    include <ndir.h>
    #  endif
    typedef struct direct DIRENT;
    #  define NAMLEN(dirent) (dirent)->d_namlen
    #endif

Aside from the different locations of the directory header file,
the structures can be different, too...  Rather than overloading one
of the existing structures, I'd recommend rolling your own to avoid
these issues entirely.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products                  mike at easysw.com
Printing Software for UNIX                       http://www.easysw.com




More information about the samba-technical mailing list