[w3m-dev 04135] Re: schemetable is broken

Kiyokazu SUTO <[email protected]> 21 Jan 2005 22:08:37 +0900
Newsgroups gmane.comp.web.w3m.devel
Message-ID <[email protected]>
Citation (with leading "> " of each line) from article:
  <[email protected]>
    by Kiyokazu SUTO <[email protected]> :
>   http://pc5.2ch.net/test/read.cgi/unix/1087225153/959-969
>
> #ifdef INET6
> 
>
> # make

SCM_FTPDIR

-- 
  <[email protected]>
http://pub.ks-and-ks.ne.jp/pgp-public-key.html

Index: url.c
===================================================================
RCS file: /cvsroot/w3m/w3m/url.c,v
retrieving revision 1.89
diff -u -r1.89 url.c
--- url.c	16 Apr 2004 18:47:19 -0000	1.89
+++ url.c	21 Jan 2005 13:05:07 -0000
@@ -67,21 +67,29 @@
 #endif				/* USE_SSL */
 };
 
-struct cmdtable schemetable[] = {
+static struct cmdtable schemetable[] = {
     {"http", SCM_HTTP},
     {"gopher", SCM_GOPHER},
     {"ftp", SCM_FTP},
+    {"", SCM_FTPDIR},
     {"local", SCM_LOCAL},
     {"file", SCM_LOCAL},
     /*  {"exec", SCM_EXEC}, */
+    {"", SCM_EXEC},
     {"nntp", SCM_NNTP},
     /*  {"nntp", SCM_NNTP_GROUP}, */
+    {"", SCM_NNTP_GROUP},
     {"news", SCM_NEWS},
     /*  {"news", SCM_NEWS_GROUP}, */
+    {"", SCM_NEWS_GROUP},
     {"data", SCM_DATA},
-#ifndef USE_W3MMAILER
-    {"mailto", SCM_MAILTO},
+    {
+#ifdef USE_W3MMAILER
+      ""
+#else
+      "mailto"
 #endif
+      , SCM_MAILTO},
 #ifdef USE_SSL
     {"https", SCM_HTTPS},
 #endif				/* USE_SSL */
@@ -1255,11 +1263,13 @@
     if (*p == ':') {		/* scheme found */
 	scheme = SCM_UNKNOWN;
 	for (i = 0; (q = schemetable[i].cmdname) != NULL; i++) {
-	    int len = strlen(q);
-	    if (!strncasecmp(q, *url, len) && (*url)[len] == ':') {
-		scheme = schemetable[i].cmd;
-		*url = p + 1;
-		break;
+	    if (*q) {
+		int len = strlen(q);
+		if (!strncasecmp(q, *url, len) && (*url)[len] == ':') {
+		    scheme = schemetable[i].cmd;
+		    *url = p + 1;
+		    break;
+		}
 	    }
 	}
     }