namazu-users-en
[Top] [All Lists]

patch to support newstyle urls

2002-03-18 04:33:40
the following patch will support newstyle urls (ie, those that use ; 
instead of & to separate query parameters), as well as old style.

If you only want to support reading, then only use the patch for cgi.c.  
If you also want to output newstyle urls (in the Page: [1] [2] ...) 
list, then also patch output.c

Philip


--- output.c-old        Tue Dec 25 11:41:06 2001
+++ output.c    Mon Mar 18 16:45:32 2002
@@ -471,12 +471,15 @@
            for (qs += strlen("whence="); isdigit(*qs); qs++);
        } else {
            /* '"' is converted to entities """ */
-           putc_entitize(*qs);
+           if(*qs == '&')
+                putc_entitize(';');
+           else
+               putc_entitize(*qs);
            qs++;
        }
     }
     if (foo == 0) {
-       printf("&whence=%d", w);
+       printf(";whence=%d", w);
     }
 }
 
@@ -525,7 +528,7 @@
        printf("[%d]", i + 1);
        if (is_htmlmode()) {
            if (i * max != whence) {
-               printf("</A> ");
+               printf("</a> ");
            } else
                printf("</strong> ");
        }
--- cgi.c-old   Mon Mar 18 16:54:47 2002
+++ cgi.c       Mon Mar 18 16:56:31 2002
@@ -252,6 +252,7 @@
     while (1) {
        int len;
        const char *tmp;
+       const char *tmp2;
        char name[BUFSIZE];
        char value[BUFSIZE];
 
@@ -270,6 +271,10 @@
 
        querystring++;
        tmp = strchr(querystring, '&');
+       tmp2 = strchr(querystring, ';');
+       if(tmp2 && tmp2 < tmp || !tmp)
+           tmp = tmp2;
+
        if (tmp == NULL) {
            tmp = querystring + strlen(querystring);  /* last point: '\0' */
        }



<Prev in Thread] Current Thread [Next in Thread>
  • patch to support newstyle urls, Philip S Tellis <=