$NetBSD: patch-ab,v 1.1 2003/01/08 17:29:06 tsarna Exp $

Drew Einhorn's gpsfetchmap.pl enhancements from:

http://s2.selwerd.nl/~dirk-jan/gpsdrive/archive/msg01772.html

also require this patch to support tree'd rather than flap map
driectories.

--- src/gpsdrive.c.orig	Sun Dec  8 09:43:33 2002
+++ src/gpsdrive.c	Wed Jan  8 12:20:48 2003
@@ -2926,12 +2926,22 @@
     }
   for (i = 0; i < nrmaps; i++)
     {
+      /* strip off the path, we just want to check the filename */
+      char *fullname;
+      char *rslash;
+      char *filename;
+
       skip = TRUE;
+
+      fullname = (maps + i)->filename;
+      rslash = strrchr(fullname, '/');
+      filename = rslash == NULL ? fullname : rslash + 1;
+
       if (displaymap_map)
-	if (!(strncmp ((maps + i)->filename, "map_", 4)))
+	if (!(strncmp (filename, "map_", 4)))
 	  skip = FALSE;
       if (displaymap_top)
-	if (!(strncmp ((maps + i)->filename, "top_", 4)))
+	if (!(strncmp (filename, "top_", 4)))
 	  skip = FALSE;
 
       if (skip)
@@ -3101,8 +3111,17 @@
 
   for (i = 0; i < nrmaps; i++)
     {
-      if ((strncmp ((maps + i)->filename, "map_", 4)))
-	if ((strncmp ((maps + i)->filename, "top_", 4)))
+      /* strip off the path, we just want to check the filename */
+      char *fullname;
+      char *rslash;
+      char *filename;
+
+      fullname = (maps + i)->filename;
+      rslash = strrchr(fullname, '/');
+      filename = rslash == NULL ? fullname : rslash + 1;
+
+      if ((strncmp (filename, "map_", 4)))
+	if ((strncmp (filename, "top_", 4)))
 	  {
 	    GString *error;
 	    error = g_string_new (NULL);
