]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/sockhelp.cpp
Added a couple new directives to the config file
[irc/gameservirc.git] / gameserv / sockhelp.cpp
index 25cfcb5a21ea279334cd1c9864aa67fc42519377..1536767efd1706cfa3e785a407281e63a440107b 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include "sockhelp.h"
+#include "extern.h"
 
 /* Take a service name, and a service type, and return a port number.  If 
 the
@@ -22,19 +23,14 @@ int atoport(char *service, char *proto)
 {
   int port;
   long int lport;
-  struct servent *serv;
   char *errpos;
 
-  /* First try to read it from /etc/services */
-  serv = getservbyname(service, proto);
-  if (serv != NULL)
-    port = serv->s_port;
-  else { /* Not in services, maybe a number? */
     lport = strtol(service,&errpos,0);
     if ( (errpos[0] != 0) || (lport < 1) || (lport > 65535) )
       return -1; /* Invalid port address */
+
     port = htons(lport);
-  }
+
   return port;
 }
 
@@ -191,7 +187,7 @@ int make_connection(char *service, int type, char *netaddress)
 
   sock = socket(AF_INET, type, 0);
 
-  printf("Connecting to %s on port %d.\n",inet_ntoa(*addr),htons(port));
+  log("Connecting to %s on port %d.",inet_ntoa(*addr),htons(port));
 
   if (type == SOCK_STREAM) {
     connected = connect(sock, (struct sockaddr *) &address,