On Thu, Sep 01, 2005 at 01:28:39PM +0200, Simon Josefsson wrote: > Albert Chin <[EMAIL PROTECTED]> writes: > > > We created the following macro for curl. It's been tested on the > > following systems: > > Has the copyright been assigned to the FSF?
No. I'd like to see a liberal license with this though. Curl is under a very liberal license. We'd like to see other programs use this macro for detecting socklen_t as well (lftp has adopted a derivative of it and KDE I think has). > > dnl Check for socklen_t: historically on BSD it is an int, and in > > dnl POSIX 1g it is a type of its own, but some platforms use different > > dnl types for the argument to getsockopt, getpeername, etc. So we > > dnl have to test to find something that will work. > > AC_DEFUN([TYPE_SOCKLEN_T], > > [ > > AC_CHECK_TYPE([socklen_t], ,[ > > AC_MSG_CHECKING([for socklen_t equivalent]) > > AC_CACHE_VAL([socklen_t_equiv], > > [ > > # Systems have either "struct sockaddr *" or > > # "void *" as the second argument to getpeername > > socklen_t_equiv= > > for arg2 in "struct sockaddr" void; do > > for t in int size_t unsigned long "unsigned long"; do > > AC_TRY_COMPILE([ > > #include <sys/types.h> > > #include <sys/socket.h> > > > > int getpeername (int, $arg2 *, $t *); > > A bit weird approach of checking for a compatible type, perhaps, but > if it works, then I'm all for it. Bruno, what do you think? BTW, having socklen_t doesn't mean it's used by some of the networking functions. Check this out: http://bugs.kde.org/show_bug.cgi?id=78238 http://www.mail-archive.com/lftp-devel@uniyar.ac.ru/msg01246.html $ uname -a HP-UX hulk B.11.11 U 9000/785 2010914556 unlimited-user license $ cat a.c #include <sys/types.h> #include <sys/socket.h> $ cc -E a.c | grep socklen_t typedef size_t socklen_t; socklen_t msg_namelen; socklen_t msg_controllen; $ cc -E -D_XOPEN_SOURCE_EXTENDED a.c | grep socklen_t typedef size_t socklen_t; socklen_t msg_namelen; socklen_t msg_controllen; socklen_t cmsg_len; extern int accept (int, struct sockaddr *, socklen_t *) ; extern int bind (int, const struct sockaddr *, socklen_t) ; extern int connect (int, const struct sockaddr *, socklen_t) ; extern int getpeername (int, struct sockaddr *, socklen_t *) ; extern int getsockname (int, struct sockaddr *, socklen_t *) ; extern int getsockopt (int, int, int, void *, socklen_t *) ; extern ssize_t recvfrom (int, void *, size_t, int, struct sockaddr *, socklen_t *) ; extern ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t) ; extern int setsockopt (int, int, int, const void *, socklen_t) ; -- albert chin ([EMAIL PROTECTED]) _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib