Re: Replace gethostbyname with getaddrinfo

Mike Aubury <[email protected]> Wed, 16 Aug 2023 13:51:47 +0100
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAGAq4WFTkFvDzi2Q+-18ohZbnd0icxUYw8vKN9HR67zskkZ_rQ@mail.gmail.com>
--===============0477327982836764974==
Content-Type: multipart/alternative; boundary="000000000000d73944060309c2c8"

--000000000000d73944060309c2c8
Content-Type: text/plain; charset="UTF-8"

That seems to work, so I've applied it and committed to SVN.

On Tue, 8 Aug 2023 at 13:25, Benson Muite <[email protected]>
wrote:

> Sorry, should be s_addr
>
> Should I create a separate branch in subversion?
>
> On 7/30/23 14:06, Mike Aubury wrote:
> > Fails to compile for me :
> >
> > gmake[4]: Entering directory
> >
> '/home/aubit4gl/svn/aubit4gl-aubit4gl_code/aubit4glsrc/trunk/lib/libui/ui_xml/uilib'
> > gcc  -Wall -Wredundant-decls -Wmissing-declarations -Wmissing-prototypes
> > -Wstrict-prototypes -g -g  -fPIC -DPIC -DSRC_TREE -DDEBUG
> > -DHAVE_CONFIG_H= -I/home/aubit4gl/aubit4glsrc/incl
> > -I/home/aubit4gl/aubit4glsrc  -fPIC -DPIC -I../../../../lib/libui/ui_xml
> > -I../../../../lib/libui/ui_xml/uilib
> > -I../../../../lib/libui/ui_xml/uilib/aubit4gl -Wall -Ixml   -c -o
> > comms.o comms.c
> > comms.c: In function 'atoaddr':
> > comms.c:117:35: error: 'struct in_addr' has no member named 'sin_addr'
> >        struct in_addr *addr = &(ipv->sin_addr);
> >                                    ^
> > comms.c:101:33: warning: unused variable 'p' [-Wunused-variable]
> >    struct addrinfo hints, *res, *p;
> >
> >
> >
> > (i'm running a fairly old version of ubuntu)
> >
> > On Thu, 27 Jul 2023 at 17:24, Benson Muite <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     On 7/13/23 16:48, Benson Muite wrote:
> >     > On 7/13/23 16:37, Mike Aubury wrote:
> >     >> If you can do a patch, I'd be happy to apply it - I dont think
> those
> >     >> functions will be called by the vast majority of users.
> >     >>
> >     > Will send a patch
> >     Initial patch is attached based on release 1.6.1
> >
> >     It requests ipv4 addresses, though one can later update to using both
> >     ipv4 and ipv6 addresses
> >     >> If you want - I can give you developer access and you can update
> >     >> whatever you want :)
> >     >>
> >     > Thanks. May need to review my changes though.
> >     >> On Thu, 13 Jul 2023 at 14:21, Benson Muite
> >     <[email protected] <mailto:[email protected]>
> >     >> <mailto:[email protected]
> >     <mailto:[email protected]>>> wrote:
> >     >>
> >     >>     The files:
> >     >>     lib/libaubit4gl/gui.c
> >     >>     lib/libui/ui_json/uilib/comms.c
> >     >>     lib/libui/ui_xml/uilib/comms.c
> >     >>     lib/libui/ui_highlevel/remote_client/pipeclient.c
> >     >>
> >     >>     contain gethostbyname, would it be possible to replace this
> with
> >     >>     getaddrinfo?
> >     >>
> >     >>     Configure script will also need to be updated accordingly.
> >     Can send a
> >     >>     patch with a possible implementation if it would be
> considered.
> >     >>
> >     >>
> >     _______________________________________________
> >     Aubit4gl-discuss mailing list
> >     [email protected]
> >     <mailto:[email protected]>
> >     https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
> >     <https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss>
> >
> _______________________________________________
> Aubit4gl-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
>

--000000000000d73944060309c2c8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">That seems to work, so I&#39;ve applied it and committed=
=C2=A0to SVN.</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D=
"gmail_attr">On Tue, 8 Aug 2023 at 13:25, Benson Muite &lt;<a href=3D"mailt=
o:[email protected]">[email protected]</a>&gt; wrote:<br>=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left:1px solid rgb(204,204,204);padding-left:1ex">Sorry, should be s_=
addr<br>
<br>
Should I create a separate branch in subversion?<br>
<br>
On 7/30/23 14:06, Mike Aubury wrote:<br>
&gt; Fails to compile for me :=C2=A0<br>
&gt; <br>
&gt; gmake[4]: Entering directory<br>
&gt; &#39;/home/aubit4gl/svn/aubit4gl-aubit4gl_code/aubit4glsrc/trunk/lib/l=
ibui/ui_xml/uilib&#39;<br>
&gt; gcc =C2=A0-Wall -Wredundant-decls -Wmissing-declarations -Wmissing-pro=
totypes<br>
&gt; -Wstrict-prototypes -g -g =C2=A0-fPIC -DPIC -DSRC_TREE -DDEBUG<br>
&gt; -DHAVE_CONFIG_H=3D -I/home/aubit4gl/aubit4glsrc/incl<br>
&gt; -I/home/aubit4gl/aubit4glsrc =C2=A0-fPIC -DPIC -I../../../../lib/libui=
/ui_xml<br>
&gt; -I../../../../lib/libui/ui_xml/uilib<br>
&gt; -I../../../../lib/libui/ui_xml/uilib/aubit4gl -Wall -Ixml =C2=A0 -c -o=
<br>
&gt; comms.o comms.c<br>
&gt; comms.c: In function &#39;atoaddr&#39;:<br>
&gt; comms.c:117:35: error: &#39;struct in_addr&#39; has no member named &#=
39;sin_addr&#39;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0struct in_addr *addr =3D &amp;(ipv-&gt;sin_=
addr);<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>
&gt; comms.c:101:33: warning: unused variable &#39;p&#39; [-Wunused-variabl=
e]<br>
&gt; =C2=A0 =C2=A0struct addrinfo hints, *res, *p;<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; (i&#39;m running a fairly old version of ubuntu)<br>
&gt; <br>
&gt; On Thu, 27 Jul 2023 at 17:24, Benson Muite &lt;<a href=3D"mailto:benso=
[email protected]" target=3D"_blank">[email protected]</a><br>
&gt; &lt;mailto:<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 7/13/23 16:48, Benson Muite wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt; On 7/13/23 16:37, Mike Aubury wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt; If you can do a patch, I&#39;d be happy to=
 apply it - I dont think those<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt; functions will be called by the vast major=
ity of users.<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt; Will send a patch<br>
&gt;=C2=A0 =C2=A0 =C2=A0Initial patch is attached based on release 1.6.1<br=
>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0It requests ipv4 addresses, though one can later up=
date to using both<br>
&gt;=C2=A0 =C2=A0 =C2=A0ipv4 and ipv6 addresses<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt; If you want - I can give you developer acc=
ess and you can update<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt; whatever you want :)<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt; Thanks. May need to review my changes though.<=
br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt; On Thu, 13 Jul 2023 at 14:21, Benson Muite=
<br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"mailto:[email protected]" t=
arget=3D"_blank">[email protected]</a> &lt;mailto:<a href=3D"mailt=
o:[email protected]" target=3D"_blank">[email protected]<=
/a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt; &lt;mailto:<a href=3D"mailto:benson_muite@=
emailplus.org" target=3D"_blank">[email protected]</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:benson_muite@emailplus=
.org" target=3D"_blank">[email protected]</a>&gt;&gt;&gt; wrote:<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0The files:<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0lib/libaubit4gl/gui.c<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0lib/libui/ui_json/uilib=
/comms.c<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0lib/libui/ui_xml/uilib/=
comms.c<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0lib/libui/ui_highlevel/=
remote_client/pipeclient.c<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0contain gethostbyname, =
would it be possible to replace this with<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0getaddrinfo?<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0Configure script will a=
lso need to be updated accordingly.=C2=A0<br>
&gt;=C2=A0 =C2=A0 =C2=A0Can send a<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;=C2=A0 =C2=A0 =C2=A0patch with a possible i=
mplementation if it would be considered.<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0_______________________________________________<br>
&gt;=C2=A0 =C2=A0 =C2=A0Aubit4gl-discuss mailing list<br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"mailto:[email protected]=
e.net" target=3D"_blank">[email protected]</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:Aubit4gl-discuss@lists=
.sourceforge.net" target=3D"_blank">[email protected]<=
/a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"https://lists.sourceforge.net/lists/list=
info/aubit4gl-discuss" rel=3D"noreferrer" target=3D"_blank">https://lists.s=
ourceforge.net/lists/listinfo/aubit4gl-discuss</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://lists.sourceforge.net/lists/=
listinfo/aubit4gl-discuss" rel=3D"noreferrer" target=3D"_blank">https://lis=
ts.sourceforge.net/lists/listinfo/aubit4gl-discuss</a>&gt;<br>
&gt; <br>
_______________________________________________<br>
Aubit4gl-discuss mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank"=
>[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss" r=
el=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/lis=
tinfo/aubit4gl-discuss</a><br>
</blockquote></div>

--000000000000d73944060309c2c8--


--===============0477327982836764974==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============0477327982836764974==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss

--===============0477327982836764974==--