alexshendi has joined #picolisp
alexshe27 has joined #picolisp
seninha has quit [Quit: Leaving]
alexshendi has quit [Read error: Connection reset by peer]
alexshe27 has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Quit: -a- IRC for Android 2.1.60]
_whitelogger has joined #picolisp
msavoritias has joined #picolisp
viaken has quit [Ping timeout: 264 seconds]
viaken has joined #picolisp
ello has joined #picolisp
rob_w has joined #picolisp
<
tankf33der>
morning
<
tankf33der>
minimum current problem in host is host returns "ya.ru" on input "ya.ru"
<
tankf33der>
should be addresses.
<
tankf33der>
i have correct c code for this.
<
tankf33der>
fighting for net.l
<
tankf33der>
(host "pb1n.de") should return both ipv4 and ipv6, right?
<
abu[7]>
Yes, as aw- suggested
<
abu[7]>
A cons pair
<
abu[7]>
Kind of ugly
<
abu[7]>
Better a Flg argument to select IPv6?
<
tankf33der>
what if three addresses ?
<
abu[7]>
hmm, ok, then it must be a list
<
tankf33der>
i have a full working code
<
tankf33der>
both name->ip and ip->name in one function (host ...)
<
tankf33der>
last problem how to select what direction?
<
tankf33der>
non NIL flag ?
<
abu[7]>
Can we postpone this till later? I have meetings today.
rick42_ has joined #picolisp
rick42 has quit [Ping timeout: 245 seconds]
rick42 has joined #picolisp
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
<
abu[7]>
tankf33der: So code sharing inside 'host' makes sense?
<
tankf33der>
I will show full function first
<
tankf33der>
# (host 'any 'flg) -> lst
<
tankf33der>
(de host (Node Flg)
<
tankf33der>
(use Lst
tankf33der has quit [Excess Flood]
tankf33der has joined #picolisp
<
tankf33der>
oops, wrong paste
<
tankf33der>
i should tell what change to what to save time
<
abu[7]>
I see, most code is shared
<
abu[7]>
Most of all NI_NUMERICHOST instead of NI_NAMEREQD
<
tankf33der>
and additional 0 to getnameinfo argument list
<
tankf33der>
and hints to getaddrinfo important
<
abu[7]>
yeah, the struct for "getaddrinfo"
<
abu[7]>
But it
*always* returns a list?
<
abu[7]>
It breaks existing code then
<
tankf33der>
as discussed for today
<
tankf33der>
this is draft working version, you could modify it
<
abu[7]>
I thought the Fld distinguishes between the return types
<
abu[7]>
Also, should (%@ "getnameinfo" 'I ...) be checked for zero?
<
abu[7]>
Hmm, I think two separate funs are better
<
tankf33der>
second function will be for what ?
<
abu[7]>
If (host "sym") gives the old name, and ((host "sym" T) the new list, the code is quite separate
<
abu[7]>
list of IPs
<
tankf33der>
in my code second argument is for reverse lookup
<
abu[7]>
In both cases two calls, "getaddrinfo" and "getnameinfo", but quite different
<
abu[7]>
But always 'make's
<
abu[7]>
I use host to find domain names, this code would break
<
tankf33der>
anyway host is broken now, and should be fixed.
<
abu[7]>
Why broken?
<
abu[7]>
It gives the hostname
<
abu[7]>
*not* the IPs
<
abu[7]>
It has nothing to do with the Unix 'host' command
<
abu[7]>
Just the same name by chance
<
tankf33der>
it is broken because you miss one argument to getnameinfo
<
tankf33der>
must be 0 0
<
tankf33der>
and host will return one IP address on (host "pb1n.de") call
<
abu[7]>
Your version gives two times the same, is that good?
<
abu[7]>
: (host "pb1n.de") -> ("pb1n.de" "pb1n.de")
<
abu[7]>
For 7fach, the current one gives
<
abu[7]>
: (host "176.221.46.93") -> "j336212.servers.jiffybox.net"
<
abu[7]>
the new one
<
abu[7]>
-> ("j336212.servers.jiffybox.net")
<
abu[7]>
hmm, how useful is all that?
<
abu[7]>
I use (host) to quickly find an domain name
<
abu[7]>
It all depends on the use case
<
abu[7]>
I think there is no generally useful function
<
abu[7]>
Should I better remove (host) from the distro, and I keep it locally for my own purpose?
<
tankf33der>
12:57 <abu[7]> Your version gives two times the same, is that good?
<
tankf33der>
12:57 <abu[7]> : (host "pb1n.de") -> ("pb1n.de" "pb1n.de")
<
tankf33der>
my version returns two ips
<
abu[7]>
I tested with your pasted code
<
abu[7]>
Sorry, must go
<
abu[7]>
Let's see later!
seninha has quit [Quit: Leaving]
rob_w has quit [Remote host closed the connection]
<
abu[7]>
Hmm, perhaps my test is wrong, I ran your 'host' in "pil +" but withot (sysdefs "networking") etc.
<
abu[7]>
No, still the same
<
abu[7]>
: NI_NUMERICHOST -> NIL
<
abu[7]>
Needs to be defined first
<
abu[7]>
Did you extend sysdefs?
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
<
tankf33der>
i wrote about it above
<
abu[7]>
I can't find
<
abu[7]>
Anyway, I don't know what we should do
<
abu[7]>
A separate function is better perhaps
<
tankf33der>
in my world (host "pb1n.de") should return IP, (host "127.0.0.1") should return name
<
abu[7]>
or (host "80.190.158.9") -> "
www.leo.org" is the old, and (host "somethng" T) is the new
<
tankf33der>
compatibility is better
<
abu[7]>
But we have many variations
<
abu[7]>
return the first only, or a list
<
abu[7]>
in all these cases
<
abu[7]>
I think it is overkill for the base system
<
tankf33der>
first only is ok, IMHO now
<
abu[7]>
also needs to be documented ;)
<
abu[7]>
Strange, the old version already seems to do that
<
abu[7]>
: (host "80.190.158.9")
<
abu[7]>
-> "172.67.30.82"
<
abu[7]>
It is all a mess
<
abu[7]>
Is the built-in one even correct?
<
abu[7]>
IP-addr -> name ?
<
tankf33der>
compare arguments of getnameinfo
<
tankf33der>
you forgot one 0
<
tankf33der>
must be 0 0
<
abu[7]>
I check the man page
<
abu[7]>
yes, not enough args
<
tankf33der>
it worked accidentally
<
tankf33der>
this is minimum to fix.
<
abu[7]>
I don't understand my code :)
<
abu[7]>
is "char serv[_Nullable restrict .servlen]," missing?
<
tankf33der>
not needed
<
abu[7]>
plus "socklen_t servlen,"
<
abu[7]>
both zero?
<
tankf33der>
both zero
<
tankf33der>
not used, both zero
<
abu[7]>
So we get:
<
abu[7]>
NI_MAXHOST
<
abu[7]>
NI_NAMEREQD ) )
<
tankf33der>
right.
<
abu[7]>
OK, I fix this first
<
abu[7]>
I wonder if it was correct in pil64
<
tankf33der>
this is C code to play with
<
abu[7]>
in pil32 it was correct
<
abu[7]>
so probably also in pil64
<
abu[7]>
Thanks for finding the bug!
<
tankf33der>
Welcome! o/
<
abu[7]>
Busy again. bbl
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
clacke has joined #picolisp
msavoritias has quit [Remote host closed the connection]