* inet_{a,p}ton prototypes in Src/Modules/zftp.pro @ 2001-05-06 17:45 Paul Ackersviller 2001-05-07 0:03 ` Bart Schaefer ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Paul Ackersviller @ 2001-05-06 17:45 UTC (permalink / raw) To: zsh-users I just tried building zsh on Solaris 7 from the latest source off of CVS. Sun's compiler doesn't like inet_aton and inet_pton being declared as static. Here are the errors: "./zftp.pro", line 4: identifier redeclared: inet_aton current : static function(pointer to const char, pointer to struct in_addr {union {..} S_un}) returning int previous: function(pointer to const char, pointer to struct in_addr {union {..} S_un}) returning int : "/usr/include/arpa/inet.h", line 52 "./zftp.pro", line 6: identifier redeclared: inet_pton current : static function(int, pointer to const char, pointer to void) returning int previous: function(int, pointer to const char, pointer to void) returning int : "/usr/include/arpa/inet.h", line 54 -- Paul Ackersviller ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-06 17:45 inet_{a,p}ton prototypes in Src/Modules/zftp.pro Paul Ackersviller @ 2001-05-07 0:03 ` Bart Schaefer 2001-05-07 1:27 ` nce 2001-05-08 14:37 ` Andrej Borsenkow 2001-05-09 19:55 ` PATCH: " Andrej Borsenkow 2 siblings, 1 reply; 12+ messages in thread From: Bart Schaefer @ 2001-05-07 0:03 UTC (permalink / raw) To: Paul Ackersviller, zsh-users On May 6, 10:45am, Paul Ackersviller wrote: } Subject: inet_{a,p}ton prototypes in Src/Modules/zftp.pro } } I just tried building zsh on Solaris 7 from the latest source off } of CVS. Sun's compiler doesn't like inet_aton and inet_pton being } declared as static. Those declarations should be used only if HAVE_INET_PTON and HAVE_INET_ATON are not defined. Obviously you do have them, or at least you have a header that declares them, or you couldn't have the conflict in the first place. So the real question is, why are HAVE_INET_{A,P}TON not defined? Was an old config.cache used, or is there a library missing from the link that is needed in order for configure to find them? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-07 0:03 ` Bart Schaefer @ 2001-05-07 1:27 ` nce 2001-05-07 14:56 ` Bart Schaefer 0 siblings, 1 reply; 12+ messages in thread From: nce @ 2001-05-07 1:27 UTC (permalink / raw) To: Bart Schaefer; +Cc: zsh-users On Mon, May 07, 2001 at 12:03:50AM +0000, Bart Schaefer wrote: > On May 6, 10:45am, Paul Ackersviller wrote: > } > } I just tried building zsh on Solaris 7 from the latest source off > } of CVS. Sun's compiler doesn't like inet_aton and inet_pton being > } declared as static. > > Those declarations should be used only if HAVE_INET_PTON and HAVE_INET_ATON > are not defined. Obviously you do have them, or at least you have a header > that declares them, or you couldn't have the conflict in the first place. > > So the real question is, why are HAVE_INET_{A,P}TON not defined? Was an > old config.cache used, or is there a library missing from the link that > is needed in order for configure to find them? I just tried making a completely clean start so there was nothing old left over, but had the same problem. The command-line in config.log looks good to me, but you're right that the confidence test for those routines fails. I tried hacking around with the configure script to get some more information, but didn't get anywhere. Any hints? -- Paul Ackersviller ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-07 1:27 ` nce @ 2001-05-07 14:56 ` Bart Schaefer 2001-05-07 19:12 ` Kenneth Lareau 2001-05-08 4:12 ` nce 0 siblings, 2 replies; 12+ messages in thread From: Bart Schaefer @ 2001-05-07 14:56 UTC (permalink / raw) To: nce; +Cc: zsh-users On May 6, 6:27pm, nce@SLAC.Stanford.EDU wrote: } Subject: Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro } } On Mon, May 07, 2001 at 12:03:50AM +0000, Bart Schaefer wrote: } > } > So the real question is, why are HAVE_INET_{A,P}TON not defined? } } I just tried making a completely clean start so there was nothing old } left over, but had the same problem. The command-line in config.log } looks good to me, but you're right that the confidence test for those } routines fails. I don't have access to Solaris 7 documentation, and everything on-line at sun.com is already Solaris 8 (and remarkably uninformative). What librar(y|ies) (is|are) supposed to provide inet_aton() and inet_pton() ? For example, it may be necessary to add AC_CHECK_LIB(socket, inet_pton) ^^^^^^ or nsl, or something before the call to AC_CHECK_FUNCS(...) that includes inet_{a,p}ton. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-07 14:56 ` Bart Schaefer @ 2001-05-07 19:12 ` Kenneth Lareau 2001-05-08 4:12 ` nce 1 sibling, 0 replies; 12+ messages in thread From: Kenneth Lareau @ 2001-05-07 19:12 UTC (permalink / raw) To: Bart Schaefer; +Cc: nce, zsh-users Just for future reference, folks: docs.sun.com has the entire documen- tation collections for at least Solaris 2.6, 7 and 8. It can be a bit slow at times, but it's extremely comprehensive. A quick 'nm' on the libraries seem to show hooks in libresolv.so, but apparently those functions really aren't defined there, and there's no man pages for either on my install of Solaris 7. Ken Lareau elessar@numenor.org In message <1010507145620.ZM27687@candle.brasslantern.com>, "Bart Schaefer" wri tes: >On May 6, 6:27pm, nce@SLAC.Stanford.EDU wrote: >} Subject: Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro >} >} On Mon, May 07, 2001 at 12:03:50AM +0000, Bart Schaefer wrote: >} > >} > So the real question is, why are HAVE_INET_{A,P}TON not defined? >} >} I just tried making a completely clean start so there was nothing old >} left over, but had the same problem. The command-line in config.log >} looks good to me, but you're right that the confidence test for those >} routines fails. > >I don't have access to Solaris 7 documentation, and everything on-line >at sun.com is already Solaris 8 (and remarkably uninformative). What >librar(y|ies) (is|are) supposed to provide inet_aton() and inet_pton() ? > >For example, it may be necessary to add > > AC_CHECK_LIB(socket, inet_pton) > ^^^^^^ > or nsl, or something > >before the call to AC_CHECK_FUNCS(...) that includes inet_{a,p}ton. > >-- >Bart Schaefer Brass Lantern Enterprises >http://www.well.com/user/barts http://www.brasslantern.com > >Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-07 14:56 ` Bart Schaefer 2001-05-07 19:12 ` Kenneth Lareau @ 2001-05-08 4:12 ` nce 2001-05-08 12:53 ` Andrej Borsenkow 1 sibling, 1 reply; 12+ messages in thread From: nce @ 2001-05-08 4:12 UTC (permalink / raw) To: Bart Schaefer; +Cc: zsh-users On Mon, May 07, 2001 at 02:56:19PM +0000, Bart Schaefer wrote: > I don't have access to Solaris 7 documentation, and everything on-line > at sun.com is already Solaris 8 (and remarkably uninformative). What > librar(y|ies) (is|are) supposed to provide inet_aton() and inet_pton() ? Both socket and nsl, on all versions of Solaris as far back as I can remember. > For example, it may be necessary to add > > AC_CHECK_LIB(socket, inet_pton) > ^^^^^^ > or nsl, or something There's already AC_SEARCH_LIBS(yp_all, nsl) earlier on from AC_CHECK_LIB(socket, socket) but switching those around doesn't seem to help me. I tried a few other things, but I know very little about autoconf, so haven't got it to work yet. One problem I do notice in my config.log is that all the tests link with -lnsl before -lsocket, which isn't the right way around. -- Paul Ackersviller ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-08 4:12 ` nce @ 2001-05-08 12:53 ` Andrej Borsenkow 2001-05-09 1:42 ` nce 0 siblings, 1 reply; 12+ messages in thread From: Andrej Borsenkow @ 2001-05-08 12:53 UTC (permalink / raw) To: nce; +Cc: zsh-users > > On Mon, May 07, 2001 at 02:56:19PM +0000, Bart Schaefer wrote: > > I don't have access to Solaris 7 documentation, and everything on-line > > at sun.com is already Solaris 8 (and remarkably uninformative). What > > librar(y|ies) (is|are) supposed to provide inet_aton() and inet_pton() ? > > Both socket and nsl, on all versions of Solaris as far back as I can > remember. > > > For example, it may be necessary to add > > > > AC_CHECK_LIB(socket, inet_pton) > > ^^^^^^ > > or nsl, or something > > There's already > AC_SEARCH_LIBS(yp_all, nsl) > earlier on from > AC_CHECK_LIB(socket, socket) > but switching those around doesn't seem to help me. Please, do not swap them. It will break things here. > I tried a few other things, but I know very little about autoconf, > so haven't got it to work yet. > > One problem I do notice in my config.log is that all the tests link with > -lnsl before -lsocket, which isn't the right way around. > Do you mean it is '-lnsl -lsocket'? Strange: LIBS = -lsocket -ldl -lnsl -ltermcap -lm -lg -lc and our networking code is very similar to Solaris 7. I'll try to find what I've done once for Solaris. I believe, this issue was already raised. -andrej ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-08 12:53 ` Andrej Borsenkow @ 2001-05-09 1:42 ` nce 0 siblings, 0 replies; 12+ messages in thread From: nce @ 2001-05-09 1:42 UTC (permalink / raw) To: Andrej Borsenkow; +Cc: zsh-users On Tue, May 08, 2001 at 04:53:33PM +0400, Andrej Borsenkow wrote: > > > > There's already > > AC_SEARCH_LIBS(yp_all, nsl) > > earlier on from > > AC_CHECK_LIB(socket, socket) > > but switching those around doesn't seem to help me. > > Please, do not swap them. It will break things here. Yes, so I found out. > > One problem I do notice in my config.log is that all the tests link with > > -lnsl before -lsocket, which isn't the right way around. > > Do you mean it is '-lnsl -lsocket'? Yes, but I'm speaking only about the confidence tests I looked at in my config.log, zsh itself has no trouble linking. -- Paul Ackersviller ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-06 17:45 inet_{a,p}ton prototypes in Src/Modules/zftp.pro Paul Ackersviller 2001-05-07 0:03 ` Bart Schaefer @ 2001-05-08 14:37 ` Andrej Borsenkow 2001-05-09 19:55 ` PATCH: " Andrej Borsenkow 2 siblings, 0 replies; 12+ messages in thread From: Andrej Borsenkow @ 2001-05-08 14:37 UTC (permalink / raw) To: Paul Ackersviller, zsh-users > > I just tried building zsh on Solaris 7 from the latest source off of CVS. > Sun's compiler doesn't like inet_aton and inet_pton being declared > as static. > Here are the errors: > > "./zftp.pro", line 4: identifier redeclared: inet_aton > current : static function(pointer to const char, pointer to > struct in_addr {union {..} S_un}) returning int > previous: function(pointer to const char, pointer to struct > in_addr {union {..} S_un}) returning int : > "/usr/include/arpa/inet.h", line 52 > "./zftp.pro", line 6: identifier redeclared: inet_pton > current : static function(int, pointer to const char, > pointer to void) returning int > previous: function(int, pointer to const char, pointer to > void) returning int : "/usr/include/arpa/inet.h", line 54 > I did a bit of digging. The exactly same problem was reported a while back in users/3375. Paul, are using Sun workshop compiler? I had a patch but IIRC I never got any response if it fixed the things and I had some problems on my own system. The patch probably is not applicable anymore due to configure.in changes, I'll try to adapt it but cannot promise when. Interested could look up the mentioned thread; it was moved to zsh-workers then starting with article workers/12686 -andrej ^ permalink raw reply [flat|nested] 12+ messages in thread
* PATCH: Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-06 17:45 inet_{a,p}ton prototypes in Src/Modules/zftp.pro Paul Ackersviller 2001-05-07 0:03 ` Bart Schaefer 2001-05-08 14:37 ` Andrej Borsenkow @ 2001-05-09 19:55 ` Andrej Borsenkow 2001-05-09 20:01 ` Andrej Borsenkow 2001-05-10 3:21 ` nce 2 siblings, 2 replies; 12+ messages in thread From: Andrej Borsenkow @ 2001-05-09 19:55 UTC (permalink / raw) To: Paul Ackersviller; +Cc: zsh-users On Sun, 6 May 2001, Paul Ackersviller wrote: > I just tried building zsh on Solaris 7 from the latest source off of CVS. > Sun's compiler doesn't like inet_aton and inet_pton being declared as static. > Here are the errors: > > "./zftp.pro", line 4: identifier redeclared: inet_aton > current : static function(pointer to const char, pointer to struct in_addr {union {..} S_un}) returning int > previous: function(pointer to const char, pointer to struct in_addr {union {..} S_un}) returning int : "/usr/include/arpa/inet.h", line 52 > "./zftp.pro", line 6: identifier redeclared: inet_pton > current : static function(int, pointer to const char, pointer to void) returning int > previous: function(int, pointer to const char, pointer to void) returning int : "/usr/include/arpa/inet.h", line 54 > O.K. here is patch for zftp.c. After reviewing old thread I decided to not mess up with configure and took Zefram's advice - internally use zsh_* functions that are either #defined or declared. It works on my system that lacks everything except gethostbyname() and on Mandrake 8 with glibc-2.2 that has everything except getipnodebyname() (I believe, it even has IPv6 but not checked) so it should work on most systems. Note, that blanks *are* significant here (there were spaces after /**/ in some places). The patch is against current CVS; I'll commit if nobody complaints that it broke something again. -andrej ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: PATCH: Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-09 19:55 ` PATCH: " Andrej Borsenkow @ 2001-05-09 20:01 ` Andrej Borsenkow 2001-05-10 3:21 ` nce 1 sibling, 0 replies; 12+ messages in thread From: Andrej Borsenkow @ 2001-05-09 20:01 UTC (permalink / raw) To: zsh-users; +Cc: Paul Ackersviller [-- Attachment #1: Type: TEXT/PLAIN, Size: 104 bytes --] On Wed, 9 May 2001, Andrej Borsenkow wrote: > > O.K. here is patch for zftp.c. Really here this time. [-- Attachment #2: Type: TEXT/PLAIN, Size: 4539 bytes --] Index: Src/Modules/zftp.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.c,v retrieving revision 1.11 diff -u -r1.11 zftp.c --- Src/Modules/zftp.c 2001/04/13 16:54:58 1.11 +++ Src/Modules/zftp.c 2001/05/09 19:44:23 @@ -126,12 +126,12 @@ # define INET6_ADDRSTRLEN 46 #endif -/**/ +/**/ #ifndef HAVE_INET_NTOP -/**/ +/**/ static char const * -inet_ntop(int af, void const *cp, char *buf, size_t len) +zsh_inet_ntop(int af, void const *cp, char *buf, size_t len) { if(af != AF_INET) { errno = EAFNOSUPPORT; @@ -144,8 +144,12 @@ strcpy(buf, inet_ntoa(*(struct in_addr *)cp)); return buf; } + +#else /* !HAVE_INET_NTOP */ -/**/ +# define zsh_inet_ntop inet_ntop + +/**/ #endif /* !HAVE_INET_NTOP */ /**/ @@ -159,38 +163,68 @@ # endif /**/ -static int inet_aton(char const *src, struct in_addr *dst) +static int zsh_inet_aton(char const *src, struct in_addr *dst) { return (dst->s_addr = inet_addr(src)) != INADDR_NONE; } +#else /* !HAVE_INET_ATON */ + +# define zsh_inet_aton inet_aton + /**/ # endif /* !HAVE_INET_ATON */ /**/ static int -inet_pton(int af, char const *src, void *dst) +zsh_inet_pton(int af, char const *src, void *dst) { if(af != AF_INET) { errno = EAFNOSUPPORT; return -1; } - return !!inet_aton(src, dst); + return !!zsh_inet_aton(src, dst); } +#else /* !HAVE_INET_PTON */ + +# define zsh_inet_pton inet_pton + /**/ #endif /* !HAVE_INET_PTON */ /**/ #ifndef HAVE_GETIPNODEBYNAME +/**/ +# ifndef HAVE_GETHOSTBYNAME2 + +/**/ +static struct hostent * +zsh_gethostbyname2(char const *name, int af) +{ + if(af != AF_INET) { + h_errno = NO_RECOVERY; + return NULL; + } + return gethostbyname(name); +} + +#else /* !HAVE_GETHOSTBYNAME2 */ + +# define zsh_gethostbyname2 gethostbyname2 + +/**/ +# endif /* !HAVE_GETHOSTBYNAME2 */ + + /* note: this is not a complete implementation. If ignores the flags, and does not provide the memory allocation of the standard interface. Each returned structure will overwrite the previous one. */ /**/ static struct hostent * -getipnodebyname(char const *name, int af, int flags, int *errorp) +zsh_getipnodebyname(char const *name, int af, int flags, int *errorp) { static struct hostent ahe; static char nbuf[16]; @@ -201,8 +235,8 @@ static char pbuf[INET_ADDRSTRLEN]; # endif struct hostent *he; - if(inet_pton(af, name, nbuf) == 1) { - inet_ntop(af, nbuf, pbuf, sizeof(pbuf)); + if(zsh_inet_pton(af, name, nbuf) == 1) { + zsh_inet_ntop(af, nbuf, pbuf, sizeof(pbuf)); ahe.h_name = pbuf; ahe.h_aliases = addrlist+1; ahe.h_addrtype = af; @@ -210,35 +244,21 @@ ahe.h_addr_list = addrlist; return &ahe; } - he = gethostbyname2(name, af); + he = zsh_gethostbyname2(name, af); if(!he) *errorp = h_errno; return he; } - /**/ -# ifndef HAVE_GETHOSTBYNAME2 - -/**/ -struct hostent * -gethostbyname2(char const *name, int af) -{ - if(af != AF_INET) { - h_errno = NO_RECOVERY; - return NULL; - } - return gethostbyname(name); -} - -/**/ -# endif /* !HAVE_GETHOSTBYNAME2 */ - -/**/ static void freehostent(struct hostent *ptr) { } +#else /* !HAVE_GETIPNODEBYNAME */ + +# define zsh_getipnodebyname getipnodebyname + /**/ #endif /* !HAVE_GETIPNODEBYNAME */ @@ -1171,7 +1191,7 @@ if(zdsockp->a.sa_family == AF_INET6) { /* see RFC 2428 for explanation */ strcpy(portcmd, "EPRT |2|"); - inet_ntop(AF_INET6, &zdsockp->in6.sin6_addr, + zsh_inet_ntop(AF_INET6, &zdsockp->in6.sin6_addr, portcmd+8, INET6_ADDRSTRLEN); sprintf(strchr(portcmd, 0), "|%u|\r\n", (unsigned)ntohs(zdsockp->in6.sin6_port)); @@ -1917,7 +1937,7 @@ # define FAILED() do { } while(0) #endif { - zhostp = getipnodebyname(args[0], af, 0, &herrno); + zhostp = zsh_getipnodebyname(args[0], af, 0, &herrno); if (!zhostp || errflag) { /* should use herror() here if available, but maybe * needs configure test. on AIX it's present but not @@ -1999,7 +2019,7 @@ char pbuf[INET_ADDRSTRLEN]; #endif addrp--; - inet_ntop(af, *addrp, pbuf, sizeof(pbuf)); + zsh_inet_ntop(af, *addrp, pbuf, sizeof(pbuf)); zfsetparam("ZFTP_IP", ztrdup(pbuf), ZFPM_READONLY); } freehostent(zhostp); ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: PATCH: Re: inet_{a,p}ton prototypes in Src/Modules/zftp.pro 2001-05-09 19:55 ` PATCH: " Andrej Borsenkow 2001-05-09 20:01 ` Andrej Borsenkow @ 2001-05-10 3:21 ` nce 1 sibling, 0 replies; 12+ messages in thread From: nce @ 2001-05-10 3:21 UTC (permalink / raw) To: Andrej Borsenkow; +Cc: zsh-users Thanks Andrej, it works for me now. -- Paul Ackersviller On Wed, May 09, 2001 at 11:55:15PM +0400, Andrej Borsenkow wrote: > > O.K. here is patch for zftp.c. After reviewing old thread I decided to not > mess up with configure and took Zefram's advice - internally use zsh_* > functions that are either #defined or declared. It works on my system that > lacks everything except gethostbyname() and on Mandrake 8 with glibc-2.2 > that has everything except getipnodebyname() (I believe, it even has IPv6 > but not checked) so it should work on most systems. > > The patch is against current CVS; I'll commit if nobody complaints that it > broke something again. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2001-05-10 3:22 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-05-06 17:45 inet_{a,p}ton prototypes in Src/Modules/zftp.pro Paul Ackersviller 2001-05-07 0:03 ` Bart Schaefer 2001-05-07 1:27 ` nce 2001-05-07 14:56 ` Bart Schaefer 2001-05-07 19:12 ` Kenneth Lareau 2001-05-08 4:12 ` nce 2001-05-08 12:53 ` Andrej Borsenkow 2001-05-09 1:42 ` nce 2001-05-08 14:37 ` Andrej Borsenkow 2001-05-09 19:55 ` PATCH: " Andrej Borsenkow 2001-05-09 20:01 ` Andrej Borsenkow 2001-05-10 3:21 ` nce
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).