A rework of the Vanilla build process was about to be committed, but
SourceForge CVS is down again.  Patch is attached.

The goal of the change is to reduce the cost of adding functions, and to
ease understanding of the code.

I've chosen for the moment not to use a shared library, since doing so
complicates the build process and involves the use of an additional
build dependency (libtool), although it might drop run-time virtual
memory consumption slightly.

- most common code used in ntserv/ is placed in an ar(1) archive
  libnetrek.a,

- binaries are linked against libnetrek.a,

- some binaries that need special compilation (e.g. of
  ntserv/commands.c) still do this.

-- 
James Cameron    mailto:quozl at us.netrek.org     http://quozl.netrek.org/
-------------- next part --------------
? FAQ
? cow.log
? cvs.diff
? libnetrek
? netrek-server-vanilla-2.10.1.tar.gz
? netrek-server-vanilla-2.10.1.tar.gz.md5sum
? netrek-server-vanilla-2.10.2.tar.gz
? netrek-server-vanilla-2.10.2.tar.gz.asc
? netrek-server-vanilla-2.10.2.tar.gz.md5sum
? netrek-server-vanilla-2.10.3.tar.gz
? ntserv.log
? tmp
? tmp.1
? vanilla.netrek.org
? docs/sample_geno_timer_crontab
? docs/sample_sysdef
? gum/.deps
? gum/Makefile
? gum/autom4te.cache
? gum/config.log
? gum/config.status
? newstartd/cow.log
? ntserv/.depend
? ntserv/Makefile
? ntserv/daemonII
? ntserv/glog.c
? ntserv/ntserv
? pledit/.depend
? pledit/Makefile
? pledit/pledit
? res-rsa/.depend
? res-rsa/Makefile
? res-rsa/config.h
? res-rsa/config.log
? res-rsa/config.status
? robotd/Makefile
? robotd/robot
? robotd/robot.log
? robots/.depend
? robots/Makefile
? robots/Makefile.in.libnetrek
? robots/basep
? robots/cvs.diff
? robots/inl
? robots/mars
? robots/newbie
? robots/pret
? robots/puck
? robots/robotII
? robots/tmp
? sequencer/.depend
? sequencer/Makefile
? sequencer/sequencer
? tools/.depend
? tools/Makefile
? tools/ate
? tools/blotpassword
? tools/cambot
? tools/conq_vert
? tools/convert
? tools/fun
? tools/keyman
? tools/loadchecker
? tools/ltd_convert
? tools/ltd_dump
? tools/mergescores
? tools/mess
? tools/message
? tools/metaget
? tools/metalog-plot
? tools/newscores
? tools/ntpasswd
? tools/nuke
? tools/planets
? tools/players
? tools/scores
? tools/setgalaxy
? tools/showgalaxy
? tools/sortdb
? tools/stat
? tools/trekon
? tools/trimscores
? tools/updated
? tools/watchmes
? tools/xtkill
? xsg/.depend
? xsg/Makefile
? xsg/xsg
Index: ChangeLog
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ChangeLog,v
retrieving revision 1.24
diff -u -r1.24 ChangeLog
--- ChangeLog	22 Apr 2006 02:16:42 -0000	1.24
+++ ChangeLog	22 Apr 2006 08:53:24 -0000
@@ -1,3 +1,14 @@
+Sat Apr 22 13:46:49 2006  James Cameron  <quozl at us.netrek.org>
+
+	* glog.c, socket.c, commands.c, gencmds.c: factorise god log
+	access, due to valgrind detected file descriptor left open after
+	exit.
+
+Sat Apr 22 13:01:10 2006  James Cameron  <quozl at us.netrek.org>
+
+	* ntserv/socket.c (clientVersion): remove superfluous NULL
+	termination of string returned by strdup().
+
 Sat Apr 22 12:07:50 2006  James Cameron  <quozl at us.netrek.org>
 
 	* Makefile.in (dist): avoid certain CVS files.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/Makefile.in,v
retrieving revision 1.9
diff -u -r1.9 Makefile.in
--- Makefile.in	22 Apr 2006 02:16:44 -0000	1.9
+++ Makefile.in	22 Apr 2006 08:53:24 -0000
@@ -14,9 +14,17 @@
 
 include $(CONFIG)
 
-.PHONY: rmdependencies clean reallyclean install installbin server utils startup rsa_utils do_xsg do_pledit do_robots do_gum
-
-all: null $(PMAKE) server utils startup rsa_utils do_xsg do_pledit do_robots do_robotd @GUM@
+.PHONY: rmdependencies clean reallyclean install installbin \
+	do_library do_server do_listener do_robots do_robotd \
+	do_utilities do_rsa_utilities do_xsg do_pledit do_gum
+
+all: null $(PMAKE) \
+	do_library do_server do_listener do_robots do_robotd \
+	do_utilities do_rsa_utilities do_xsg do_pledit @GUM@
+
+minimal: null $(PMAKE) \
+	do_library do_server do_listener do_robots do_robotd \
+	do_utilities do_rsa_utilities 
 
 depend: system.mk
 	cd ntserv;    $(MAKE) depend
@@ -46,38 +54,40 @@
 config.h: system.mk
 	touch config.h
 
-# make the server binaries and such
-server: null rsalib
+do_library: null
+	cd ntserv; $(MAKE) libnetrek.a
+
+do_server: null do_rsa_library
 	cd ntserv; $(MAKE)
 
-do_robots:
+do_robots: do_library
 	cd robots; $(MAKE)
 
 do_robotd: 
 	cd robotd; $(MAKE)
 
-do_gum: 
+do_gum: do_library
 	cd gum; $(MAKE)
 
-do_xsg:
+do_xsg: do_library
 	cd xsg; $(MAKE);
 
-do_pledit:
+do_pledit: do_library
 	cd pledit; $(MAKE) 
 
-rsalib:	
+do_rsa_library:	
 	- at if [ -f res-rsa/Makefile ]; then \
 		(cd res-rsa; $(MAKE) librsa.a) \
 	fi
 
-utils: rsalib
+do_utilities: do_rsa_library do_library
 	cd tools; $(MAKE) 
 	cd sequencer; $(MAKE)
 
-rsa_utils: 
+do_rsa_utilities: do_library
 	cd keycomp; $(MAKE)
 
-startup: 
+do_listener: do_library
 	cd newstartd; $(MAKE)
 
 cflags.h: Makefile $(CONFIG)
Index: gum/Makefile.am
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/gum/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- gum/Makefile.am	10 Apr 2006 04:24:50 -0000	1.3
+++ gum/Makefile.am	22 Apr 2006 08:53:25 -0000
@@ -13,7 +13,7 @@
 	signals.c signals.h \
 	id.c xmalloc.c
 
-gum_LDADD = @GTK_LIBS@ ../ntserv/data.o 
+gum_LDADD = @GTK_LIBS@ ../ntserv/libnetrek.a
 
 AM_CFLAGS = @AM_CFLAGS@ -DPACKAGE_DATA_DIR=\"@prefix@\"
 
Index: gum/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/gum/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- gum/Makefile.in	10 Apr 2006 04:24:50 -0000	1.3
+++ gum/Makefile.in	22 Apr 2006 08:53:26 -0000
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -14,8 +14,6 @@
 
 @SET_MAKE@
 
-SOURCES = $(gum_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -56,7 +54,7 @@
 am_gum_OBJECTS = support.$(OBJEXT) main.$(OBJEXT) signals.$(OBJEXT) \
 	id.$(OBJEXT) xmalloc.$(OBJEXT)
 gum_OBJECTS = $(am_gum_OBJECTS)
-gum_DEPENDENCIES = ../ntserv/data.o
+gum_DEPENDENCIES = ../ntserv/libnetrek.a
 DEFAULT_INCLUDES = -I. -I$(srcdir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -168,7 +166,7 @@
 	signals.c signals.h \
 	id.c xmalloc.c
 
-gum_LDADD = @GTK_LIBS@ ../ntserv/data.o 
+gum_LDADD = @GTK_LIBS@ ../ntserv/libnetrek.a
 AM_CFLAGS = @AM_CFLAGS@ -DPACKAGE_DATA_DIR=\"@prefix@\"
 all: all-recursive
 
Index: gum/aclocal.m4
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/gum/aclocal.m4,v
retrieving revision 1.2
diff -u -r1.2 aclocal.m4
--- gum/aclocal.m4	10 Apr 2006 04:24:50 -0000	1.2
+++ gum/aclocal.m4	22 Apr 2006 08:53:29 -0000
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # 2005  Free Software Foundation, Inc.
@@ -17,7 +17,7 @@
 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
 dnl
-AC_DEFUN(AM_PATH_GTK,
+AC_DEFUN([AM_PATH_GTK],
 [dnl 
 dnl Get the cflags and libraries from the gtk-config script
 dnl
@@ -223,7 +223,7 @@
 # Call AM_AUTOMAKE_VERSION so it can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.9.5])])
+	 [AM_AUTOMAKE_VERSION([1.9.6])])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
Index: include/proto.h
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/include/proto.h,v
retrieving revision 1.4
diff -u -r1.4 proto.h
--- include/proto.h	10 Apr 2006 10:56:31 -0000	1.4
+++ include/proto.h	22 Apr 2006 08:53:40 -0000
@@ -93,6 +93,12 @@
 void getshipdefaults(void);
 void getship(struct ship *shipp, int s_type);
 
+/* glog.c */
+void glog_close(void);
+int glog_open();
+void glog_printf(const char *fmt, ...);
+void glog_flush();
+
 /* input.c */
 void input(void);
 
Index: keycomp/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/keycomp/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- keycomp/Makefile.in	21 Mar 2005 10:17:16 -0000	1.2
+++ keycomp/Makefile.in	22 Apr 2006 08:53:40 -0000
@@ -14,10 +14,10 @@
 INSTALLPROG = @INSTALL_PROGRAM@
 INSTALLDATA = @INSTALL_DATA@
 
-SRCS = ${srcdir}/rsa_keycomp.c ${srcdir}/../ntserv/getpath.c ${srcdir}/../ntserv/data.c ${srcdir}/rsa_key2cap.c $(RANDOMC)
-OBJS = rsa_keycomp.o ../ntserv/getpath.o ../ntserv/data.o $(STRDUPO) $(RANDOMO)
+SRCS = ${srcdir}/rsa_keycomp.c ${srcdir}/rsa_key2cap.c $(RANDOMC)
+OBJS = rsa_keycomp.o $(STRDUPO) $(RANDOMO) ../ntserv/libnetrek.a
 
-CFLAGS = $(MOREDEFS) $(FLAGS) -I../include -I${srcdir}/../include -I. -I${srcdir}
+CFLAGS = $(MOREDEFS) $(FLAGS) -I../include
 
 LINTFLAGS = -habxc $(MOREDEFS) $(FLAGS)
 
Index: newstartd/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/newstartd/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- newstartd/Makefile.in	28 Sep 2005 12:14:05 -0000	1.3
+++ newstartd/Makefile.in	22 Apr 2006 08:53:40 -0000
@@ -13,19 +13,16 @@
 INSTALLDATA = @INSTALL_DATA@
 
 N_SRC = ${srcdir}/newstartd.c ${srcdir}/newaccess.c ${srcdir}/subnet.c
-N_OBJS = newstartd.o newaccess.o subnet.o
+N_OBJS = newstartd.o newaccess.o subnet.o ../ntserv/libnetrek.a
 
 LIBS = $(EXTRALIBS)
 
-GETPATH_SRC = ${srcdir}/../ntserv/getpath.c ${srcdir}/../ntserv/data.c
-GETPATH = ../ntserv/getpath.o ../ntserv/data.o
-
-CFLAGS = $(FLAGS) $(EXTRAFLAGS) $(PORT) -I. -I${srcdir} -I../include -I${srcdir}/../include
+CFLAGS = $(FLAGS) $(EXTRAFLAGS) $(PORT) -I../include
 
 all: newstartd
 
-newstartd: $(N_OBJS) $(GETPATH)
-	$(CC) $(CFLAGS) ${LDFLAGS} -o $@ $(N_OBJS) $(GETPATH) $(LIBS)
+newstartd: $(N_OBJS)
+	$(CC) $(CFLAGS) ${LDFLAGS} -o $@ $(N_OBJS) $(LIBS)
 
 clean: rmdependencies
 	/bin/rm -f *.o make.out core
@@ -43,7 +40,7 @@
 	ln -sf $(LIBDIR)/newstartd $(DESTDIR)$(BINDIR)/netrekd
 
 depend: 
-	${CC} -M  $(CFLAGS) $(N_SRC) $(GETPATH_SRC) > .depend
+	${CC} -M  $(CFLAGS) $(N_SRC) > .depend
 
 rmdependencies:
 	rm -f .depend
Index: ntserv/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/Makefile.in,v
retrieving revision 1.4
diff -u -r1.4 Makefile.in
--- ntserv/Makefile.in	10 Apr 2006 10:56:31 -0000	1.4
+++ ntserv/Makefile.in	22 Apr 2006 08:53:40 -0000
@@ -1,5 +1,3 @@
-#	Change CONFIG to your .mk file
-
 VPATH = @srcdir@
 srcdir = @srcdir@
 
@@ -11,25 +9,41 @@
 INSTALLPROG = @INSTALL_PROGRAM@
 INSTALLDATA = @INSTALL_DATA@
 
-#	Do not edit below here. Everything should be setup in config
+#	libnetrek object files
+
+L_OBJS = bay.o \
+	coup.o \
+	data.o db.o detonate.o distress.o \
+	enter.o \
+	feature.o features.o \
+	gencmds.o genspkt.o getpath.o getship.o glog.o \
+	interface.o \
+	ltd_stats.o \
+	openmem.o orbit.o \
+	phaser.o ping.o plasma.o \
+	rsa_key.o reserved.o \
+	salt.o slotmaint.o sintab.o smessage.o socket.o startrobot.o sysdefaults.o \
+	torp.o transwarp.o \
+	util.o \
+	warning.o
 
 #	ntserv object files
 
-R_OBJS =    cluecheck.o coup.o data.o db.o death.o detonate.o enter.o \
-	    findslot.o  getentry.o  getname.o  salt.o getship.o  input.o \
+R_OBJS =    cluecheck.o coup.o db.o death.o detonate.o enter.o \
+	    findslot.o  getentry.o  getname.o  getship.o  input.o \
 	    interface.o  main.o  orbit.o  phaser.o  plasma.o  redraw.o \
 	    reserved.o  sintab.o  socket.o  genspkt.o  smessage.o  \
 	    startrobot.o  sysdefaults.o  timecheck.o  torp.o  util.o  \
-	    warning.o ping.o $(RANDOMO) getpath.o $(STRDUPO) features.o \
+	    warning.o ping.o $(RANDOMO) $(STRDUPO) features.o \
 	    distress.o transwarp.o gencmds.o ntscmds.o openmem.o feature.o \
-	    queue.o slotmaint.o rsa_key.o ltd_stats.o bay.o
+	    queue.o slotmaint.o rsa_key.o ltd_stats.o libnetrek.a
 
 
 #	daemonII object files
 
-D_OBJS =    daemonII.o  sintab.o  sysdefaults.o  data.o  slotmaint.o \
-	    util.o  $(RANDOMO) getpath.o getship.o smessage.o  queue.o \
-	    wander2.o openmem.o solicit.o ltd_stats.o bay.o
+D_OBJS =    daemonII.o  sintab.o  sysdefaults.o  slotmaint.o \
+	    util.o  $(RANDOMO) getship.o smessage.o  queue.o \
+	    wander2.o openmem.o solicit.o ltd_stats.o libnetrek.a
 
 #	Src files
 
@@ -48,15 +62,14 @@
             ${srcdir}/features.c ${srcdir}/distress.c ${srcdir}/transwarp.c \
             ${srcdir}/gencmds.c ${srcdir}/ntscmds.c ${srcdir}/openmem.c \
             ${srcdir}/feature.c ${srcdir}/queue.c ${srcdir}/slotmaint.c \
-            ${srcdir}/wander2.c ${srcdir}/sysdefaults.c ${srcdir}/rsa_key.c \
-            ${srcdir}/bay.c
+            ${srcdir}/wander2.c ${srcdir}/sysdefaults.c ${srcdir}/rsa_key.c
 
 SRC = 	    $(R_FILES)  data.h  defs.h planets.h  struct.h \
 	    packets.h  copyright.h
 
 LIBS = $(RSA_LIB) $(EXTRALIBS)
 
-INCS = $(RSA_INCS) $(EXTRAINCS) -I. -I${srcdir} -I../include -I${srcdir}/../include
+INCS = $(RSA_INCS) $(EXTRAINCS) -I../include
 
 CFLAGS = $(FLAGS) $(INCS)
 
@@ -71,6 +84,13 @@
 daemonII: $(PMAKE) $(D_OBJS)
 	$(CC) $(CFLAGS) ${LDFLAGS} -o daemonII $(D_OBJS) $(EXTRALIBS)
 
+libnetrek.a: $(L_OBJS)
+	ar cru $@ $(L_OBJS)
+	ranlib $@
+
+libnetrek.so: $(L_OBJS)
+	gcc -shared -Wl,-soname,$@ -o $@ $(L_OBJS) -lc
+
 commands.o: $(PMAKE) ${srcdir}/commands.c
 	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/commands.c
 
@@ -88,12 +108,11 @@
 	ling $(LINTFLAGS) $(SRC)
 
 clean: rmdependencies
-	/bin/rm -f *.o *.ln make.out core
+	/bin/rm -f *.a *.o *.ln make.out core
 
 reallyclean:  clean
 	rm -f ntserv daemonII .motd *~ #*#
 
-
 uninstall:
 	-cd $(XTREKDIR); rm -f daemonII .motd .sysdef; rm -rf slots
 	-cd $(LIBDIR); rm -f ntserv ; rm -rf slots
Index: ntserv/commands.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/commands.c,v
retrieving revision 1.2
diff -u -r1.2 commands.c
--- ntserv/commands.c	22 Apr 2006 02:16:46 -0000	1.2
+++ ntserv/commands.c	22 Apr 2006 08:53:44 -0000
@@ -1080,7 +1080,6 @@
     char *current;
     int pcount=0;  /* Total players in game */
     int vcount=0;  /* Number who've voted recently */
-    FILE *glog;
     int mflag = 0;
     int sendto = 0;
 
@@ -1094,22 +1093,19 @@
 #endif
 
     if ( votes[num].tag & VC_GLOG ){
-      if (!(glog = fopen(GodLog,"a")) )       /* Log votes for God to see */
-        perror(GodLog);
-      else {
+      if (glog_open() == 0) {	/* Log votes for God to see */
         time_t    t = time(NULL);
         char      tbuf[40];
         struct tm *tmv = localtime(&t);
       
 #ifdef STRFTIME
-      sprintf(tbuf, "%02d/%02d %d/%d", tmv->tm_hour,tmv->tm_min,
-              tmv->tm_mday,tmv->tm_mon);
+	sprintf(tbuf, "%02d/%02d %d/%d", tmv->tm_hour,tmv->tm_min,
+		tmv->tm_mday,tmv->tm_mon);
 #else
 	strftime(tbuf, 39, "%R %D", tmv);
 #endif
-        fprintf(glog, "VOTE: %s %s@%s \"%s\"\n", tbuf, players[who].p_login, 
-		players[who].p_monitor, comm);
- 	fclose(glog);
+        glog_printf("VOTE: %s %s@%s \"%s\"\n", tbuf, players[who].p_login, 
+		    players[who].p_ip, comm);
       }
     }
 
@@ -1184,11 +1180,8 @@
       pmessage(sendto, mflag, addr_mess(sendto,mflag), 
              "The motion %s passes", current);
       if ( votes[num].tag & VC_GLOG ){
-        if (!(glog = fopen(GodLog,"a")) )       /* Log pass for God to see */
-          perror(GodLog);
-        else {
- 	  fprintf(glog, "VOTE: The motion %s passes\n", current);
-	  fclose(glog);
+        if (glog_open() == 0) {	/* Log pass for God to see */
+ 	  glog_printf("VOTE: The motion %s passes\n", current);
 	}
       }
       
Index: ntserv/data.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/data.c,v
retrieving revision 1.3
diff -u -r1.3 data.c
--- ntserv/data.c	27 Sep 2005 12:26:37 -0000	1.3
+++ ntserv/data.c	22 Apr 2006 08:53:45 -0000
@@ -26,11 +26,7 @@
 
 int	oldalert = PFGREEN;	/* Avoid changing more than we have to */
 
-#ifdef XSG
-int     remap[16] = { 0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 };
-#else
 int 	remap[9] = { 0, 1, 2, -1, 3, -1, -1, -1, 4 };
-#endif
 int	reality = 10;		/* reality updates per second */
 int	minskip = 10;		/* maximum client updates per second */
 int	defskip = 5;		/* default client updates per second */
@@ -409,3 +405,4 @@
 int remoteaddr = -1;		/* inet address in net format */
 int whitelisted = 0;
 int blacklisted = 0;
+int ignored[MAXPLAYER];
Index: ntserv/gencmds.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/gencmds.c,v
retrieving revision 1.1
diff -u -r1.1 gencmds.c
--- ntserv/gencmds.c	21 Mar 2005 05:23:43 -0000	1.1
+++ ntserv/gencmds.c	22 Apr 2006 08:53:45 -0000
@@ -49,7 +49,6 @@
 {
   int i, len;
   char *comm;
-  FILE *glog;
 
   if (!(mess->m_flags & MINDIV)) return 0;	/* double-check */
 
@@ -89,10 +88,7 @@
       /* Record vote in GodLog if C_GLOG is set */
       if (cmds[i].tag & C_GLOG )
       {
-	if (!(glog = fopen(GodLog,"a")) )       /* Log votes for God to see */
-	  perror(GodLog);
-	else
-	{
+	if (glog_open() == 0) {	/* Log votes for God to see */
 	  time_t    t = time(NULL);
 	  char      tbuf[40];
 	  struct tm *tmv = localtime(&t);
@@ -103,10 +99,9 @@
 #else
 	  strftime(tbuf, 39, "%R %D", tmv);
 #endif
-	  fprintf(glog, "VOTE: %s %s@%s \"%s\"\n", tbuf,
+	  glog_printf("VOTE: %s %s@%s \"%s\"\n", tbuf,
 		  players[mess->m_from].p_login, 
 		  players[mess->m_from].p_monitor, comm);
-	  fclose(glog);
 	}
       } /* !C_GLOG */
 
@@ -117,12 +112,8 @@
 	{
 	  if ( cmds[i].tag & C_GLOG ) {
 
-	    if (!(glog = fopen(GodLog,"a")) )       /* Log pass for God to see */
-	      perror(GodLog);
-	    else
-	    {
-	      fprintf(glog, "VOTE: The motion %s passes\n", comm);
-	      fclose(glog);
+	    if (glog_open() == 0) {	/* Log pass for God to see */
+	      glog_printf("VOTE: The motion %s passes\n", comm);
 	    }
           }
 	}
Index: ntserv/main.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/main.c,v
retrieving revision 1.5
diff -u -r1.5 main.c
--- ntserv/main.c	10 Apr 2006 10:38:22 -0000	1.5
+++ ntserv/main.c	22 Apr 2006 08:53:48 -0000
@@ -44,9 +44,7 @@
 static void printStats(void);
 static int checkbanned(char *login, char *host);
 
-
-int ignored[MAXPLAYER];	/* change 7/24/91 TC */
-
+extern int ignored[MAXPLAYER];
 int indie = 0;			/* always be indie 8/28/91 TC */
 int living = 1;			/* our ship is living, reset by death */
 
@@ -232,6 +230,7 @@
     else
 	STRNCPY(login, "Bozo", NAME_LEN);
     login[NAME_LEN - 1] = '\0';
+    endpwent();
 
     strcpy(pseudo, "Guest");
 
Index: ntserv/socket.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/socket.c,v
retrieving revision 1.6
diff -u -r1.6 socket.c
--- ntserv/socket.c	22 Apr 2006 02:16:46 -0000	1.6
+++ ntserv/socket.c	22 Apr 2006 08:53:54 -0000
@@ -300,7 +300,7 @@
 #define MAX_NONFAT	10		/* if we have this much left, stop */
 
 #ifdef CHECKMESG
-static FILE	*mlog, *glog;
+static FILE	*mlog;
 #endif
 
 /*int           send_short        = 0;*/ /* is now in data.c , because of robotII.c */
@@ -507,10 +507,7 @@
 	if (!mlog) mlog = fopen(MesgLog, "a");
 	if (!mlog) perror(MesgLog);
     }
-    if (loggod) {
-	if (!glog) glog = fopen(GodLog,"a");
-	if (!glog) perror(GodLog);
-    }
+    if (loggod) glog_open();
 #endif
 
     clientDead=0;
@@ -627,10 +624,7 @@
 	if(!mlog) mlog = fopen(MesgLog, "a");
 	if(!mlog) perror(MesgLog);
     }
-    if(loggod){
-	if(!glog) glog = fopen(GodLog, "a");
-	if(!glog) perror(GodLog);
-    }
+    if (loggod) glog_open();
 #endif
 
     if(commMode == COMM_UDP) addSequenceFlags(udpbuf);
@@ -1844,8 +1838,8 @@
     if (packet->mesg[0] != '@')
 	return FALSE;
 
+    /* FIXME: never freed */
     version = (char *)strdup(INDEX(packet->mesg,'@')+1);
-    version[strlen(version)] = '\0';
     return TRUE;
 }
 
@@ -2841,12 +2835,9 @@
 		      (packet->group & MGOD))){
 	    static int counter = 0;
 
-	    if(!glog) {
-		ERROR(1,( "ntserv: ERROR, null glog file descriptor\n"));
-		return 0;
-	    }
-	    fprintf(glog, "%s\n", buf);
-	    fflush(glog);
+	    if(glog_open() != 0) return;
+	    glog_printf("%s\n", buf);
+	    glog_flush();
 	    counter++;
 
 	    /* response */
Index: pledit/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/pledit/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- pledit/Makefile.in	21 Mar 2005 10:17:17 -0000	1.2
+++ pledit/Makefile.in	22 Apr 2006 08:53:54 -0000
@@ -12,18 +12,13 @@
 INSTALLPROG = @INSTALL_PROGRAM@
 INSTALLDATA = @INSTALL_DATA@
 
-SRCS	= ${srcdir}/main.c ${srcdir}/edit.c ${srcdir}/input.c \
-	${srcdir}/../ntserv/getpath.c ${srcdir}/../ntserv/data.c \
-	${srcdir}/../ntserv/salt.c
-OBJS	= main.o edit.o input.o ../ntserv/getpath.o ../ntserv/data.o \
-	  ../ntserv/salt.o
+SRCS	= ${srcdir}/main.c ${srcdir}/edit.c ${srcdir}/input.c
+OBJS	= main.o edit.o input.o ../ntserv/libnetrek.a
 HDRS	= ${srcdir}/pledit.h
-# LIBCURSES = -lcurses
 LIBS	= $(LIBCURSES) $(LIBTERMCAP) $(LIBCRYPT) $(EXTRALIBS)
 PROGRAM	= pledit
 
-# NBR server cflags
-CFLAGS = $(FLAGS) $(EXTRAFLAGS) -I. -I${srcdir} -I../include -I${srcdir}/../include
+CFLAGS = $(FLAGS) $(EXTRAFLAGS) -I. -I../include
 
 all:	$(PROGRAM)
 
@@ -34,7 +29,7 @@
 	rm -f pledit #* *~
 
 clean: rmdependencies
-	-rm -f $(OBJS)
+	-rm -f *.o
 
 clobber: clean
 	-rm -f $(PROGRAM)
Index: robots/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/robots/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- robots/Makefile.in	10 Apr 2006 10:56:33 -0000	1.3
+++ robots/Makefile.in	22 Apr 2006 08:53:55 -0000
@@ -1,103 +1,61 @@
-# Change CONFIG to the .mk file that matches your system
-
 CONFIG = system.mk
 VPATH = @srcdir@
 srcdir = @srcdir@
 
-# Do Not Change anything below this line. It should be setup in config
-
 include ../$(CONFIG)
 
 INSTALL = @INSTALL@
 INSTALLPROG = @INSTALL_PROGRAM@
 INSTALLDATA = @INSTALL_DATA@
 
-# this is for revised ntserv/struct.h
-
-CFLAGS = $(EXTRAINCS) $(FLAGS) -DROBOT -I. -I${srcdir} -I../include -I${srcdir}/../include
+CFLAGS = $(EXTRAINCS) $(FLAGS) -DROBOT -I. -I../include
 
 LIBS = $(EXTRALIBS)
 
 TOOLDIR= $(LIBDIR)/tools
 
-GETPATH = getpath.o ../ntserv/data.o
-
 LINTFLAGS = -habxc $(EXTRAINCS) $(FLAGS)
 
-#	Common Objects
-
-C_OBJS = ../ntserv/data.o detonate.o  enter.o ../ntserv/getship.o interface.o \
-	../ntserv/orbit.o ../ntserv/phaser.o ../ntserv/sintab.o \
-	../ntserv/openmem.o  sysdefaults.o ../ntserv/torp.o  \
-	../ntserv/util.o $(RANDOMO) ../ntserv/getpath.o ../ntserv/smessage.o \
-	roboshar.o ../ntserv/slotmaint.o ../ntserv/distress.o \
-	../ntserv/ltd_stats.o ../ntserv/bay.o 
-
-#	Puck Objects
-
-PUCK_OBJS = puck.o  puckmove.o commands_puck.o $(C_OBJS)
-
-#	Mars (dogfighter) Objects
-
-M_OBJS = mars.o marsmove.o commands_mars.o $(C_OBJS)
-
-#	Robot Objects
-
-R_OBJS = robotII.o rmove.o commands.o $(C_OBJS)
-
-#       basepractice object files
+C_OBJS = $(RANDOMO) roboshar.o ../ntserv/libnetrek.a
 
-B_OBJS = basep.o commands_basep.o $(C_OBJS)  
-
-#       newbie server object files
-
-N_OBJS = newbie.o commands_newbie.o $(C_OBJS)
-
-#       pre-T server object files
-
-P_OBJS = pret.o commands_pret.o $(C_OBJS)
-
-#	INL Objects
-
-I_OBJS = inl.o inlcomm.o inlcmds.o gencmds.o $(C_OBJS)
-
-
-SRCS = ${srcdir}/puck.c ${srcdir}/puckmove.c ${srcdir}/mars.c \
-	${srcdir}/marsmove.c ${srcdir}/robotII.c ${srcdir}/rmove.c \
-	${srcdir}/../ntserv/getpath.c ${srcdir}/../ntserv/data.c \
-	${srcdir}/detonate.c  ${srcdir}/../ntserv/enter.c \
-	${srcdir}/../ntserv/getship.c  ${srcdir}/../ntserv/interface.c \
-	${srcdir}/../ntserv/orbit.c  ${srcdir}/../ntserv/phaser.c \
-	${srcdir}/../ntserv/sintab.c ${srcdir}/../ntserv/openmem.c \
-	${srcdir}/../ntserv/sysdefaults.c ${srcdir}/../ntserv/torp.c \
-	${srcdir}/../ntserv/util.c $(RANDOMC) ${srcdir}/../ntserv/commands.c \
-	${srcdir}/../ntserv/smessage.c ${srcdir}/basep.c  ${srcdir}/../ntserv/wander2.c \
-	${srcdir}/newbie.c ${srcdir}/inl.c ${srcdir}/inlcomm.c \
-	${srcdir}/../ntserv/slotmaint.c ${srcdir}/inlcmds.c \
-	${srcdir}/../ntserv/gencmds.c ${srcdir}/pret.c
+SRCS = ${srcdir}/puck.c ${srcdir}/puckmove.c \
+	${srcdir}/mars.c ${srcdir}/marsmove.c \
+	${srcdir}/robotII.c ${srcdir}/rmove.c \
+	$(RANDOMC) ${srcdir}/../ntserv/commands.c \
+	${srcdir}/basep.c \
+	${srcdir}/newbie.c \
+	${srcdir}/inl.c ${srcdir}/inlcomm.c ${srcdir}/inlcmds.c \
+	${srcdir}/pret.c
 
 EXECS =	puck mars robotII basep newbie inl pret
 
 all: $(PMAKE) $(EXECS)
 
+PUCK_OBJS = puck.o puckmove.o commands_puck.o $(C_OBJS)
 puck: $(PMAKE) $(PUCK_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o puck $(PUCK_OBJS) $(EXTRALIBS)
 
+M_OBJS = mars.o marsmove.o commands_mars.o $(C_OBJS)
 mars: $(PMAKE) $(M_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o mars $(M_OBJS) $(EXTRALIBS)
 
+R_OBJS = robotII.o rmove.o commands.o $(C_OBJS)
 robotII: $(PMAKE) $(R_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o robotII  $(R_OBJS) $(EXTRALIBS)
 
+B_OBJS = basep.o commands_basep.o $(C_OBJS)  
 basep: $(PMAKE) $(B_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o basep $(B_OBJS) $(EXTRALIBS)
 
+N_OBJS = newbie.o commands_newbie.o $(C_OBJS)
 newbie: $(PMAKE) $(N_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o newbie $(N_OBJS) $(EXTRALIBS)
 
+P_OBJS = pret.o commands_pret.o $(C_OBJS)
 pret: $(PMAKE) $(P_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o pret $(P_OBJS) $(EXTRALIBS)
 
+I_OBJS = inl.o inlcomm.o inlcmds.o $(C_OBJS)
 inl: $(PMAKE) $(I_OBJS)
 	$(CC) $(CFLAGS)  ${LDFLAGS} -o inl $(I_OBJS) $(EXTRALIBS)
 
@@ -107,18 +65,6 @@
 commands_puck.o: $(PMAKE) ${srcdir}/../ntserv/commands.c
 	$(CC) $(CFLAGS) $(DEP) -DPUCK -c ${srcdir}/../ntserv/commands.c -o commands_puck.o
 
-gencmds.o: $(PMAKE) ${srcdir}/../ntserv/gencmds.c
-	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/../ntserv/gencmds.c
-
-sysdefaults.o: $(PMAKE) ${srcdir}/../ntserv/sysdefaults.c
-	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/../ntserv/sysdefaults.c
-
-interface.o: $(PMAKE) ${srcdir}/../ntserv/interface.c
-	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/../ntserv/interface.c
-
-enter.o: $(PMAKE) ${srcdir}/../ntserv/enter.c
-	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/../ntserv/enter.c
-
 commands.o: $(PMAKE) ${srcdir}/../ntserv/commands.c
 	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/../ntserv/commands.c -o commands.o
 
@@ -149,9 +95,6 @@
 	$(INSTALLPROG) $(INSTALLOPTS) ${srcdir}/end_tourney.pl $(DESTDIR)$(LIBDIR)/end_tourney.pl
 	$(INSTALLPROG) $(INSTALLOPTS) ${srcdir}/auto-archive.pl $(DESTDIR)$(LIBDIR)/auto-archive.pl
 
-updated: update.o ../ntserv/data.o getpath.o
-	$(CC) $(CFLAGS) -o updated  update.o data.o getpath.o $(EXTRALIBS)
-
 lint: $(SRCS)
 	lint $(LINTFLAGS) -u $?
 	touch lint
Index: robots/detonate.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/robots/detonate.c,v
retrieving revision 1.1
diff -u -r1.1 detonate.c
--- robots/detonate.c	21 Mar 2005 05:23:46 -0000	1.1
+++ robots/detonate.c	22 Apr 2006 08:53:55 -0000
@@ -1,3 +1,5 @@
+/* apparently obsolete, use ntserv/detonate.c */
+
 /*
  * detonate.c
  */
@@ -5,7 +7,6 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#include <sys/ipc.h>
 #include "defs.h"
 #include "struct.h"
 #include "data.h"
@@ -15,8 +16,7 @@
             (((a)->p_team == (b)->p_team) && !((a)->p_flags & PFPRACTR))
 
 
-void
-detothers ()
+void detothers ()
 {
   int dx, dy;
   struct player *j;
Index: robots/roboshar.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/robots/roboshar.c,v
retrieving revision 1.1
diff -u -r1.1 roboshar.c
--- robots/roboshar.c	21 Mar 2005 05:23:46 -0000	1.1
+++ robots/roboshar.c	22 Apr 2006 08:53:55 -0000
@@ -157,3 +157,13 @@
     return((u_char) nint((atan2((double) (x2 - x1),
         (double) (y1 - y2)) / M_PI * 128.)));
 }
+
+/*
+ * Null client packet sending function for ntserv specific code in
+ * enter.c and interface.c so that we can avoid compiling it in the
+ * robots directory, and use libnetrek instead.
+ */
+void sendClientPacket(void *ignored)
+{
+  return;
+}
Index: sequencer/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/sequencer/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- sequencer/Makefile.in	21 Mar 2005 10:17:18 -0000	1.2
+++ sequencer/Makefile.in	22 Apr 2006 08:53:55 -0000
@@ -14,33 +14,30 @@
 
 # this is for revised ntserv/struct.h
 
-CFLAGS = $(EXTRAINCS) $(FLAGS) -I. -I${srcdir} -I../include -I${srcdir}/../include
+CFLAGS = $(EXTRAINCS) $(FLAGS) -I../include
 
 LIBS = $(EXTRALIBS)
 
-TOOLDIR= $(LIBDIR)/tools
+TOOLDIR = $(LIBDIR)/tools
 
 LINTFLAGS = -habxc $(EXTRAINCS) $(FLAGS)
 
 #	Common Objects
 
-C_OBJS = ../ntserv/data.o  ../ntserv/openmem.o  ../ntserv/smessage.o \
-        roboshar.o ../ntserv/slotmaint.o 
+C_OBJS = roboshar.o ../ntserv/libnetrek.a
 
 #	Sequencer Objects
 
-S_OBJS = sequencer.o  commands_sequencer.o $(C_OBJS) ../ntserv/ltd_stats.o
+S_OBJS = sequencer.o commands_sequencer.o $(C_OBJS) ../ntserv/libnetrek.a
 
-SRCS = ${srcdir}/roboshar.c ${srcdir}/sequencer.c ${srcdir}/../ntserv/commands.c \
-	${srcdir}/../ntserv/data.c ${srcdir}/../ntserv/openmem.c \
-	${srcdir}/../ntserv/smessage.c ${srcdir}/../ntserv/slotmaint.c
+SRCS = ${srcdir}/roboshar.c ${srcdir}/sequencer.c
 
 EXECS =	sequencer 
 
 all: $(PMAKE) $(EXECS)
 
 sequencer: $(PMAKE) $(S_OBJS)
-	$(CC) $(CFLAGS)  ${LDFLAGS} -o sequencer $(S_OBJS) $(EXTRALIBS)
+	$(CC) $(CFLAGS)  ${LDFLAGS} -o sequencer $(S_OBJS) $(LIBS)
 
 commands_sequencer.o: $(PMAKE) ${srcdir}/../ntserv/commands.c
 	$(CC) $(CFLAGS) $(DEP) -DSEQUENCER -c ${srcdir}/../ntserv/commands.c -o commands_sequencer.o
Index: tools/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/tools/Makefile.in,v
retrieving revision 1.5
diff -u -r1.5 Makefile.in
--- tools/Makefile.in	10 Apr 2006 10:56:33 -0000	1.5
+++ tools/Makefile.in	22 Apr 2006 08:53:56 -0000
@@ -12,19 +12,15 @@
 INSTALLPROG = @INSTALL_PROGRAM@
 INSTALLDATA = @INSTALL_DATA@
 
-# this is for revised ntserv/struct.h
+CFLAGS = $(EXTRAINCS) $(FLAGS) -I../include
 
-CFLAGS = $(EXTRAINCS) $(FLAGS) -I. -I${srcdir} -I../include -I${srcdir}/../include
-
-#LIBCURSES = -lcurses
 LIBS = $(EXTRALIBS)
 
 TOOLDIR= $(LIBDIR)/tools
 
 LINTFLAGS = -habxc $(EXTRAINCS) $(FLAGS)
 
-OBJS_SHM = ../ntserv/data.o ../ntserv/openmem.o ../ntserv/ltd_stats.o
-OBJS_PATH = ../ntserv/getpath.o ../ntserv/data.o
+OBJS = ../ntserv/libnetrek.a
 
 SRCS = ${srcdir}/blotpassword.c ${srcdir}/loadchecker.c ${srcdir}/mess.c \
 	${srcdir}/mergescores.c \
@@ -33,13 +29,10 @@
 	${srcdir}/stat.c ${srcdir}/trimscores.c ${srcdir}/watchmes.c \
 	${srcdir}/fun.c ${srcdir}/xtkill.c ${srcdir}/keyman.c \
 	${srcdir}/nuke.c ${srcdir}/metaget.c \
-	${srcdir}/../ntserv/getpath.c ${srcdir}/../ntserv/data.c \
-	${srcdir}/../ntserv/distress.c ${srcdir}/../ntserv/getship.c \
-	${srcdir}/update.c ${srcdir}/../ntserv/openmem.c ${srcdir}/convert.c \
-	${srcdir}/conq_vert.c ${srcdir}/../ntserv/slotmaint.c $(RANDOMC) \
-	${srcdir}/sortdb.c ${srcdir}/../robots/roboshar.c \
-	${srcdir}/../ntserv/smessage.c ${srcdir}/ntpasswd.c \
-	${srcdir}/../ntserv/salt.c ${srcdir}/../ntserv/bay.c 
+	${srcdir}/update.c ${srcdir}/convert.c \
+	${srcdir}/conq_vert.c $(RANDOMC) \
+	${srcdir}/sortdb.c \
+	${srcdir}/ntpasswd.c
 
 EXECS =	blotpassword loadchecker mess message newscores planets players \
 	scores \
@@ -86,83 +79,80 @@
 	$(INSTALLPROG) $(INSTALLOPTS) cambot $(DESTDIR)$(LIBDIR)/cambot
 	$(INSTALLPROG) $(INSTALLOPTS) metaget $(DESTDIR)$(LIBDIR)/tools/metaget
 
-# cb_sock.o: packets.h ../ntserv/socket.c
-#	$(CC) -o ./cb_sock.o -g $(CFLAGS) -DCAMBOT -c ../ntserv/socket.c
-
-cambot: cambot.o $(OBJS_SHM) $(OBJS_PATH)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} cambot.o ../ntserv/genspkt.o ../ntserv/sysdefaults.o ../ntserv/getship.o ../ntserv/warning.o ../ntserv/smessage.o ../ntserv/distress.o ../ntserv/util.o $(OBJS_SHM) ../ntserv/getpath.o  $(RSA_LIB)
+cambot: cambot.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} cambot.o $(OBJS) $(RSA_LIB)
 
 sortdb: sortdb.o
 	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} sortdb.o
 
-ntpasswd: ntpasswd.o $(OBJS_PATH) ../ntserv/salt.o
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} ntpasswd.o $(OBJS_PATH) ../ntserv/salt.o $(LIBCRYPT)
+ntpasswd: ntpasswd.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} ntpasswd.o $(OBJS) $(LIBCRYPT)
 
-loadchecker: loadchecker.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} loadchecker.o $(OBJS_SHM) $(LIBS)
+loadchecker: loadchecker.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} loadchecker.o $(OBJS) $(LIBS)
 
-mess: mess.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} mess.o $(OBJS_SHM) $(LIBS)
+mess: mess.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} mess.o $(OBJS) $(LIBS)
 
-message: message.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} message.o $(OBJS_SHM) $(LIBS)
+message: message.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} message.o $(OBJS) $(LIBS)
 
-mergescores: mergescores.o $(OBJS_PATH)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} mergescores.o $(OBJS_PATH) $(LIBS)
+mergescores: mergescores.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} mergescores.o $(OBJS) $(LIBS)
 
-newscores: newscores.o $(OBJS_PATH)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} newscores.o $(OBJS_PATH) $(LIBS)
+newscores: newscores.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} newscores.o $(OBJS) $(LIBS)
 
-planets: planets.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} planets.o $(OBJS_SHM) $(LIBS)
+planets: planets.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} planets.o $(OBJS) $(LIBS)
 
-players: players.o $(OBJS_SHM) $(RANDOMO)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} players.o $(OBJS_SHM) $(RANDOMO) $(LIBS)
+players: players.o $(OBJS) $(RANDOMO)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} players.o $(OBJS) $(RANDOMO) $(LIBS)
 
-nuke: nuke.o $(OBJS_SHM) $(RANDOMO)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} nuke.o $(OBJS_SHM) $(RANDOMO) $(LIBS)
+nuke: nuke.o $(OBJS) $(RANDOMO)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} nuke.o $(OBJS) $(RANDOMO) $(LIBS)
 
-scores: scores.o $(OBJS_PATH)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} scores.o $(OBJS_PATH) $(LIBS) ../ntserv/ltd_stats.o
+scores: scores.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} scores.o $(OBJS) $(LIBS)
 
-setgalaxy: setgalaxy.o $(RANDOMO) $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} setgalaxy.o $(RANDOMO) $(OBJS_SHM) $(LIBS)
+setgalaxy: setgalaxy.o $(RANDOMO) $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} setgalaxy.o $(RANDOMO) $(OBJS) $(LIBS)
 
-showgalaxy: showgalaxy.o ../ntserv/distress.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} showgalaxy.o ../ntserv/distress.o $(OBJS_SHM) $(LIBS) $(LIBCURSES) $(LIBTERMCAP)
+showgalaxy: showgalaxy.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} showgalaxy.o $(OBJS) $(LIBS) $(LIBCURSES) $(LIBTERMCAP)
 
-stat: stat.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} stat.o $(OBJS_SHM) $(LIBS)
+stat: stat.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} stat.o $(OBJS) $(LIBS)
 
 blotpassword: blotpassword.o
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} blotpassword.o $(OBJS_PATH) $(LIBS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} blotpassword.o $(OBJS) $(LIBS)
 
-trimscores: trimscores.o $(OBJS_PATH)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} trimscores.o $(OBJS_PATH) $(LIBS)
+trimscores: trimscores.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} trimscores.o $(OBJS) $(LIBS)
 
-watchmes: watchmes.o ../ntserv/distress.o $(OBJS_SHM)
-	$(CC) $(CFLAGS) ${LDFLAGS} watchmes.o ../ntserv/distress.o $(OBJS_SHM) $(LIBS) -o $@
+watchmes: watchmes.o $(OBJS)
+	$(CC) $(CFLAGS) ${LDFLAGS} watchmes.o $(OBJS) $(LIBS) -o $@
 
-xtkill: xtkill.o $(OBJS_SHM) $(OBJS_PATH) ../ntserv/getship.o ../ntserv/slotmaint.o ../ntserv/ltd_stats.o ../ntserv/bay.o
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} xtkill.o ../ntserv/getship.o ../ntserv/openmem.o ../ntserv/slotmaint.o ../ntserv/ltd_stats.o ../ntserv/bay.o $(OBJS_PATH) $(LIBS)
+xtkill: xtkill.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} xtkill.o $(OBJS) $(LIBS)
 
-keyman: keyman.o $(OBJS_PATH)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} keyman.o $(OBJS_PATH) $(LIBS)
+keyman: keyman.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} keyman.o $(OBJS) $(LIBS)
 
-fun: $(RANDOMO) fun.o $(OBJS_SHM)
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} fun.o $(RANDOMO) $(OBJS_SHM) $(LIBS)
+fun: $(RANDOMO) fun.o $(OBJS)
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} fun.o $(RANDOMO) $(OBJS) $(LIBS)
 
-convert: $(OBJS_PATH) convert.o
-	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} convert.o $(OBJS_PATH) $(LIBS)
+convert: $(OBJS) convert.o
+	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} convert.o $(OBJS) $(LIBS)
 
-updated: update.o $(OBJS_PATH)
-	$(CC) $(CFLAGS) ${LDFLAGS} -o updated update.o ../ntserv/ltd_stats.o $(OBJS_PATH) $(EXTRALIBS)
+updated: update.o $(OBJS)
+	$(CC) $(CFLAGS) ${LDFLAGS} -o updated update.o $(OBJS) $(EXTRALIBS)
 
 ltd_dump: ltd_dump.o
-	$(CC) $(CFLAGS) ${LDFLAGS} -o ltd_dump ltd_dump.o ../ntserv/ltd_stats.o $(OBJS_PATH)
+	$(CC) $(CFLAGS) ${LDFLAGS} -o ltd_dump ltd_dump.o $(OBJS)
 
 ltd_convert: ltd_convert.o
-	$(CC) $(CFLAGS) ${LDFLAGS} -o ltd_convert ltd_convert.o ../ntserv/ltd_stats.o $(OBJS_PATH)
+	$(CC) $(CFLAGS) ${LDFLAGS} -o ltd_convert ltd_convert.o $(OBJS)
 
 conq_vert: conq_vert.o
 	$(CC) -o $@ $(CFLAGS) ${LDFLAGS} conq_vert.o
Index: xsg/Makefile.in
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/xsg/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- xsg/Makefile.in	21 Mar 2005 10:17:19 -0000	1.2
+++ xsg/Makefile.in	22 Apr 2006 08:53:56 -0000
@@ -18,42 +18,37 @@
 			defs.h oldbitmaps.h patchlevel.h struct.h version.h \
 			localdata.h
 
-SRCS =	${srcdir}/colors.c ${srcdir}/../ntserv/data.c ${srcdir}/defaults.c \
-	${srcdir}/dmessage.c ${srcdir}/../ntserv/getship.c \
+SRCS =	${srcdir}/colors.c ${srcdir}/defaults.c \
+	${srcdir}/dmessage.c \
 	${srcdir}/inform.c ${srcdir}/input.c ${srcdir}/main.c \
 	${srcdir}/modify.c ${srcdir}/newwin.c ${srcdir}/option.c \
 	${srcdir}/planetlist.c ${srcdir}/planets.c ${srcdir}/playerlist.c \
 	${srcdir}/redraw.c ${srcdir}/robotwin.c ${srcdir}/shmem.c \
 	${srcdir}/sintab.c ${srcdir}/smessage.c ${srcdir}/stats.c \
 	${srcdir}/util.c ${srcdir}/war.c ${srcdir}/warning.c \
-	${srcdir}/x11window.c ${srcdir}/localdata.c \
-	${srcdir}/../ntserv/getpath.c ${srcdir}/../ntserv/distress.c \
-	${srcdir}/../ntserv/slotmaint.c ${srcdir}/../ntserv/ltd_stats.c
-
-OBJS =	colors.o data.o defaults.o dmessage.o ../ntserv/getship.o inform.o \
-	input.o main.o modify.o newwin.o option.o planetlist.o planets.o \
-	playerlist.o redraw.o robotwin.o shmem.o sintab.o smessage.o stats.o \
-	util.o war.o warning.o x11window.o localdata.o ../ntserv/getpath.o \
-	../ntserv/distress.o ../ntserv/slotmaint.o ../ntserv/ltd_stats.o
+	${srcdir}/x11window.c ${srcdir}/localdata.c
+
+OBJS = colors.o defaults.o dmessage.o inform.o input.o localdata.o \
+	main.o modify.o newwin.o option.o planetlist.o planets.o playerlist.o \
+	redraw.o robotwin.o shmem.o sintab.o smessage.o stats.o util.o war.o \
+	warning.o x11window.o ../ntserv/libnetrek.a
 
 LIBS = $(X11LIB) $(EXTRALIBS)
-INCS = $(EXTRAINCS) $(X11INCLUDE)
+INCS = $(EXTRAINCS)
 
-CFLAGS = $(EXTRACFLAGS) $(FLAGS) ${INCS} -I. -I${srcdir} -I../include -I${srcdir}/../include
+CFLAGS = $(EXTRACFLAGS) $(FLAGS) ${INCS} -I../include
 
 all: xsg
 
 xsg: $(OBJS)
 	$(CC) $(CFLAGS) ${LDFLAGS} -o $@ $(OBJS) $(LIBS)
 
-# data.c has an ifdef XSG in it, it must be recompiled here.
-
-data.o:	${srcdir}/../ntserv/data.c
-	$(CC) $(CFLAGS) -c ${srcdir}/../ntserv/data.c
+x11window.o: x11window.c
+	$(CC) $(CFLAGS) $(X11INCLUDE) -c -o $@ $<
 
 clean:
 	/bin/rm -f *.o make.out core
-        
+
 reallyclean:  clean 
 	/bin/rm -f xsg #* *~
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060422/f6630408/attachment-0001.pgp