I've attached a patch to fix the implicit definition warnings that comes
from missing includes of string.h, stdlib.h and unistd.h (plus a few
more). 

This does unfortunately not fix the segfault, but I thought it might be
useful to share the patch anyway....

(There are plenty of more warnings to fix still.)

-- 
Regards,
Andreas Henriksson
diff -uriNp acm-5.0/dis/disgen/rpc_cout.c acm-5.0-fiximplicit/dis/disgen/rpc_cout.c
--- acm-5.0/dis/disgen/rpc_cout.c	1998-08-14 23:16:37.000000000 +0200
+++ acm-5.0-fiximplicit/dis/disgen/rpc_cout.c	2007-03-03 13:44:40.000000000 +0100
@@ -39,9 +39,8 @@ static char rcsid[] = "$Id: rpc_cout.c,v
 #include <stdio.h>
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
-#else
-#include <string.h>
 #endif
+#include <string.h>
 #include <stdlib.h>
 
 #include "rpc_util.h"
diff -uriNp acm-5.0/dis/disgen/rpc_parse.c acm-5.0-fiximplicit/dis/disgen/rpc_parse.c
--- acm-5.0/dis/disgen/rpc_parse.c	1998-08-14 23:16:48.000000000 +0200
+++ acm-5.0-fiximplicit/dis/disgen/rpc_parse.c	2007-03-03 13:45:10.000000000 +0100
@@ -43,9 +43,8 @@ static char rcsid[] = "$Id: rpc_parse.c,
 #include <stdlib.h>
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
-#else
-#include <string.h>
 #endif
+#include <string.h>
 #include <ctype.h>
 
 static void isdefined();
diff -uriNp acm-5.0/dis/disgen/rpc_util.c acm-5.0-fiximplicit/dis/disgen/rpc_util.c
--- acm-5.0/dis/disgen/rpc_util.c	1998-08-14 23:16:59.000000000 +0200
+++ acm-5.0-fiximplicit/dis/disgen/rpc_util.c	2007-03-03 13:47:31.000000000 +0100
@@ -42,11 +42,11 @@ static char rcsid[] = "$Id: rpc_util.c,v
 #include "rpc_util.h"
 
 #include <stdio.h>
+#include <unistd.h>
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
-#else
-#include <string.h>
 #endif
+#include <string.h>
 #include <stdlib.h>
 
 char curline[MAXLINESIZE];	/* current read line */
diff -uriNp acm-5.0/dis/lib/io.c acm-5.0-fiximplicit/dis/lib/io.c
--- acm-5.0/dis/lib/io.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/dis/lib/io.c	2007-03-03 13:21:52.000000000 +0100
@@ -40,9 +40,15 @@
 #include <netdb.h>
 #endif							/* ifndef WIN32 */
 #include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #ifndef WIN32
 #define INVALID_SOCKET	-1
diff -uriNp acm-5.0/dis/lib/xdr_umem.c acm-5.0-fiximplicit/dis/lib/xdr_umem.c
--- acm-5.0/dis/lib/xdr_umem.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/dis/lib/xdr_umem.c	2007-03-03 13:22:53.000000000 +0100
@@ -79,6 +79,9 @@ static char *rcsid = "$Id: xdr_umem.c,v 
 #include <netinet/in.h>
 #include <limits.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 static bool_t xdrumem_getlong(register XDR * xdrs, long int *lp);
 static bool_t xdrumem_putlong(register XDR * xdrs, long int *lp);
diff -uriNp acm-5.0/dis/lib/xdr_var_array.c acm-5.0-fiximplicit/dis/lib/xdr_var_array.c
--- acm-5.0/dis/lib/xdr_var_array.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/dis/lib/xdr_var_array.c	2007-03-03 13:24:20.000000000 +0100
@@ -77,6 +77,9 @@ static char *rcsid = "$Id: xdr_var_array
 #include <stdlib.h>
 #include <rpc/types.h>
 #include <rpc/xdr.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 #define LASTUNSIGNED	((u_int)0-1)
 
diff -uriNp acm-5.0/dis/sdbm/dba.c acm-5.0-fiximplicit/dis/sdbm/dba.c
--- acm-5.0/dis/sdbm/dba.c	1995-09-26 19:01:20.000000000 +0100
+++ acm-5.0-fiximplicit/dis/sdbm/dba.c	2007-03-03 13:26:00.000000000 +0100
@@ -4,6 +4,14 @@
 
 #include <stdio.h>
 #include <sys/file.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include "sdbm.h"
 
 char *progname;
diff -uriNp acm-5.0/dis/sdbm/dbd.c acm-5.0-fiximplicit/dis/sdbm/dbd.c
--- acm-5.0/dis/sdbm/dbd.c	1995-09-26 19:01:24.000000000 +0100
+++ acm-5.0-fiximplicit/dis/sdbm/dbd.c	2007-03-03 13:26:23.000000000 +0100
@@ -4,6 +4,14 @@
 
 #include <stdio.h>
 #include <sys/file.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include "sdbm.h"
 
 char *progname;
diff -uriNp acm-5.0/dis/sdbm/dbe.c acm-5.0-fiximplicit/dis/sdbm/dbe.c
--- acm-5.0/dis/sdbm/dbe.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/dis/sdbm/dbe.c	2007-03-03 13:27:05.000000000 +0100
@@ -1,4 +1,12 @@
 #include <stdio.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #ifndef VMS
 #include <sys/file.h>
 #include <gdbm-ndbm.h>
diff -uriNp acm-5.0/dis/sdbm/dbu.c acm-5.0-fiximplicit/dis/sdbm/dbu.c
--- acm-5.0/dis/sdbm/dbu.c	1995-09-26 19:01:36.000000000 +0100
+++ acm-5.0-fiximplicit/dis/sdbm/dbu.c	2007-03-03 13:28:01.000000000 +0100
@@ -1,5 +1,10 @@
 #include <stdio.h>
 #include <sys/file.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #ifdef SDBM
 #include "sdbm.h"
 #else
diff -uriNp acm-5.0/dis/server/dis_relay.c acm-5.0-fiximplicit/dis/server/dis_relay.c
--- acm-5.0/dis/server/dis_relay.c	1998-05-22 19:56:07.000000000 +0200
+++ acm-5.0-fiximplicit/dis/server/dis_relay.c	2007-03-03 13:28:54.000000000 +0100
@@ -37,6 +37,13 @@
 #include <stdio.h>
 #include <dis_relay.h>
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 SwitchClient *client_list = 0;
 
 #if SYSCALL_PROTO
diff -uriNp acm-5.0/dis/test/decoy.c acm-5.0-fiximplicit/dis/test/decoy.c
--- acm-5.0/dis/test/decoy.c	1998-12-23 23:29:19.000000000 +0100
+++ acm-5.0-fiximplicit/dis/test/decoy.c	2007-03-03 12:53:00.000000000 +0100
@@ -3,6 +3,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <math.h>
 
 /*
diff -uriNp acm-5.0/src/alarm.c acm-5.0-fiximplicit/src/alarm.c
--- acm-5.0/src/alarm.c	1998-05-12 05:43:03.000000000 +0200
+++ acm-5.0-fiximplicit/src/alarm.c	2007-03-03 12:57:27.000000000 +0100
@@ -15,6 +15,7 @@
  *  along with this program;  if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
  */
+#include <stdio.h>
 #include "alarm.h"
 #include <sys/param.h>
 #if defined(__STDC__) || defined(HAVE_STDLIB_H)
diff -uriNp acm-5.0/src/browse.c acm-5.0-fiximplicit/src/browse.c
--- acm-5.0/src/browse.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/src/browse.c	2007-03-03 13:30:44.000000000 +0100
@@ -25,6 +25,9 @@
 #define MAX_MAPPED_STRING_LEN	20
 #define MAX_POPUP_STRING_LEN	40
 #include <stdio.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 #include "dis.h"
 #include "linux_joystick.h"
 
@@ -33,6 +36,12 @@
 
 extern int debug;
 
+extern void initRadio(craft * c, radio_t * r);
+extern int absorbDamage();
+extern void startBlackBoxRecording(void), endBlackBoxRecording(void);
+extern void startBlackBoxPlayback(void);
+extern void CalibrateJoystick(void);
+
 /*  There's a bug lurking here, but for now ... */
 
 #ifdef WIN32
diff -uriNp acm-5.0/src/chaser.c acm-5.0-fiximplicit/src/chaser.c
--- acm-5.0/src/chaser.c	1998-05-12 05:43:03.000000000 +0200
+++ acm-5.0-fiximplicit/src/chaser.c	2007-03-03 13:31:38.000000000 +0100
@@ -21,6 +21,9 @@
 #include <X11/Xutil.h>
 #include <X11/keysym.h>
 #include <malloc.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 
 #define MAX_MAPPED_STRING_LEN	20
 #define MAX_POPUP_STRING_LEN	40
diff -uriNp acm-5.0/src/dis_if.c acm-5.0-fiximplicit/src/dis_if.c
--- acm-5.0/src/dis_if.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/src/dis_if.c	2007-03-03 13:31:50.000000000 +0100
@@ -20,6 +20,9 @@
 static char rcsid[] = "$Id: dis_if.c,v 1.2 1998/05/12 03:59:37 riley Exp $";
 
 #include <stdio.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 #include <math.h>
 #ifndef WIN32
 #include <sys/time.h>
diff -uriNp acm-5.0/src/fpage.c acm-5.0-fiximplicit/src/fpage.c
--- acm-5.0/src/fpage.c	1998-08-18 15:45:03.000000000 +0200
+++ acm-5.0-fiximplicit/src/fpage.c	2007-03-03 13:32:20.000000000 +0100
@@ -19,6 +19,9 @@
 #include <math.h>
 #include "pm.h"
 #include <stdio.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 #ifdef AFDS
 #include <afds.h>
 #endif
diff -uriNp acm-5.0/src/hsi.c acm-5.0-fiximplicit/src/hsi.c
--- acm-5.0/src/hsi.c	1999-01-06 20:59:20.000000000 +0100
+++ acm-5.0-fiximplicit/src/hsi.c	2007-03-03 13:32:41.000000000 +0100
@@ -20,6 +20,9 @@
 #include "pm.h"
 #include "hsi.h"
 #include <stdio.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 #ifdef AFDS
 #include <afds.h>
 #endif
diff -uriNp acm-5.0/src/hud.c acm-5.0-fiximplicit/src/hud.c
--- acm-5.0/src/hud.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/src/hud.c	2007-03-03 13:33:03.000000000 +0100
@@ -21,6 +21,9 @@
 #include "pm.h"
 #include "horizon.h"
 #include <stdio.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 
 extern void doScale(Viewport * vp, scaleControl * s, double value), doCompassScale(Viewport * vp, scaleControl * s, double value);
 extern void ShortTransform(short_point_t *, short_matrix_t * m, short_point_t * b);
diff -uriNp acm-5.0/src/init.c acm-5.0-fiximplicit/src/init.c
--- acm-5.0/src/init.c	1998-12-09 22:53:13.000000000 +0100
+++ acm-5.0-fiximplicit/src/init.c	2007-03-03 12:53:57.000000000 +0100
@@ -21,6 +21,7 @@
 #endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <ctype.h>
 
 #include "pm.h"
 #include "alarm.h"
diff -uriNp acm-5.0/src/navaid.c acm-5.0-fiximplicit/src/navaid.c
--- acm-5.0/src/navaid.c	1998-08-14 17:00:09.000000000 +0200
+++ acm-5.0-fiximplicit/src/navaid.c	2007-03-03 13:33:27.000000000 +0100
@@ -18,6 +18,9 @@
 #include "pm.h"
 #include "alarm.h"
 #include <math.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 
 extern double strtod(const char *, char **);
 
diff -uriNp acm-5.0/src/panel.c acm-5.0-fiximplicit/src/panel.c
--- acm-5.0/src/panel.c	1998-05-12 05:43:03.000000000 +0200
+++ acm-5.0-fiximplicit/src/panel.c	2007-03-03 13:33:49.000000000 +0100
@@ -17,6 +17,10 @@
  *  Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
  */
 
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include "pm.h"
 
 int       doGearLights(craft * c, viewer * u);
diff -uriNp acm-5.0/src/radar.c acm-5.0-fiximplicit/src/radar.c
--- acm-5.0/src/radar.c	1998-12-23 23:29:11.000000000 +0100
+++ acm-5.0-fiximplicit/src/radar.c	2007-03-03 13:34:05.000000000 +0100
@@ -20,6 +20,9 @@
 #include "pm.h"
 #include "dis.h"
 #include <stdio.h>
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 #ifdef WIN32
 #include <ddraw.h>
 extern LPDIRECTDRAW GetDirectDrawInterface(int iWndIndex);
diff -uriNp acm-5.0/src/render.c acm-5.0-fiximplicit/src/render.c
--- acm-5.0/src/render.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/src/render.c	2007-03-03 13:34:28.000000000 +0100
@@ -18,6 +18,9 @@
 
 #include <math.h>
 #include "pm.h"
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 #ifdef WIN32
 #define handleDn_width	30
 #define flaps0_width	64
diff -uriNp acm-5.0/src/splash.c acm-5.0-fiximplicit/src/splash.c
--- acm-5.0/src/splash.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/src/splash.c	2007-03-03 13:35:57.000000000 +0100
@@ -42,6 +42,9 @@ from the X Consortium.
 #include <X11/keysymdef.h>
 #include <errno.h>
 #include <signal.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 #ifdef X_NOT_STDC_ENV
 extern int errno;
diff -uriNp acm-5.0/V/lib/InitAWin.c acm-5.0-fiximplicit/V/lib/InitAWin.c
--- acm-5.0/V/lib/InitAWin.c	2007-03-03 13:03:46.000000000 +0100
+++ acm-5.0-fiximplicit/V/lib/InitAWin.c	2007-03-03 13:36:31.000000000 +0100
@@ -1,6 +1,9 @@
 #include <Alib.h>
 #include <stdio.h>
 #include <memory.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 #ifdef X11
 
diff -uriNp acm-5.0/V/lib/MakeET.c acm-5.0-fiximplicit/V/lib/MakeET.c
--- acm-5.0/V/lib/MakeET.c	1998-08-14 23:09:05.000000000 +0200
+++ acm-5.0-fiximplicit/V/lib/MakeET.c	2007-03-03 12:38:26.000000000 +0100
@@ -61,7 +61,7 @@ MakeET(AWindow * w, Point * pts, int npt
 		}
 
 		if (y1 < 0 || y2 >= w->height) {
-			fprintf(stderr, "polygon edge y out %d %d\n", y1, y2);
+			fprintf(stderr, "polygon edge y out %ld %ld\n", y1, y2);
 			continue;
 		}
 
diff -uriNp acm-5.0/V/lib/SLDiff.c acm-5.0-fiximplicit/V/lib/SLDiff.c
--- acm-5.0/V/lib/SLDiff.c	1998-05-12 05:58:24.000000000 +0200
+++ acm-5.0-fiximplicit/V/lib/SLDiff.c	2007-03-03 13:37:07.000000000 +0100
@@ -1,10 +1,11 @@
 #include <Alib.h>
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 #ifdef X11
 
-extern char *malloc(size_t);
-
 void      AX11AllocBufferedSegments(AWindow * w, Color c);
 
 #ifdef X11_DRAW_SEGMENTS
diff -uriNp acm-5.0/V/lib/VCopyObj.c acm-5.0-fiximplicit/V/lib/VCopyObj.c
--- acm-5.0/V/lib/VCopyObj.c	1998-05-12 05:43:04.000000000 +0200
+++ acm-5.0-fiximplicit/V/lib/VCopyObj.c	2007-03-03 13:37:57.000000000 +0100
@@ -1,4 +1,7 @@
 #include "Vlib.h"
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+#endif
 
 VObject  *
 VCopyObject(VObject * obj)
diff -uriNp acm-5.0/V/lib/VCrPoly.c acm-5.0-fiximplicit/V/lib/VCrPoly.c
--- acm-5.0/V/lib/VCrPoly.c	1998-05-12 05:43:05.000000000 +0200
+++ acm-5.0-fiximplicit/V/lib/VCrPoly.c	2007-03-03 12:33:03.000000000 +0100
@@ -1,4 +1,5 @@
 #include "Vlib.h"
+#include <string.h>
 
 VPolygon *
 VCreatePolygon(int numVtces, VPoint * vert, VColor * color)
diff -uriNp acm-5.0/V/lib/VOpenVp.c acm-5.0-fiximplicit/V/lib/VOpenVp.c
--- acm-5.0/V/lib/VOpenVp.c	1998-08-14 23:09:47.000000000 +0200
+++ acm-5.0-fiximplicit/V/lib/VOpenVp.c	2007-03-03 13:00:14.000000000 +0100
@@ -1,4 +1,5 @@
 #include "Vlib.h"
+#include <string.h>
 
 #ifdef X11
 #include "gray0.xbm"

Reply via email to