--- GMT4.0/src/gmt_init.c.orig	Mon Nov 29 13:45:21 2004
+++ GMT4.0/src/gmt_init.c	Mon Nov 29 13:47:09 2004
@@ -2233,7 +2233,7 @@
 
 	if (get == 0) {	/* Must use GMT system defaults via gmt.conf */
 	
-		sprintf (line, "%s%cshare%cgmt.conf", GMTHOME, DIR_DELIM, DIR_DELIM);
+		sprintf (line, "%s%cshare%cgmt%cgmt.conf", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 		if ((fp = fopen (line, "r")) == NULL) {
 			fprintf (stderr, "GMT Fatal Error: Cannot open/find GMT configuration file %s\n", line);
 			exit (EXIT_FAILURE);
@@ -2254,7 +2254,7 @@
 		id = get;
 	
 	id--;	/* Get 0 or 1 */
-	sprintf (line, "%s%cshare%c.gmtdefaults_%s", GMTHOME, DIR_DELIM, DIR_DELIM, suffix[id]);
+	sprintf (line, "%s%cshare%cgmt%c.gmtdefaults_%s", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, suffix[id]);
 
 	path = (char *) GMT_memory (VNULL, (size_t)(strlen (line) + 1), (size_t)1, GMT_program);
 	
@@ -2363,7 +2363,7 @@
 		FILE *fp;
 		char line[BUFSIZ], path[BUFSIZ];
 			
-		sprintf (path, "%s%cshare%c%s", GMTHOME, DIR_DELIM, DIR_DELIM, name);
+		sprintf (path, "%s%cshare%cgmt%c%s", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, name);
 		
 		if (!strcmp ("Sphere", name)) {
 			/* Special case where previous setting in .gmtdefaults4 is a custom ellipse which
@@ -2443,7 +2443,7 @@
 
 	GMT_set_home ();
 
-	sprintf (line, "%s%cshare%cgmtmedia.d", GMTHOME, DIR_DELIM, DIR_DELIM);
+	sprintf (line, "%s%cshare%cgmt%cgmtmedia.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 	if ((fp = fopen (line, "r")) == NULL) return (0);
 
 	n_alloc = GMT_TINY_CHUNK;
@@ -2501,10 +2501,10 @@
 	char file[BUFSIZ], line[BUFSIZ], full[16], abbrev[16], c[16], dwu;
 	int i, nm = 0, nw = 0, nu = 0;
 	
-	sprintf (file, "%s%cshare%ctime%c%s.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, name);
+	sprintf (file, "%s%cshare%cgmt%ctime%c%s.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM, name);
 	if ((fp = fopen (file, "r")) == NULL) {
 		fprintf (stderr, "GMT Warning: Could not load %s - revert to us (English)!\n", name);
-		sprintf (file, "%s%cshare%ctime%cus.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+		sprintf (file, "%s%cshare%cgmt%ctime%cus.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 		if ((fp = fopen (file, "r")) == NULL) {
 			fprintf (stderr, "GMT Error: Could not find %s!\n", file);
 			exit (EXIT_FAILURE);
@@ -4638,7 +4638,7 @@
 	int code = 0;
 	FILE *in;
 
-	sprintf (line, "%s%cshare%cpslib%c%s.ps", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, enc->name);
+	sprintf (line, "%s%cshare%cgmt%cpslib%c%s.ps", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM, enc->name);
 	in = GMT_fopen (line, "r");
 
 	if (!in)
@@ -4715,7 +4715,7 @@
 	
 	/* First the standard 35 PostScript fonts from Adobe */
 	
-	sprintf (fullname, "%s%cshare%cpslib%cPS_font_info.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+	sprintf (fullname, "%s%cshare%cgmt%cpslib%cPS_font_info.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if ((in = fopen (fullname, "r")) == NULL)
 	{
@@ -4745,7 +4745,7 @@
 	
  	/* Then any custom fonts */
 	
-	sprintf (fullname, "%s%cshare%cpslib%cCUSTOM_font_info.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+	sprintf (fullname, "%s%cshare%cgmt%cpslib%cCUSTOM_font_info.d", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if (!access (fullname, R_OK)) {	/* Decode Custom font file */
 	
--- GMT4.0/src/gmt_plot.c.orig	Mon Nov 29 13:45:36 2004
+++ GMT4.0/src/gmt_plot.c	Mon Nov 29 13:47:09 2004
@@ -4182,7 +4182,7 @@
 	sprintf (file, "%s.def", name);
 	
 	if (access (file, R_OK)) {	/* Not in current dir, try GMTHOME */
-		sprintf (file, "%s%cshare%ccustom%c%s.def", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, name);
+		sprintf (file, "%s%cshare%cgmt%ccustom%c%s.def", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM,  name);
 		if (access (file, R_OK)) {	/* Not there either - give up */
 			fprintf (stderr, "GMT ERROR: %s : Could not find custom symbol %s\n", GMT_program, name);
 			exit (EXIT_FAILURE);
--- GMT4.0/src/gmt_support.c.orig	Mon Nov 29 13:45:11 2004
+++ GMT4.0/src/gmt_support.c	Mon Nov 29 13:47:09 2004
@@ -5400,7 +5400,7 @@
 
 	/* First check the $GMTHOME/share directory */
 	
-	sprintf (path, "%s%cshare%c%s", GMTHOME, DIR_DELIM, DIR_DELIM, name);
+	sprintf (path, "%s%cshare%cgmt%c%s", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, name);
 	if (!access (path, R_OK)) return (TRUE);	/* File exists and is readable, return with name */
 	
 	/* File was not readable.  Now check if it exists */
@@ -5414,7 +5414,7 @@
 	 * It is not an error if we cannot find the named file, only if it is found
 	 * but cannot be read due to permission problems */
 	
-	sprintf (dir, "%s%cshare%ccoastline.conf", GMTHOME, DIR_DELIM, DIR_DELIM);
+	sprintf (dir, "%s%cshare%cgmt%ccoastline.conf", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 	if (!access (dir, F_OK))  { /* File exists... */
 		if (access (dir, R_OK)) {	/* ...but cannot be read */
 			fprintf (stderr, "%s: Error: GMT does not have permission to open %s!\n", GMT_program, dir);
@@ -5915,7 +5915,7 @@
 	
 	/* Open the list in $GMTHOME/share */
 
-	sprintf (list, "%s%cshare%cGMT_CustomSymbols.lis", GMTHOME, DIR_DELIM, DIR_DELIM);
+	sprintf (list, "%s%cshare%cgmt%cGMT_CustomSymbols.lis", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if ((fp = fopen (list, "r")) == NULL) {
 		fprintf (stderr, "%s: ERROR: Cannot open file %s\n", GMT_program, list);
--- GMT4.0/src/grd2cpt.c.orig	Mon Nov 29 13:44:59 2004
+++ GMT4.0/src/grd2cpt.c	Mon Nov 29 13:47:09 2004
@@ -70,7 +70,7 @@
 
 	/* Get list of available color tables in $GMTHOME/share/cpt */
 
-	sprintf (CPT_lis, "%s%cshare%cGMT_CPT.lis", GMTHOME, DIR_DELIM, DIR_DELIM);
+	sprintf (CPT_lis, "%s%cshare%cgmt%cGMT_CPT.lis", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if ((fpc = fopen (CPT_lis, "r")) == NULL) {
 		fprintf (stderr, "%s: ERROR: Cannot open file %s\n", GMT_program, CPT_lis);
@@ -212,9 +212,9 @@
 
 	if (!ok)	{	/* No table in current dir, try /share */
 		if (table)
-			sprintf (CPT_file, "%s%cshare%ccpt%cGMT_%s.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, table);
+			sprintf (CPT_file, "%s%cshare%cgmt%ccpt%cGMT_%s.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM, table);
 		else	/* Default to rainbow colors */
-			sprintf (CPT_file, "%s%cshare%ccpt%cGMT_rainbow.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+			sprintf (CPT_file, "%s%cshare%cgmt%ccpt%cGMT_rainbow.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 		if (access (CPT_file, R_OK)) {
 			fprintf (stderr, "%s: ERROR: Cannot find colortable %s\n", GMT_program, CPT_file);
--- GMT4.0/src/makecpt.c.orig	Mon Nov 29 13:44:52 2004
+++ GMT4.0/src/makecpt.c	Mon Nov 29 13:47:09 2004
@@ -49,7 +49,7 @@
 
 	/* Get list of available color tables in $GMTHOME/share/cpt */
 
-	sprintf (CPT_lis, "%s%cshare%cGMT_CPT.lis", GMTHOME, DIR_DELIM, DIR_DELIM);
+	sprintf (CPT_lis, "%s%cshare%cgmt%cGMT_CPT.lis", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if ((fpc = fopen (CPT_lis, "r")) == NULL) {
 		fprintf (stderr, "%s: ERROR: Cannot open file %s\n", GMT_program, CPT_lis);
@@ -147,9 +147,9 @@
 
 	if (!ok)	{	/* No table in current dir, try /share */
 		if (table)
-			sprintf (CPT_file, "%s%cshare%ccpt%cGMT_%s.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, table);
+			sprintf (CPT_file, "%s%cshare%cgmt%ccpt%cGMT_%s.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM, table);
 		else	/* Default to rainbow colors */
-			sprintf (CPT_file, "%s%cshare%ccpt%cGMT_rainbow.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+			sprintf (CPT_file, "%s%cshare%cgmt%ccpt%cGMT_rainbow.cpt", GMTHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 		ok = !access (CPT_file, R_OK);
 		if (!ok) {
--- GMT4.0/src/pslib.c.orig	Mon Nov 29 13:44:41 2004
+++ GMT4.0/src/pslib.c	Mon Nov 29 13:47:09 2004
@@ -881,7 +881,7 @@
 	if ((image_no >= 0 && image_no < N_PATTERNS) && ps_pattern_status[image_no][invert]) return (image_no);	/* Already done this */
 
 	if ((image_no >= 0 && image_no < N_PATTERNS)) {	/* Premade pattern yet not used */
-		sprintf (file, "%s%cshare%cpattern%cps_pattern_%2.2d.ras", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, image_no);
+		sprintf (file, "%s%cshare%cgmt%cpattern%cps_pattern_%2.2d.ras", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM, image_no);
 		ps_pattern_status[image_no][invert] = 1;
 	}
 	else {	/* User image, check to see if already used */
@@ -899,7 +899,7 @@
 			if (!access (imagefile, R_OK))
 				strcpy (file, imagefile);
 			else
-				sprintf (file, "%s%cshare%c%s", PSHOME, DIR_DELIM, DIR_DELIM, imagefile);
+				sprintf (file, "%s%cshare%cgmt%c%s", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, imagefile);
 		}
 		ps_user_image[ps_n_userimages].name = (char *) ps_memory (VNULL, (size_t)(strlen (imagefile)+1), sizeof (char));
 		strcpy (ps_user_image[ps_n_userimages].name, imagefile);
@@ -3797,7 +3797,7 @@
 	char buf[80];
 	char fullname[BUFSIZ];
 
-	sprintf (fullname, "%s%cshare%cpslib%c%s.ps", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, fname);
+	sprintf (fullname, "%s%cshare%cgmt%cpslib%c%s.ps", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM, fname);
 
 	in = fopen (fullname, "r");
 	if (in == NULL)
@@ -3822,7 +3822,7 @@
 	
 	/* First the standard 35 PostScript fonts from Adobe */
 	
-	sprintf (fullname, "%s%cshare%cpslib%cPS_font_info.d", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+	sprintf (fullname, "%s%cshare%cgmt%cpslib%cPS_font_info.d", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if ((in = fopen (fullname, "r")) == NULL)
 	{
@@ -3852,7 +3852,7 @@
 	
  	/* Then any custom fonts */
 	
-	sprintf (fullname, "%s%cshare%cpslib%cCUSTOM_font_info.d", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM);
+	sprintf (fullname, "%s%cshare%cgmt%cpslib%cCUSTOM_font_info.d", PSHOME, DIR_DELIM, DIR_DELIM, DIR_DELIM, DIR_DELIM);
 
 	if (!access (fullname, R_OK)) {	/* Decode Custom font file */
 	
--- GMT4.0/src/gmt_grdio.c.orig    2005-08-24 16:36:17.000000000 -0400
+++ GMT4.0/src/gmt_grdio.c	2005-08-24 16:36:21.000000000 -0400
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------
- *	$Id: gmt_grdio.c,v 1.17 2004/04/20 18:29:36 pwessel Exp $
+ *	$Id: gmt_grdio.c,v 1.19 2004/10/11 00:40:36 pwessel Exp $
  *
  *	Copyright (c) 1991-2004 by P. Wessel and W. H. F. Smith
  *	See COPYING file for copying and redistribution conditions.
@@ -447,6 +447,7 @@
 		G->id = GMT_grd_get_o_format (file, G->name, &G->scale, &G->offset);
 		G->check = !GMT_is_dnan (GMT_grd_out_nan_value);
 	}
+	G->scale = G->header.z_scale_factor;	G->offset = G->header.z_add_offset;
 	if (GRD_IS_CDF (G->id)) {		/* Open netCDF file */
 		check_nc_status (nc_open (G->name, cdf_mode[r_w], &G->fid));
 		check_nc_status (nc_inq_varid (G->fid, "z", &G->z_id));	/* Get variable id */
