DNS

Posted by USER007 on Fri 10 Dec 2004 12:31 AM — 7 posts, 25,471 views.

#0
I installed the dns snippet, but I get these compiling errors:

Compiling o/comm.o....
comm.c: In function `new_descriptor':
comm.c:787: warning: unused variable `from'
comm.c: In function `close_socket':
comm.c:953: warning: implicit declaration of function `waitpid'
Compiling o/comments.o....

    struct sockaddr_in sock;
    struct hostent *from; <--- 787
    int desc;

        kill( dclose->ipid, SIGKILL );
	waitpid( dclose->ipid, &status, 0 ); <--- 953


Any thoughts?

SmaugFUSS /XP/SP2
Amended on Fri 10 Dec 2004 12:39 AM by USER007
Australia Forum Administrator #1
Looks like you need:

#include <netdb.h>

Try "man gethostbyname".
#2
The file has #include <netdb.h> in it. As for the "man gethostbyname" you lost me.
Canada #3
What Nick means is to use the manual pages that are commonly available through any *nix shell. In this case, just type in:

man gethostbyname

This will give you very specific details on the system function called gethostname, as well as giving any dependancies that are needed, like the include file.

As for your waitpid warming, checking "man waitpid", it say that you need:

#include <sys/types.h>
#include <sys/wait.h>

Make sure you have both of those in your include file.
Amended on Fri 10 Dec 2004 01:24 AM by Greven
USA #4
Also, you didn't get errors, you got warnings. One of your warnings happens to be harmless (the unused one) and the implicit declaration might not matter, even if it's better not to have it. Did you get linker errors?
#5
The manuals didn't work, but I got both of the "warnings" fixed. :) I was missing the #include <sys/wait.h> in the file. As for the "from", it wasn't being used so I commented it out. Thanks for the help.
Australia Forum Administrator #6
I tried Google "man gethostbyname" - the first page that appeared was an example of that manual page.