From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <365a3b8e0ce821506adb926ac1001503@plan9.jp> To: 9fans@cse.psu.edu Subject: Re: [9fans] csipinfo From: Joel “chesky” Salomon Date: Wed, 18 Oct 2006 15:38:56 -0400 In-Reply-To: <08660eafbf4cef501efcf7a33fe5d3d2@vitanuova.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: ccee3bb6-ead1-11e9-9d60-3106f5b1d025 > > Thanks, this finally looks like what I need. >=20 > it won't work. something like the code i posted is needed. I=E2=80=99m trying to read the limbo code and translate it to my needs; b= ear with me as I translate this to c-ish pseudocode: char* gethostbyaddr(char *net, char *addr) { char buf[1024], *dq[4], s; int fd, l; if(net =3D=3D nil) net =3D "/net"; snprint(buf, sizeof buf, "%s/dns", net); if((fd =3D open(buf, ORDWR)) < 0) return nil; // set errstr "gethostbyaddr failed: can't open %s: %r", b= uf) dq[0] =3D strtok(addr, "."); // neglecting error checking dq[1] =3D strtok(0, "."); dq[2] =3D strtok(0, "."); dq[3] =3D strtok(0, = "."); snprint(buf, sizeof buf, "%s.%s.%s.%s.in-addr.arpa ptr", dq[3], dq[2], dq[1], dq[0]); if(write(fd, buf, l) !=3D l) return nil; // close fd & set errstr if(read(fd, buf, sizeof buf) < 0) return nil; s =3D strstr(buf, " ptr "); return(strdup(s+5)); } Well, it=E2=80=99s less pseudocode than a rough draft. If it passes rog=E2= =80=99s sanity check I=E2=80=99ll add better error checking and submit it= for inclusion somewhere=E2=80=94someone, somewhere, has got to want this= . --Joel