Hi Eial ! > > You are not right. It is not the same behavior! > what is the difference then?
Thats what we are talking about ! On one hand, simple IP lookup using libc function (gethostbyname), on the other hand, full DNS query (like host command). > > You can find the IP address of a name with less code, correct, but > > this uses the libc implementation of the resolver and does not the > > same kind of work a DNS client does. So the decision is first, > > which kind of work you need -> In your case: Simple IP address > > lookup with libc function. > are you talking about dnsip? dnsip is an example of a full DNS query program like the host command from bind. My explanation decision was more general, not specific to an implementation. > > In case you would need a full fledged DNS query (seperate from libc > > implementation), Laurent would be right. I don't think you are able > > to write a full DNS query with less code. > so both ping and nslookup have full fledged DNS query? ping ? Does ping use/need a full dns query? As far as I know does ping only use simple ip lookup, and then send out network packages to those addresses (ICMP or UDP) nslookup, I ought yes, it shall do a full dns query (bypassing libc implementation). ... but I have not looked into current code. > > So please keep in mind: Things tend to look different if viewed > > from a more global point, and you need to use the correct language > > to describe your problem, otherwise anybody will misunderstand > > something and complain or point you in a wrong direction. > I've done that very clear, but still I'll retry: You mixed up two different things. Simple IP lookup (what seams to be the right thing for you), and the host command (implementing it for Busybox) on the other side. The host command IS NOT simple IP lookup, it is full DNS query. IMO that was your mixture, leading to lengthy discussion. The complaining was due to using the name 'host' for an applet which just does simple IP lookup, as that name is the name of a full DNS query command ... and mixing those would confuse others. So a 'getent hosts' applet seams to be the right thing for your job ... if it is included in Busybox. IMO a good idea due to general usability / function of getent for scripting purposes, but not my decision. > I have two system, on each I need to run a script which queries me > for a hostname, that hostname needs to be converted to ip, what > applet should I use that will give me the ip without the need for > output parsing? Currently there is none in Busybox (without parsing of output). I'm using a slightly patched version of ipcalc applet to do the job of gethostbyname :-) ... have posted a patch for this about two years ago, but it has not bean accepted. > > Beside this, Busybox has nslookup. What is wrong with that? Only > > different output format? In case you complain because the many > > information it displays: What about an option for nslookup, lets > > say -s (for short) to display only single line of output (if only > > one address returned from query)? Just as an unverified idea. What > > about this? > as said before, I have two distinct systems in which nslookup gives > two distinct outputs. that is why nslookup isn't good. Please post example of different output, including version of Busybox of the two systems. Let as see why output is different. > maybe adding -S switch for nslookup is a good idea but that is not > what I've intended to begin with. It was just an idea of a way we could go, in case you want a full DNS query (not only simple IP lookup). Harald _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox