hello,
Here i solve this error used #include <stdio.h> and #include <errno.h> even though gettin this problem.
error: previous declaration of ‘sys_errlist’ was here
what i did mistake here and what is the answer.
Code:
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#include <rpcsvc/yp_prot.h>
#include <rpcsvc/ypclnt.h>
#include <signal.h>
#include <setjmp.h>
/* xxx: these are sometimes defined by .h files as below for getopt. I'll
fix it later... */
extern int errno;
#ifndef BSD4_4
extern char *sys_errlist[];
#endif
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif
Code:
if (!Single)
if ((rc < 0) && (scan_type == s_tcp) && (errno == ECONNREFUSED))
continue;
if ((rc < 0) && (scan_type == s_udp))
continue;
if (scan_type == s_tcp)
serv = getservbyport(htons(port),"tcp");
else if (scan_type == s_udp) {
serv = getservbyport(htons(port),"udp");
rc = 0; /* fake out below msg */
}
else
return;
fprintf(stdout,"port %d (%s) %s\n", port,
(serv == NULL)?"UNKNOWN": serv->s_name,
(rc == 0) ? "open" : sys_errlist[errno]);
fflush (stdout);
}
}