--- configure.ac.orig	2012-03-28 13:00:04.000000000 +0200
+++ configure.ac	2012-04-15 13:17:47.000000000 +0200
@@ -33,6 +33,17 @@
 DOCYEAR="2012"
 GSHHS_VERSION=2.2.0
 SVN_VERSION=0
+dnl see whether subversion is installed
+AC_PATH_PROG([SVNVERSIONCOMMAND], [svnversion], [])
+dnl use svnversion to record the current repository revision only if
+dnl subversion is installed and we are in a working copy
+if test "$SVN_VERSION" != "0" && test -x "$SVNVERSIONCOMMAND"; then
+  SVN_VERSION_STRING=`"$SVNVERSIONCOMMAND" -n '.'`
+  if test "$SVN_VERSION_STRING" == "exported" || \
+     test "$SVN_VERSION_STRING" == "Unversioned directory"; then
+    SVN_VERSION=0
+  fi
+fi
 dnl
 dnl -----------------------------------------------------------------
 dnl Specify the minimal supplement directories
@@ -82,6 +93,7 @@
 AC_SUBST(FTPSITE)
 AC_SUBST(GSHHS_VERSION)
 AC_SUBST(SVN_VERSION)
+AC_SUBST(SVN_VERSION_STRING)
 AC_SUBST(GMT_MAJOR_VERSION)
 AC_SUBST(GMT_MINOR_VERSION)
 AC_SUBST(GMT_RELEASE_VERSION)
--- src/gmt_plot.c.orig	2012-03-22 20:20:51.000000000 +0100
+++ src/gmt_plot.c	2012-04-15 13:17:47.000000000 +0200
@@ -4193,7 +4193,7 @@
 	/* First crudely estimate the boundingbox coordinates */
 
 	if (GMT_ps.overlay && (fp = fopen (info, "r")) != NULL) {	/* Must get previous boundingbox values */
-		fscanf (fp, "%d %d %lf %lf %lf %lf %lf %lf\n", &(new->portrait), &(new->clip_level), &orig_x0, &orig_y0, &old_x0, &old_y0, &old_x1, &old_y1);
+		(void)fscanf (fp, "%d %d %lf %lf %lf %lf %lf %lf\n", &(new->portrait), &(new->clip_level), &orig_x0, &orig_y0, &old_x0, &old_y0, &old_x1, &old_y1);
 		fclose (fp);
 		x0 = orig_x0;
 		y0 = orig_y0;
--- src/gmt_version.c.orig	2012-01-13 19:28:16.000000000 +0100
+++ src/gmt_version.c	2012-04-15 13:17:45.000000000 +0200
@@ -25,16 +25,15 @@
 
 #include "gmt.h"
 
-char *GMT_version ()
-{
-	static char text[GMT_LONG_TEXT];
 #if SVN_VERSION
-	int svn_revision =
-#include "gmt_svn_revision.h"
-	;
-	sprintf (text, PACKAGE_VERSION "-%d" GMT_VER_64, svn_revision);
+#define SVN_SUFFIX "_r" SVN_VERSION_STRING
 #else
-	sprintf (text, PACKAGE_VERSION GMT_VER_64);
+#define SVN_SUFFIX ""
 #endif
+
+char *GMT_version ()
+{
+	static char text[GMT_LONG_TEXT];
+	sprintf (text, PACKAGE_VERSION SVN_SUFFIX GMT_VER_64);
 	return (text);
 }
--- src/gmt_version.h.in.orig	2012-03-27 13:00:03.000000000 +0200
+++ src/gmt_version.h.in	2012-04-15 13:17:47.000000000 +0200
@@ -1,4 +1,7 @@
+/* @configure_input@ */
+
 #define SVN_VERSION @SVN_VERSION@
+#define SVN_VERSION_STRING "@SVN_VERSION_STRING@"
 #define PACKAGE_VERSION "@PACKAGE_VERSION@"
 #if SVN_VERSION
 #define GMT_STRING "@PACKAGE_STRING@ (SVN)"
--- src/mgd77/mgd77.c.orig	2012-03-30 21:35:19.000000000 +0200
+++ src/mgd77/mgd77.c	2012-04-15 13:17:45.000000000 +0200
@@ -2110,7 +2110,7 @@
 
 int MGD77_Write_File_asc (char *file, struct MGD77_CONTROL *F, struct MGD77_DATASET *S)	  /* Will write all MGD77 records in current file */
 {
-	int err;
+	int err = 0;
 
 	if (MGD77_Open_File (file, F, MGD77_WRITE_MODE)) return (-1);
 	switch (F->format) {
@@ -2298,7 +2298,7 @@
 	GMT_LONG pos = 0;
 	GMT_cal_rd rata_die;
 	char line[BUFSIZ], p[BUFSIZ], r_date[9];
-	double tz, secs, r_time;
+	double tz, secs, r_time = 0.0;
 
 	if (!(fgets (line, BUFSIZ, F->fp))) return (MGD77_ERROR_READ_ASC_DATA);		/* End of file? */
 	GMT_chop (line);	/* Get rid of CR or LF */
--- src/pshistogram.c.orig	2012-03-22 00:18:28.000000000 +0100
+++ src/pshistogram.c	2012-04-15 13:17:45.000000000 +0200
@@ -340,7 +340,7 @@
 	z_project.view_elevation = Ctrl->E.elevation;
 	F.cumulative = Ctrl->Q.active;
 	F.center_box = Ctrl->F.active;
-	if (Ctrl->I.active) gmtdefs.verbose = TRUE;
+	if (Ctrl->I.active && Ctrl->I.mode == 0) gmtdefs.verbose = TRUE;
 	if (!Ctrl->I.active && !project_info.region_supplied) automatic = TRUE;
 
 	if (Ctrl->C.active)  GMT_read_cpt (Ctrl->C.file);
--- src/pslegend.c.orig	2012-03-22 00:18:28.000000000 +0100
+++ src/pslegend.c	2012-04-15 13:17:45.000000000 +0200
@@ -620,15 +620,17 @@
 	fprintf (fpo, "\n");
 
 	if (!Ctrl->S.active) {	/* Add auto-delete command at the end of the script and then execute it */
+		int err = 0;
 		if (fpo != stdout) fclose (fpo);
 		if (gmtdefs.verbose) fprintf (stderr, "%s: Executing and removing legend script\n", GMT_program);
 #ifdef WIN32
-		system (script);
+		err = system (script);
 #else
 		sprintf (sub, "sh %s", script);
-		system (sub);
+		err = system (sub);
 #endif
 		remove (script);
+		if (err) fprintf (stderr, "%s: System call return with non-zero status %d\n", GMT_program, err);
 	}
 	else if (fpo != stdout)
 		fclose (fpo);
--- src/xgrid/xGridEdit.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xGridEdit.c	2012-04-15 13:17:45.000000000 +0200
@@ -25,19 +25,17 @@
 
 /****	Local procedures  ****/
 
-static void usage (); /* String argv[] */
-static void quitGridEdit (); /* Widget w, void * callData, void * clientData */
+static void usage (String argv[]);
+static void quitGridEdit (Widget w, void * callData, void * clientData);
 
-static void usage (argv)
-	String argv[];
+static void usage (String argv[])
 {
   printf("Usage: %s <grid file name>\n", argv[0]);
 }
 
-static void quitGridEdit (w, call, client)
-	Widget	w;
-	void *	call;
-	void *	client;
+static void quitGridEdit (Widget w __attribute__((unused)),
+			  void *call __attribute__((unused)),
+			  void *client __attribute__((unused)))
 {
   /* There may be more than one callback on the Quit button, and
      the order of execution is undefined. We therefore can't
--- src/xgrid/xgrid_Canvas.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_Canvas.c	2012-04-15 13:17:45.000000000 +0200
@@ -22,10 +22,7 @@
 
 /****	Methods for Canvas.	****/
 
-static void CanvasRealize (self, mask, attributes)
-	Widget	self;
-	XtValueMask * mask;
-	XSetWindowAttributes * attributes;
+static void CanvasRealize (Widget self, XtValueMask *mask, XSetWindowAttributes *attributes)
 {
   WidgetClass super;
   
@@ -36,8 +33,7 @@
   XtCallCallbackList(self, ((CanvasWidget)self)->canvas.realize_callback, NULL);
 }
 
-static void CanvasResize (self)
-	Widget self;
+static void CanvasResize (Widget self)
 {
   XRectangle	bounds;
   
@@ -50,19 +46,14 @@
   	((CanvasWidget)self)->canvas.resize_callback, &bounds);
 }
 
-static void CanvasExpose (self, event, region)
-	Widget	 self;
-	XEvent * event;
-	Region	 region;
+static void CanvasExpose (Widget self, XEvent *event __attribute__((unused)), Region region)
 {
   XtCallCallbackList(self,
   	((CanvasWidget)self)->canvas.expose_callback, region);
 }
 
-static XtGeometryResult CanvasQueryGeometry (self, request, reply)
-	Widget		   self;
-	XtWidgetGeometry * request;
-	XtWidgetGeometry * reply;
+static XtGeometryResult CanvasQueryGeometry (Widget self, XtWidgetGeometry *request,
+	XtWidgetGeometry *reply)
 {
   XtGeometryHandler instMethod;
   
@@ -117,17 +108,14 @@
 
 /****	Convenience functions	****/
 
-XFontStruct * XtCanvasFont (self)
-	CanvasWidget self;
+XFontStruct * XtCanvasFont (Widget self)
 {
   XtCheckSubclass(self, canvasWidgetClass, "XtCanvasFont");
-  return self->canvas.font;
+  return ((CanvasWidget)self)->canvas.font;
 }
 
-void * XtCanvasData (self)
-	CanvasWidget self;
+void * XtCanvasData (Widget self)
 {
   XtCheckSubclass(self, canvasWidgetClass, "XtCanvasData");
-  return self->canvas.data;
+  return ((CanvasWidget)self)->canvas.data;
 }
-
--- src/xgrid/xgrid_Canvas.h.orig	2012-01-13 19:27:17.000000000 +0100
+++ src/xgrid/xgrid_Canvas.h	2012-04-15 13:17:45.000000000 +0200
@@ -76,7 +76,7 @@
 
 /**** Convenience functions ****/
 
-extern XFontStruct * XtCanvasFont (); /* Widget w */
-extern void * XtCanvasData (); /* Widget w */
+extern XFontStruct * XtCanvasFont (Widget w);
+extern void * XtCanvasData (Widget w);
 
 #endif /* _Canvas_h */
--- src/xgrid/xgrid_GMTgrid.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_GMTgrid.c	2012-04-15 13:17:45.000000000 +0200
@@ -17,8 +17,7 @@
 #include "xgrid_utility.h"
 #include "xgrid_GMTgrid.h"
 
-static void clear (grid)
-	GMTGrid * grid;
+static void clear (GMTGrid *grid)
 {
   grid->methods.width     = 0;
   grid->methods.height    = 0;
@@ -48,8 +47,9 @@
   memset(grid->header.remark, 0, sizeof(grid->header.remark));
 }
 
-static void readFromFile (GMTGrid *grid, String fileName, int *status)
+static void readFromFile (Grid *_grid, String fileName, int *status)
 {
+    GMTGrid *grid = (GMTGrid *)_grid;
     if ((*status = GMT_read_grd_info (fileName, &grid->header)))
       return;
 
@@ -66,25 +66,22 @@
   return;
 }
 
-static void writeToFile (grid, fileName, status)
-	GMTGrid * grid;
-	String    fileName;
-	int *	  status;
+static void writeToFile (Grid *_grid, String fileName, int *status)
 {
+  GMTGrid *grid = (GMTGrid *)_grid;
   *status = GMT_write_grd (fileName, &grid->header, grid->value, 0.0, 0.0, 0.0,
 			   0.0, GMT_pad, FALSE);
 }
 
-static void dispose (grid)
-	GMTGrid * grid;
+static void dispose (Grid *_grid)
 {
+  GMTGrid *grid = (GMTGrid *)_grid;
   free(grid->value);
   grid->value = NULL;
 }
 
 #if 0
-static void dumpGrid (grid)
-	GMTGrid * grid;
+static void dumpGrid (GMTGrid *grid)
 {
   int outer, inner;
   GridPoint  gPt;
@@ -115,12 +112,10 @@
 }
 #endif
 
-static void getIndexes (grid, coord, index)
-	GMTGrid *   grid;
-	GridPoint * coord;
-	XPoint *    index;
+static void getIndexes (Grid *_grid, GridPoint *coord, XPoint *index)
 {
   int column, row;
+  GMTGrid *grid = (GMTGrid *)_grid;
   
   column = (int)((coord->x - grid->header.x_min) / grid->header.x_inc);
   row    = (int)((coord->y - grid->header.y_min) / grid->header.y_inc);
@@ -129,29 +124,22 @@
   index->y = grid->header.ny - row;
 }
 
-static void getCoords (grid, index, coord)
-	GMTGrid *   grid;
-	XPoint *    index;
-	GridPoint * coord;
+static void getCoords (Grid *_grid, XPoint *index, GridPoint *coord)
 {
+  GMTGrid *grid = (GMTGrid *)_grid;
   coord->x = grid->header.x_min + index->x * grid->header.x_inc;
   coord->y = grid->header.y_max - index->y * grid->header.y_inc;
 }
 
-static void set (grid, xIndex, yIndex, value)
-	GMTGrid * grid;
-	int	  xIndex;
-	int	  yIndex;
-	GridValue value;
+static void set (Grid *_grid, int xIndex, int yIndex, GridValue value)
 {
+  GMTGrid *grid = (GMTGrid *)_grid;
   grid->value[yIndex * grid->header.nx + xIndex] = value;
 }
 
-static GridValue get (grid, xIndex, yIndex)
-	GMTGrid * grid;
-	int	  xIndex;
-	int	  yIndex;
+static GridValue get (Grid *_grid, int xIndex, int yIndex)
 {
+  GMTGrid *grid = (GMTGrid *)_grid;
 
 /* Original Version had "grid->header.ny": should be "grid->header.nx */
 /* Fixed 8/4/93 by J. Lillibrige @ NOAA/NOS to eliminate core dumps!  */
--- src/xgrid/xgrid_Panner.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_Panner.c	2012-04-15 13:17:45.000000000 +0200
@@ -6,9 +6,12 @@
 #define Min(a,b) ((a)<(b)?(a):(b))
 #define Max(a,b) ((a)>(b)?(a):(b))
 
-#include "xgrid_PannerP.h"
 #include <stddef.h>
 
+#include "xgrid_utility.h"
+
+#include "xgrid_PannerP.h"
+
 static XtResource resources[] = {
 #define offset(field) XtOffset(PannerWidget, panner.field)
   { XtNcanvas, XtCCanvas, XtRWidget, sizeof(Widget),
@@ -45,7 +48,9 @@
 /****	Methods for Panner.	****/
 
 /* At initialisation, create our two scrollbar widgets */
-static void PannerInitialize (Widget request, Widget result, ArgList args, Cardinal *nargs)
+static void PannerInitialize (Widget request __attribute__((unused)),
+			      Widget result, ArgList args __attribute__((unused)),
+			      Cardinal *nargs __attribute__((unused)))
 {
   Widget bar;
   PanScrollRec *horizontal = &((PannerWidget)result)->panner.horizontal;
@@ -85,7 +90,9 @@
 /* If range or position changed, recalculate appearance
    of scrollbars. Don't bother checking for width, height
    resources because the resize method will catch those.   */
-static Boolean PannerSetValues (Widget old, Widget request, Widget new, ArgList	args, Cardinal *nargs)
+static Boolean PannerSetValues (Widget old, Widget request __attribute__((unused)),
+				Widget new, ArgList args __attribute__((unused)),
+				Cardinal *nargs __attribute__((unused)))
 {
   PannerWidget oldp, newp;
   
@@ -136,8 +143,7 @@
   recalculateBar(&(self->panner.vertical));
 }
 
-static void recalculateBar (bar)
-	PanScrollRec * bar;
+static void recalculateBar (PanScrollRec * bar)
 {
   float top, size;
   
@@ -227,10 +233,7 @@
 	2. You can't scroll past the bottom of the data,
 	ie the thumb is always fully visible	****/
 
-static void jumpProc (bar, data, fraction)
-	Widget		bar;
-	PanScrollRec *	data;
-	float *		fraction;
+static void jumpProc (Widget bar, PanScrollRec *data, float *fraction)
 {
   float	   	thumbSize, scaleFrac;
   int	 	previous;
@@ -266,10 +269,7 @@
 	to the position of the cursor in the bar.
 						****/
 
-static void scrollProc (bar, data, position)
-	Widget		bar;
-	PanScrollRec *	data;
-	int		position;
+static void scrollProc (Widget bar, PanScrollRec *data, int position)
 {
   int	    distance;
   Position  previous;
@@ -299,57 +299,44 @@
 
 /****	Convenience functions	****/
 
-void XtSetPannerCanvas (self, canvas)
-	PannerWidget	self;
-	Widget	canvas;
+void XtSetPannerCanvas (Widget self, Widget canvas)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtSetPannerCanvas");
-  XtVaSetValues((Widget)self, XtNcanvas, canvas, NULL);
+  XtVaSetValues(self, XtNcanvas, canvas, NULL);
 }
 
-int XtPannerXPosition (self)
-	PannerWidget self;
+int XtPannerXPosition (Widget self)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtPannerXPosition");
-  return self->panner.horizontal.position;
+  return ((PannerWidget)self)->panner.horizontal.position;
 }
 
-int XtPannerYPosition (self)
-	PannerWidget self;
+int XtPannerYPosition (Widget self)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtPannerYPosition");
-  return self->panner.vertical.position;
+  return ((PannerWidget)self)->panner.vertical.position;
 }
 
-void XtSetPannerXPosition (self, position)
-	PannerWidget	 self;
-	int position;
+void XtSetPannerXPosition (Widget self, int position)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtSetPannerXPosition");
-  XtVaSetValues((Widget)self, XtNxPosition, position, NULL);
+  XtVaSetValues(self, XtNxPosition, position, NULL);
 }
 
-void XtSetPannerYPosition (self, position)
-	PannerWidget	 self;
-	int position;
+void XtSetPannerYPosition (Widget self, int position)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtSetPannerYPosition");
-  XtVaSetValues((Widget)self, XtNyPosition, position, NULL);
+  XtVaSetValues(self, XtNyPosition, position, NULL);
 }
 
-void XtSetPannerXRange (self, range)
-	PannerWidget	 self;
-	int range;
+void XtSetPannerXRange (Widget self, int range)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtSetPannerXRange");
-  XtVaSetValues((Widget)self, XtNxRange, range, NULL);
+  XtVaSetValues(self, XtNxRange, range, NULL);
 }
 
-void XtSetPannerYRange (self, range)
-	PannerWidget	 self;
-	int range;
+void XtSetPannerYRange (Widget self, int range)
 {
   XtCheckSubclass(self, pannerWidgetClass, "XtSetPannerYRange");
-  XtVaSetValues((Widget)self, XtNyRange, range, NULL);
+  XtVaSetValues(self, XtNyRange, range, NULL);
 }
-
--- src/xgrid/xgrid_Panner.h.orig	2012-01-13 19:27:17.000000000 +0100
+++ src/xgrid/xgrid_Panner.h	2012-04-15 13:17:45.000000000 +0200
@@ -84,14 +84,14 @@
 
 /* Convenience functions */
 
-extern void	XtSetPannerCanvas (); /* Widget w, Widget canvas */
+extern void	XtSetPannerCanvas (Widget, Widget canvas); /*  */
 
-extern int	XtPannerXPosition (); /* Widget w */
-extern int	XtPannerYPosition (); /* Widget w */
+extern int	XtPannerXPosition (Widget); /*  */
+extern int	XtPannerYPosition (Widget); /* Widget w */
 
-extern void     XtSetPannerXPosition (); /* Widget w, int x */
-extern void	XtSetPannerYPosition (); /* Widget w, int y */
-extern void	XtSetPannerXRange ();    /* Widget w, int x */
-extern void	XtSetPannerYRange ();    /* Widget w, int y */
+extern void     XtSetPannerXPosition (Widget, int); /* Widget w, int x */
+extern void	XtSetPannerYPosition (Widget, int); /* Widget w, int y */
+extern void	XtSetPannerXRange (Widget, int);    /* Widget w, int x */
+extern void	XtSetPannerYRange (Widget, int);    /* Widget w, int y */
 
 #endif /* _Panner_h */
--- src/xgrid/xgrid_Xutility.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_Xutility.c	2012-04-15 13:17:45.000000000 +0200
@@ -14,20 +14,17 @@
 
 #include "xgrid_Xutility.h"
 
-Dimension XtWidth (w)
-	Widget w;
+Dimension XtWidth (Widget w)
 {
   return w->core.width;
 }
 
-Dimension XtHeight (w)
-	Widget w;
+Dimension XtHeight (Widget w)
 {
   return w->core.height;
 }
 
-Widget XtShell (w)
-	Widget w;
+Widget XtShell (Widget w)
 {
   while (w != NULL && !XtIsSubclass(w, shellWidgetClass))
     w = XtParent(w);
@@ -36,8 +33,7 @@
 
 /****	Wait until all windows redrawn	****/
 
-void WaitNoExposes (w)
-	Widget w;
+void WaitNoExposes (Widget w)
 {
   XEvent	event;
   Display *	display;
@@ -56,8 +52,7 @@
 
 /****	Highlight things	****/
 
-void InvertWidget (w)
-  Widget w;
+void InvertWidget (Widget w)
 {
   Pixel foreground, background;
 
--- src/xgrid/xgrid_Xutility.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_Xutility.h	2012-04-15 13:17:45.000000000 +0200
@@ -4,19 +4,14 @@
 
 #define XSetPoint(pt, xVal, yVal) (pt).x = (xVal); (pt).y = (yVal)
 
-extern Dimension XtWidth ();
-		/* Widget w */
+extern Dimension XtWidth (Widget);	/* Widget w */
 
-extern Dimension XtHeight ();
-		/* Widget w */
+extern Dimension XtHeight (Widget);	/* Widget w */
 
-extern Widget XtShell ();
-		/* Widget w */
+extern Widget XtShell (Widget);		/* Widget w */
 		
-extern void   WaitNoExposes ();
-		/* Widget w */
+extern void   WaitNoExposes (Widget);	/* Widget w */
 
-extern void InvertWidget ();
-		/* Widget w */
+extern void InvertWidget (Widget);	/* Widget w */
 
 #endif
--- src/xgrid/xgrid_controls.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_controls.c	2012-04-15 13:17:45.000000000 +0200
@@ -21,11 +21,7 @@
 
 static Widget quitButton;
 
-Widget createControlBar (name, parent, args, nargs)
-	String name;
-	Widget parent;
-	Arg    args[];
-	int    nargs;
+Widget createControlBar (String name, Widget parent, Arg args[], int nargs)
 {
   Widget result;
   Arg    list[32];
@@ -54,10 +50,7 @@
    chooses to quit. Such callbacks must NOT call exit because
    the order in which callbacks are called is undefined.  */
    
-void addQuitCallback (callback, clientData)
-	XtCallbackProc callback;
-	void *	       clientData;
+void addQuitCallback (XtCallbackProc callback, void *clientData)
 {
   XtAddCallback(quitButton, XtNcallback, callback, clientData);
 }
-
--- src/xgrid/xgrid_controls.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_controls.h	2012-04-15 13:17:45.000000000 +0200
@@ -2,10 +2,10 @@
 #ifndef _controls_
 #define _controls_
 
-extern Widget	createControlBar ();
+extern Widget	createControlBar (String name, Widget parent, Arg args[], int nargs);
 		/* String name, Widget parent, Arg args[], int nargs */
 
-extern void addQuitCallback ();
+extern void addQuitCallback (XtCallbackProc callback, void * clientData);
 		/* XtCallbackProc callback, void * clientData */
 
 #endif
--- src/xgrid/xgrid_grid.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_grid.h	2012-04-15 13:17:45.000000000 +0200
@@ -27,30 +27,20 @@
 
 /****	Grid methods ****/
 
-typedef void      (* GridProc) (); /* Grid * grid, ... */
-typedef GridValue (* GridFunc) (); /* Grid * grid, ... */
-
 /****	Grid data structure	****/
 
-typedef struct {
+typedef struct _Grid_s {
 	int	 width;
 	int	 height;
 	int	 coordType; /* Nodes or pixels */
 	/****	Methods	****/
-	/* dispose (Grid * grid ) */
-	GridProc dispose;
-	/* readFromFile (Grid * grid, String fileName, int * status) */
-	GridProc readFromFile;
-	/* writeToFile (Grid * grid, String fileName, int * status) */
-	GridProc writeToFile;
-	/* getIndexes (Grid * grid, GridPoint * coords, XPoint * indexes) */
-	GridProc getIndexes;
-	/* getCoords (Grid * grid, XPoint * indexes, GridPoint * coords) */
-	GridProc getCoords;
-	/* set (Grid * grid, int xIndex, int yIndex, GridValue value) */
-	GridProc set;
-	/* get (Grid * grid, int xIndex, int yIndex) */
-	GridFunc get;
+	void (*dispose) (struct _Grid_s * grid );
+	void (*readFromFile) (struct _Grid_s *grid, String fileName, int * status);
+	void (*writeToFile) (struct _Grid_s * grid, String fileName, int * status);
+	void (*getIndexes) (struct _Grid_s * grid, GridPoint * coords, XPoint * indexes);
+	void (*getCoords) (struct _Grid_s * grid, XPoint * indexes, GridPoint * coords);
+	void (*set) (struct _Grid_s *grid, int xIndex, int yIndex, GridValue value);
+	GridValue (*get) (struct _Grid_s * grid, int xIndex, int yIndex);
 	} Grid;
 
 /****	Convenience macros to make code cleaner	****/
--- src/xgrid/xgrid_messages.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_messages.c	2012-04-15 13:17:45.000000000 +0200
@@ -16,11 +16,7 @@
 
 Widget	messageWidget = NULL;
 
-Widget createMessageLine (name, parent, args, nargs)
-	String name;
-	Widget parent;
-	Arg    args[];
-	int    nargs;
+Widget createMessageLine (String name, Widget parent, Arg args[], int nargs)
 {
   Widget result;
   Arg    list[32];
@@ -40,10 +36,8 @@
   return result;
 }
 
-void setMessageLine (newMessage)
-	String newMessage;
+void setMessageLine (String newMessage)
 {
   if (messageWidget != NULL)
     XtVaSetValues(messageWidget, XtNlabel, newMessage, NULL);
 }
-
--- src/xgrid/xgrid_messages.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_messages.h	2012-04-15 13:17:45.000000000 +0200
@@ -4,10 +4,8 @@
 
 extern Widget	messageWidget;
 
-extern Widget	createMessageLine ();
-		/* String name, Widget parent, Arg args[], int nargs */
+extern Widget	createMessageLine (String name, Widget parent, Arg args[], int nargs);
 
-extern void	setMessageLine ();
-		/* String newMessage */
+extern void	setMessageLine (String newMessage);
 #endif
 
--- src/xgrid/xgrid_textInput.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_textInput.c	2012-04-15 13:17:45.000000000 +0200
@@ -76,9 +76,7 @@
 static Widget	inputField;
 static Widget	undoButton;
 
-Widget createTextInputArea (parent)
-	Widget parent;
-{
+Widget createTextInputArea (Widget parent) {
   Widget label;
   
   undoButton = XtVaCreateManagedWidget("undo", commandWidgetClass, parent,
@@ -113,9 +111,7 @@
   
 }
 
-void setViewForInput (data)
-	TextViewData * data;
-{
+void setViewForInput (TextViewData *data) {
   theView = data;
   clearInputSelection();
   clearUndo();
@@ -138,10 +134,7 @@
   XtSetSensitive(undoButton, False);
 }
 
-void setInputSelection (col, row)
-	int	col;
-	int	row;
-{
+void setInputSelection (int col, int row) {
   char str[64];
 
   selection.col = col;
@@ -158,20 +151,17 @@
   XawTextSetInsertionPoint(inputField, strlen(str));
 }
 
-static void Beep (w, event, params, nparams)
-	Widget		w;
-	XEvent *	event;
-	String *	params;
-	Cardinal *	nparams;
-{
+static void Beep (Widget w,
+	XEvent *	event __attribute__((unused)),
+	String *	params __attribute__((unused)),
+	Cardinal *	nparams __attribute__((unused))) {
   XBell(XtDisplay(w), 100);
 }
 
-static void EnterNewValue (w, event, params, nparams)
-	Widget		w;
-	XEvent *	event;
-	String *	params;
-	Cardinal *	nparams;
+static void EnterNewValue (Widget w __attribute__((unused)),
+	XEvent * event __attribute__((unused)),
+	String * params __attribute__((unused)),
+	Cardinal * nparams __attribute__((unused)))
 {
   GridValue newValue;
   String    field;
@@ -198,10 +188,9 @@
   gridHasChanged = True;
 }
 
-static void undoNewValue (w, clientData, callData)
-	Widget	w;
-	void *	clientData;
-	void *	callData;
+static void undoNewValue (Widget w __attribute__((unused)),
+	void * clientData __attribute__((unused)),
+	void * callData __attribute__((unused)))
 {
   XPoint    index;
   GridPoint coord;
--- src/xgrid/xgrid_textInput.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_textInput.h	2012-04-15 13:17:45.000000000 +0200
@@ -1,12 +1,14 @@
 #ifndef _TEXTINPUT_
 #define _TEXTINPUT_
 
-extern Widget createTextInputArea (); /* Widget parent */
+#include "xgrid_textView.h"
 
-extern void setViewForInput (); /* TextViewData * data */
+extern Widget createTextInputArea (Widget parent); /*  */
 
-extern void clearInputSelection (); /* void */
-extern void setInputSelection (); /* int col, int row */
+extern void setViewForInput (TextViewData * data); /*  */
+
+extern void clearInputSelection (void); /*  */
+extern void setInputSelection (int col, int row); /*  */
 
 #endif
 
--- src/xgrid/xgrid_textView.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_textView.c	2012-04-15 13:17:45.000000000 +0200
@@ -43,26 +43,21 @@
 
 /****	Local procedures	****/
 
-static void handleRealize (); /* Widget w, TextViewData * data, void * call */
-static void handleExpose (); /* Widget w, void * data, Region area */
-static void createContexts (); /* Widget w, TextViewData * data */
-
-static void scrollHorizontal (); /* Widget w, TextViewData * data, int x */
-static void scrollVertical (); /* Widget w, TextViewData * data, int y */
-
-static void redrawValues (); /* Widget w,
-			Position left, Position top,
-			Dimension width, Dimension height */
-
-static void highlightCell (); /* Widget w, TextViewData * data, CellInfo * cell */
-static void lowlightCell ();  /* Widget w, CellInfo * cell */
-
-static void CursorMovement (); /* Widget w, XEvent * event,
-			String * params, Cardinal * nparams */
-static void ClearMessage (); /* Widget w, XEvent * event,
-			String * params, Cardinal * nparams */
-static void SelectValue (); /* Widget w, XEvent * event,
-			String * params, Cardinal * nparams */
+static void handleRealize (Widget w, XtPointer, XtPointer);
+static void handleExpose (Widget w, XtPointer, XtPointer);
+static void createContexts (Widget w, TextViewData * data);
+
+static void scrollHorizontal (Widget w, XtPointer, XtPointer);
+static void scrollVertical (Widget w, XtPointer, XtPointer);
+
+static void redrawValues (Widget w, Position left, Position top, Dimension width, Dimension height);
+
+static void highlightCell (Widget w, TextViewData * data, CellInfo * cell);
+static void lowlightCell (Widget w, CellInfo * cell);
+
+static void CursorMovement (Widget w, XEvent * event, String * params, Cardinal * nparams);
+static void ClearMessage (Widget w, XEvent * event, String * params, Cardinal * nparams);
+static void SelectValue (Widget w, XEvent * event, String * params, Cardinal * nparams);
 
 static XtResource ViewResourceList[] = {
   { XtNgrid, XtCGrid, XtRPointer, sizeof(XtPointer),
@@ -93,11 +88,10 @@
 
 /****	Initialization	****/
 
-Widget createTextView (name, parent, args, nargs)
-	String	name;
-	Widget	parent;
-	Arg	args[];
-	int	nargs;
+Widget createTextView (String	name,
+	Widget	parent,
+	Arg	args[],
+	int	nargs)
 {
   Widget result;
   TextViewData * data;
@@ -138,9 +132,7 @@
   return result;
 }
 
-void setTextViewGrid (view, grid)
-	Widget	view;
-	Grid *	grid;
+void setTextViewGrid (Widget	view, Grid *	grid)
 {
   TextViewData * data;
   
@@ -153,8 +145,7 @@
     XClearArea(XtDisplay(view), XtWindow(view), 0, 0, 0, 0, True);    
 }
 
-void recalculateDisplayParameters (view)
-	Widget	view;
+void recalculateDisplayParameters (Widget view)
 {
   TextViewData * data;
   XFontStruct *  font;
@@ -187,10 +178,7 @@
   }
 }
 
-void redrawGridValue (view, col, row)
-	Widget	view;
-	int	col;
-	int	row;
+void redrawGridValue (Widget view, int	col, int row)
 {
   TextViewData * data;
   int x, y;
@@ -206,9 +194,7 @@
 	window has been created, so do that when we
 	are realized.		****/
 
-static void createContexts (view, data)
-	Widget	       view;
-	TextViewData * data;
+static void createContexts (Widget view, TextViewData *data)
 {
   XFontStruct *  font;
   XGCValues 	 gcv;
@@ -239,35 +225,33 @@
   			GCForeground | GCBackground | GCFont, &gcv);
 }
 
-static void handleRealize (w, data, call)
-	Widget w;
-	TextViewData * data;
-	void * call;
+static void handleRealize (Widget w,
+	XtPointer client_data,
+	XtPointer call_data __attribute__((unused)))
 {
-  createContexts(w, data);
+  createContexts(w, client_data);
   recalculateDisplayParameters(w);
-  setViewForInput(data);
+  setViewForInput(client_data);
 }
 
 /****	Expose event handling	****/
 
-static void handleExpose (w, data, area)
-	Widget	w;
-	void *  data;
-	Region  area;
+static void handleExpose (Widget w,
+	XtPointer  client_data __attribute__((unused)),
+	XtPointer call_data)
 {
   XRectangle bbox;
   
+  Region  area = call_data;
   XClipBox(area, &bbox);
   redrawValues(w, bbox.x, bbox.y, bbox.width, bbox.height);
 }
 
-static void redrawValues (w, left, top, width, height)
-	Widget		w;
-	Position	left;
-	Position	top;
-	Dimension	width;
-	Dimension	height;
+static void redrawValues (Widget	w,
+	Position	left,
+	Position	top,
+	Dimension	width,
+	Dimension	height)
 {
   TextViewData * data;
   int	x, y;
@@ -331,10 +315,9 @@
 #define XIndex(x) (((x) + data->xOffset) / data->cellWidth)
 #define YIndex(y) (((y) + data->yOffset) / data->cellHeight)
 
-static void scrollHorizontal (w, data, x)
-	Widget		w;
-	TextViewData *	data;
-	int		x;
+static void scrollHorizontal (Widget w __attribute__((unused)),
+	XtPointer 	client_data,
+	XtPointer	call_data)
 {
   Widget    canvas;
   Dimension width, height;
@@ -343,6 +326,9 @@
   XPoint    index1, index2;
   GridPoint grid1, grid2;
 
+  TextViewData *data = client_data;
+  int		x = (int)call_data;
+
   canvas = data->canvas;
   width  = XtWidth(canvas);
   height = XtHeight(canvas);
@@ -377,10 +363,9 @@
   setMessageLine(msg);
 }
 
-static void scrollVertical (w, data, y)
-	Widget		w;
-	TextViewData *	data;
-	int		y;
+static void scrollVertical (Widget	w __attribute__((unused)),
+	XtPointer	client_data,
+	XtPointer	call_data)
 {
   Widget    canvas;
   Dimension width, height;
@@ -389,6 +374,9 @@
   XPoint    index1, index2;
   GridPoint grid1, grid2;
 
+  TextViewData *data = client_data;
+  int		y = (int)call_data;
+
   canvas = data->canvas;
   width  = XtWidth(canvas);
   height = XtHeight(canvas);
@@ -429,29 +417,26 @@
 
 /****	Event handling	****/
 
-static void highlightCell (w, data, cell)
-	Widget		w;
-	TextViewData *	data;
-	CellInfo *	cell;
+static void highlightCell (Widget		w,
+			   TextViewData *	data,
+			   CellInfo *	cell)
 {
   XDrawRectangle(XtDisplay(w), XtWindow(w), data->valueGC,
   	cell->bounds.x + 1, cell->bounds.y + 1,
 	cell->bounds.width - 2, cell->bounds.height - 2);
 }
 
-static void lowlightCell (w, cell)
-	Widget		w;
-	CellInfo *	cell;
+static void lowlightCell (Widget		w,
+			  CellInfo *	cell)
 {
   redrawValues(w, cell->bounds.x, cell->bounds.y,
   		cell->bounds.width, cell->bounds.height);
 }
 
-static void CursorMovement (w, event, params, nparams)
-	Widget		w;
-	XEvent *	event;
-	String *	params;
-	Cardinal *	nparams;
+static void CursorMovement (Widget	w,
+			    XEvent *	event,
+			    String *	params __attribute__((unused)),
+			    Cardinal *	nparams __attribute__((unused)))
 {
   TextViewData * data;
   char	    msg[256];
@@ -480,23 +465,20 @@
 }
 
 
-static void ClearMessage (w, event, params, nparams)
-	Widget		w;
-	XEvent *	event;
-	String *	params;
-	Cardinal *	nparams;
+static void ClearMessage (Widget	w, 
+			  XEvent *	event __attribute__((unused)),
+			  String *	params __attribute__((unused)),
+			  Cardinal *	nparams __attribute__((unused)))
 {
   lowlightCell(w, &cellUnderMouse);
   setMessageLine("");
 }
 
-static void SelectValue (w, event, params, nparams)
-	Widget		w;
-	XEvent *	event;
-	String *	params;
-	Cardinal *	nparams;
+static void SelectValue (Widget		w __attribute__((unused)),
+			 XEvent *	event __attribute__((unused)),
+			 String *	params __attribute__((unused)),
+			 Cardinal *	nparams __attribute__((unused)))
 {
   /* All the actual input is handled in textInput.c */
   setInputSelection(cellUnderMouse.index.x, cellUnderMouse.index.y);
 }
-
--- src/xgrid/xgrid_textView.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_textView.h	2012-04-15 13:17:45.000000000 +0200
@@ -45,16 +45,11 @@
 #endif
 #define XtCPrecision	"Precision"
 
-extern Widget createTextView ();
-		/* String name, Widget parent, Arg args[], int nargs */
+extern Widget createTextView (String name, Widget parent, Arg args[], int nargs);
 
-extern void setTextViewGrid ();
-		/* Widget view, Grid * grid */
+extern void setTextViewGrid (Widget view, Grid * grid);
 
-extern void recalculateDisplayParameters ();
-		/* Widget view */
+extern void recalculateDisplayParameters (Widget view);
 
-extern void redrawGridValue ();
-		/* Widget view, int col, int row */
+extern void redrawGridValue (Widget view, int col, int row);
 #endif
-
--- src/xgrid/xgrid_utility.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_utility.c	2012-04-15 13:17:45.000000000 +0200
@@ -6,12 +6,10 @@
 
 #include "xgrid_utility.h"
 
-FILE * CheckOpen (fileName, access)
-	String fileName;
-	String access;
+FILE * CheckOpen (String fileName, String access)
 {
   FILE * result;
-  char   msg[256];
+  char msg[256];
   
   result = fopen(fileName, access);
   if (result == NULL) {
@@ -21,10 +19,7 @@
   return result;
 }
 
-void CheckReadLine (file, line, maxLength)
-	FILE * file;
-	char   line[];
-	int    maxLength;
+void CheckReadLine (FILE *file, char line[], int maxLength)
 {
   char * result;
   
@@ -33,10 +28,7 @@
     XtError("Null returned by fgets");
 }
 
-void Trace (message)
-	String message;
-{
+void Trace (String message) {
   fprintf(stderr, "%s\n", message);
   fflush(stderr);
 }
-
--- src/xgrid/xgrid_utility.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_utility.h	2012-04-15 13:17:45.000000000 +0200
@@ -12,14 +12,15 @@
 #define RoundUp(n, unit) ((((n) + (unit) - 1) / (unit)) * (unit))
 #define RoundDown(n, unit) (((n) / (unit)) * (unit))
 
-extern FILE * CheckOpen ();
-	/* String fileName, String access */
+extern FILE * CheckOpen (String fileName, String access);
 
-extern void CheckReadLine ();
-	/* FILE * file, char line[], int maxLength */
+extern void CheckReadLine (FILE * file, char line[], int maxLength);
 
-extern void Trace ();
-	/* String message */
+extern void Trace (String message);
+
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
 	
 #endif
 
--- src/xgrid/xgrid_view.c.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_view.c	2012-04-15 13:17:45.000000000 +0200
@@ -38,14 +38,12 @@
 
 /****	Local procedures	****/
 
-static void getBaseName (); /* String fileName, String baseName */
-static void saveChanges (); /* Widget w, ViewData * view, void * callData */
-static void doSave (); /* Widget w, ViewData * view, void * callData */
-static void doDiscard (); /* Widget w, ViewData * view, void * callData */
+static void getBaseName (String fileName, String baseName);
+static void saveChanges (Widget w, XtPointer view, XtPointer callData);
+static void doSave (Widget w, XtPointer view, XtPointer callData);
+static void doDiscard (Widget w, XtPointer view, XtPointer callData);
 	  	
-static void getBaseName(fileName, baseName)
-	String fileName;
-	String baseName;
+static void getBaseName (String fileName, String baseName)
 {
   String slash, stop;
   
@@ -62,11 +60,10 @@
     *stop = '\0';
 }
 
-Widget createView (fileName, parent, args, nargs)
-	String fileName;
-	Widget parent;
-	Arg    args[];
-	int    nargs;
+Widget createView (String fileName,
+	Widget parent,
+	Arg args[],
+	int nargs)
 {
   Widget result;
   char   widgetName[255];
@@ -78,7 +75,7 @@
   strcpy(theView.fileName, fileName);
   theView.grid = CreateGMTGrid();
   Trace("Reading grid file...");
-  ReadGridFromFile(theView.grid, fileName, &err);
+  ReadGridFromFile((Grid *)theView.grid, fileName, &err);
   if (err) {
     sprintf(msg, "Unable to read file %s: C error code %d", fileName, err);
     XtError(msg);
@@ -109,8 +106,7 @@
   return result;
 }
 
-void createFileCommands (parent)
-	Widget	parent;
+void createFileCommands (Widget parent)
 {
   Widget save;
   
@@ -124,15 +120,16 @@
 /****	When the user quits, be nice and offer to save
 	any changes made in a popup dialog	****/
 	
-static void saveChanges (w, view, callData)
-	Widget	   w;
-	ViewData * view;
-	void *	   callData;
+static void saveChanges (Widget	w,
+	XtPointer client_data,
+	XtPointer callData __attribute__((unused)))
 {
   Widget	dialog;
   XtAppContext	app;
   XEvent	event;
-  
+ 
+  ViewData *view = client_data;
+
   if (! gridHasChanged)
     return;
     
@@ -161,18 +158,19 @@
   }
 }
 
-static void doSave (w, view, callData)
-	Widget	   w;
-	ViewData * view;
-	void *	   callData;
+static void doSave (Widget w,
+	XtPointer client_data,
+	XtPointer callData __attribute__((unused)))
 {
   String saveName;
   int    err;
   char	 msg[256];
   
+  ViewData *view = client_data;
+
   saveName = XawDialogGetValueString(XtParent(w));
   strcpy(view->fileName, saveName);
-  WriteGridToFile(view->grid, view->fileName, &err);
+  WriteGridToFile((Grid *)view->grid, view->fileName, &err);
   if (err) {
     sprintf(msg, "Unable to save file %s: C error code %d", saveName, err);
     setMessageLine(msg);
@@ -187,15 +185,12 @@
   }
 }
 
-static void doDiscard (w, view, callData)
-	Widget	   w;
-	ViewData * view;
-	void *	   callData;
+static void doDiscard (Widget w __attribute__((unused)),
+	XtPointer view __attribute__((unused)),
+	XtPointer callData __attribute__((unused)))
 {
   XtPopdown(saveChangesPopup);
   XtDestroyWidget(saveChangesPopup);
   /* MUST do this, otherwise save dialog loops forever */
   saveChangesPopup = NULL;
 }
-
-
--- src/xgrid/xgrid_view.h.orig	2011-08-17 23:58:25.000000000 +0200
+++ src/xgrid/xgrid_view.h	2012-04-15 13:17:45.000000000 +0200
@@ -10,11 +10,9 @@
 	Widget	  canvas;
 	} ViewData;
 
-extern Widget	createView ();
-		/* String fileName, Widget parent, Arg args[], int nargs */
+extern Widget	createView (String fileName, Widget parent, Arg args[], int nargs);
 
-extern void	createFileCommands ();
-		/* Widget parent */
+extern void	createFileCommands (Widget parent);
 
 /* Anything which changes the grid must set this flag */
 
--- src/xyz2grd.c.orig	2012-03-22 00:18:28.000000000 +0100
+++ src/xyz2grd.c	2012-04-15 13:17:45.000000000 +0200
@@ -456,33 +456,33 @@
 			float value;
 			
 			grd.node_offset = 0;
-			fgets (line, BUFSIZ, fp);
+			(void)fgets (line, BUFSIZ, fp);
 			GMT_chop (line);					/* Rid the world of CR/LF */
 			if (sscanf (line, "%*s %d", &grd.nx) != 1) {
 				fprintf (stderr, "%s: Error decoding ncols record\n", GMT_program);
 				exit (EXIT_FAILURE);
 			}
-			fgets (line, BUFSIZ, fp);
+			(void)fgets (line, BUFSIZ, fp);
 			GMT_chop (line);					/* Rid the world of CR/LF */
 			if (sscanf (line, "%*s %d", &grd.ny) != 1) {
 				fprintf (stderr, "%s: Error decoding ncols record\n", GMT_program);
 				exit (EXIT_FAILURE);
 			}
-			fgets (line, BUFSIZ, fp);	GMT_str_tolower (line);
+			(void)fgets (line, BUFSIZ, fp);	GMT_str_tolower (line);
 			GMT_chop (line);					/* Rid the world of CR/LF */
 			if (sscanf (line, "%*s %lf", &grd.x_min) != 1) {
 				fprintf (stderr, "%s: Error decoding xll record\n", GMT_program);
 				exit (EXIT_FAILURE);
 			}
 			if (!strncmp (line, "xllcorner", (size_t)9)) grd.node_offset = 1;	/* Pixel grid */
-			fgets (line, BUFSIZ, fp);	GMT_str_tolower (line);
+			(void)fgets (line, BUFSIZ, fp);	GMT_str_tolower (line);
 			GMT_chop (line);					/* Rid the world of CR/LF */
 			if (sscanf (line, "%*s %lf", &grd.y_min) != 1) {
 				fprintf (stderr, "%s: Error decoding yll record\n", GMT_program);
 				exit (EXIT_FAILURE);
 			}
 			if (!strncmp (line, "yllcorner", (size_t)9)) grd.node_offset = 1;	/* Pixel grid */
-			fgets (line, BUFSIZ, fp);
+			(void)fgets (line, BUFSIZ, fp);
 			GMT_chop (line);					/* Rid the world of CR/LF */
 			if (sscanf (line, "%*s %lf", &grd.x_inc) != 1) {
 				fprintf (stderr, "%s: Error decoding cellsize record\n", GMT_program);
@@ -500,7 +500,7 @@
 
 			a = (float *) GMT_memory (VNULL, (size_t)nm, sizeof (float), GMT_program);
 			if (!Ctrl->E.set) {	/* Only read if not specified in -E */
-				fgets (line, BUFSIZ, fp);
+				(void)fgets (line, BUFSIZ, fp);
 				GMT_chop (line);					/* Rid the world of CR/LF */
 				if (sscanf (line, "%*s %lf", &Ctrl->E.nodata) != 1) {
 					fprintf (stderr, "%s: Error decoding nodata_value record\n", GMT_program);
--- src/mgd77/mgd77.c	(revision 9793)
+++ src/mgd77/mgd77.c	(working copy)
@@ -854,7 +854,7 @@
 			case  3:	strcpy (P->Parameters_Surveyed_Code, word);			break;
 			case  4:	strncpy (P->File_Creation_Year, word, 4);
 					strncpy (P->File_Creation_Month, &word[4], 2);
-					strncpy (P->File_Creation_Day, &word[6], 4);			break;
+					strncpy (P->File_Creation_Day, &word[6], 2);			break;
 			case  5:	strcpy (P->Source_Institution, word);				break;
 			case  6:	strcpy (P->Country, word);					break;
 			case  7:	strcpy (P->Platform_Name, word);				break;
@@ -865,11 +865,11 @@
 			case 12:	strcpy (P->Funding, word);					break;
 			case 13:	strncpy (P->Survey_Departure_Year, word, 4);
 					strncpy (P->Survey_Departure_Month, &word[4], 2);
-					strncpy (P->Survey_Departure_Day, &word[6], 4);			break;
+					strncpy (P->Survey_Departure_Day, &word[6], 2);			break;
 			case 14:	strcpy (P->Port_of_Departure, word);				break;
 			case 15:	strncpy (P->Survey_Arrival_Year, word, 4);
 					strncpy (P->Survey_Arrival_Month, &word[4], 2);
-					strncpy (P->Survey_Arrival_Day, &word[6], 4);			break;
+					strncpy (P->Survey_Arrival_Day, &word[6], 2);			break;
 			case 16:	strcpy (P->Port_of_Arrival, word);				break;
 			case 17:	strcpy (P->Navigation_Instrumentation, word);			break;
 			case 18:	strcpy (P->Geodetic_Datum_Position_Determination_Method, word);	break;
