Update of /cvsroot/netrek/server/Vanilla/ntserv
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26988/ntserv

Modified Files:
	db.c findslot.c genspkt.c getname.c openmem.c phaser.c 
	rsa_key.c socket.c solicit.c startrobot.c sysdefaults.c 
Log Message:
compilation fixes for /ntserv under gcc 4.0.3

Index: sysdefaults.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/sysdefaults.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sysdefaults.c	26 Apr 2006 09:52:43 -0000	1.2
+++ sysdefaults.c	6 May 2006 14:02:39 -0000	1.3
@@ -2,6 +2,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include "defs.h"
 #include "struct.h"

Index: rsa_key.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/rsa_key.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rsa_key.c	22 Apr 2006 02:16:46 -0000	1.2
+++ rsa_key.c	6 May 2006 14:02:38 -0000	1.3
@@ -8,6 +8,11 @@
 #include "copyright2.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -20,10 +25,15 @@
 #include "struct.h"
 #include "data.h"
 #include "packets.h"
+#include "proto.h"
 
-makeRSAPacket(packet)
-struct rsa_key_spacket *packet;
+/* from res-rsa/rsa_encode.c */
+void rsa_encode(unsigned char *out, unsigned char *message,
+                unsigned char *key, unsigned char *global, const int digits);
+
+void makeRSAPacket(void *p)
 {
+    struct rsa_key_spacket *packet = (struct rsa_key_spacket *) p;
     int i;
 
     for (i=0; i<KEY_SIZE; i++)
@@ -35,11 +45,12 @@
 }
 
 /* returns 1 if the user verifies incorrectly */
-decryptRSAPacket(spacket, cpacket, serverName)
-struct rsa_key_spacket *spacket;
-struct rsa_key_cpacket *cpacket;
-char *serverName;
+int decryptRSAPacket (void *s,
+		      void *c,
+		      char *serverName)
 {
+    struct rsa_key_spacket *spacket = (struct rsa_key_spacket *) s;
+    struct rsa_key_cpacket *cpacket = (struct rsa_key_cpacket *) c;
     struct rsa_key key;
     struct sockaddr_in saddr;
     socklen_t addrlen;
@@ -49,9 +60,8 @@
 #endif
     int fd;
     FILE *logfile;
-    int done, found, curtime;
-    int foo;
-    int total;
+    int done, found;
+    time_t curtime;
 
 /*    SIGNAL(SIGALRM, SIG_IGN);*/
 
@@ -136,7 +146,7 @@
 #ifdef FEATURE_PACKETS
     if (!F_client_feature_packets)
 #endif
-      TellClient(key.client_type); /* 6/12/93 LAB */
+      TellClient((char *) key.client_type); /* 6/12/93 LAB */
 #endif
 
     return 0;

Index: getname.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/getname.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- getname.c	21 Mar 2005 10:17:17 -0000	1.2
+++ getname.c	6 May 2006 14:02:37 -0000	1.3
@@ -51,10 +51,8 @@
 {
     static struct statentry player;
     static int position= -1;
-    int plfd;
     int i;
     int entries;
-    off_t file_pos;
     saltbuf sb;
     char newpass[NAME_LEN];
 
@@ -71,10 +69,9 @@
     ERROR(8,("handleLogin: %s %s %s\n", 
 	     passPick[15] == 0 ? "attempt" : "query", namePick, passPick));
 
-    if (streq(namePick, "Guest") || streq(namePick, "guest") &&
+    if ((streq(namePick, "Guest") || streq(namePick, "guest")) &&
 	!lockout()) {
 
-    handlelogin_guest:
         /* all INL games prohibit guest login */
         if (status->gameup & GU_INROBOT) {
 	  sendClientLogin(NULL);
@@ -181,7 +178,7 @@
 	/* race condition: Two new players joining at once
 	 * can screw up the database.
 	 */
-	if (entries = newplayer(&player) < 0) {
+	if ((entries = newplayer(&player)) < 0) {
 	  sendClientLogin(NULL);
 	} else {
 	  me->p_pos = entries;

Index: phaser.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/phaser.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- phaser.c	24 Apr 2006 10:12:18 -0000	1.3
+++ phaser.c	6 May 2006 14:02:37 -0000	1.4
@@ -20,8 +20,8 @@
 
 void phaser(u_char course)
 {
-  struct player *j, *target_player;
-  struct torp *t, *target_plasma;
+  struct player *j, *target_player = NULL;
+  struct torp *t, *target_plasma = NULL;
   int pstatus;
   double s, C,D;
   LONG A,B, E,F;

Index: db.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/db.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- db.c	6 May 2006 12:06:39 -0000	1.2
+++ db.c	6 May 2006 14:02:37 -0000	1.3
@@ -7,20 +7,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
-#define _XOPEN_SOURCE
-#include <unistd.h>
-#include INC_MATH
-#include <signal.h>
 #include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
 #include <time.h>
 #include <fcntl.h>
 #ifdef PLAYER_INDEX
 #include <gdbm.h>
 #endif
 #include "defs.h"
-#include INC_STRINGS
 #include INC_UNISTD
 #include "struct.h"
 #include "data.h"
@@ -213,6 +206,7 @@
 {
   saltbuf sb;
   struct statentry se;
+  /* implicitly defined on linux, anyone know where to find it? */
   strcpy(se.password, (char *) crypt(passPick, salt(me->p_name, sb)));
   savepass(&se);
 }

Index: findslot.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/findslot.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- findslot.c	22 Apr 2006 02:16:46 -0000	1.4
+++ findslot.c	6 May 2006 14:02:37 -0000	1.5
@@ -14,11 +14,13 @@
 #include "defs.h"
 #include "struct.h"
 #include "data.h"
+#include "packets.h"
 #include "proto.h"
 
+#ifdef NO_DUPLICATE_HOSTS
 /* return true if the host is not already in the game */
 static int absent(int w_queue, char *host) {
-  int i, here = 0;
+  int i;
   for (i=0; i<MAXPLAYER; i++) {
     if (players[i].p_status == PFREE) continue;
     if ((players[i].p_flags & PFROBOT)) continue;
@@ -30,6 +32,7 @@
   }
   return 1;
 }
+#endif
 
 /*
  * The following code for findslot() is really nice.

Index: openmem.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/openmem.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- openmem.c	24 Apr 2006 12:35:17 -0000	1.3
+++ openmem.c	6 May 2006 14:02:37 -0000	1.4
@@ -59,7 +59,7 @@
 
     i = fork();
     if (i == (pid_t)0) {
-	execl(Daemon, "daemon", 0);
+	execl(Daemon, "daemon", (char *) NULL);
 	perror(Daemon);
 	ERROR(1,("Couldn't start daemon!!!\n"));
 	_exit(1);

Index: startrobot.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/startrobot.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- startrobot.c	21 Mar 2005 05:23:44 -0000	1.1
+++ startrobot.c	6 May 2006 14:02:39 -0000	1.2
@@ -47,8 +47,10 @@
 	    case ORI:
 		arg1 = "-To";
 		break;
+	    default:
+		arg1 = "-Tf";
 	}
-	execl(Robot, "robot", arg1, "-p", "-f", "-h", 0);
+	execl(Robot, "robot", arg1, "-p", "-f", "-h", (char *) NULL);
 	/* If we get here, we are hosed anyway */
 	_exit(1);
     }

Index: genspkt.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/genspkt.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- genspkt.c	6 May 2006 12:06:39 -0000	1.5
+++ genspkt.c	6 May 2006 14:02:37 -0000	1.6
@@ -2385,8 +2385,9 @@
    update.  The flags sent should be from the end of the update, nominally
    100ms later. */
 void
-addSequenceFlags(struct sequence_spacket *ssp)
+addSequenceFlags(void *buf)
 {
+    struct sequence_spacket *ssp = (struct sequence_spacket *) buf;
     u_int f=0;
 
     /* Doesn't look like a sequence packet */

Index: solicit.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/solicit.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- solicit.c	22 Feb 2006 09:18:30 -0000	1.6
+++ solicit.c	6 May 2006 14:02:39 -0000	1.7
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <time.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/socket.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- socket.c	22 Apr 2006 11:31:53 -0000	1.7
+++ socket.c	6 May 2006 14:02:38 -0000	1.8
@@ -1713,8 +1713,6 @@
 
 static void handleDockingReq(struct dockperm_cpacket *packet)
 {
-    int i;
-
     if (me->p_ship.s_type == STARBASE) {
         if (packet->state) {
             me->p_flags |= PFDOCKOK;
@@ -1876,7 +1874,7 @@
     MCOPY(testdata, mysp.data, RESERVED_SIZE);
     serverName[0] = '\0';
     if (gethostname(serverName, 64))
-	ERROR(1,( "%s: gethostname() failed\n", whoami(), 
+	ERROR(1,( "%s: gethostname() failed with %s", whoami(), 
 		  strerror(errno)));
     encryptReservedPacket(&mysp, &mycp, serverName, me->p_no);
     if (MCMP(packet->resp, mycp.resp, RESERVED_SIZE) != 0) {
@@ -1893,7 +1891,6 @@
 
 static void handleRSAKey(struct rsa_key_cpacket *packet)
 {
-    struct rsa_key_cpacket mycp;
     struct rsa_key_spacket mysp;
     char serverName[64]; 
 
@@ -1903,7 +1900,7 @@
 
     serverName[0] = '\0';
     if (gethostname(serverName, 64))
-	ERROR(1,( "%s: gethostname() failed\n", whoami(), 
+	ERROR(1,( "%s: gethostname() failed with %s\n", whoami(), 
 		  strerror(errno)));
     if (decryptRSAPacket(&mysp, packet, serverName))
     {
@@ -2835,7 +2832,7 @@
 		      (packet->group & MGOD))){
 	    static int counter = 0;
 
-	    if(glog_open() != 0) return;
+	    if(glog_open() != 0) return 0;
 	    glog_printf("%s\n", buf);
 	    glog_flush();
 	    counter++;