--- links-0.96/url.c Sun Dec 31 22:26:52 2000 +++ links-0.96-ifl/url.c Wed Jan 9 01:34:38 2002 @@ -18,6 +18,11 @@ {"mailto", 0, NULL, mailto_func, 0, 0, 0}, {"telnet", 0, NULL, telnet_func, 0, 0, 0}, {"tn3270", 0, NULL, tn3270_func, 0, 0, 0}, + + /* Not actually a scheme but needed to make links recognise + * these as absolute URLs. */ + {"ifl", 0, NULL, 0, 0, 0}, + {NULL, 0, NULL} }; @@ -356,7 +361,26 @@ static int r = 0; unsigned char *ch; unsigned char *nu, *da; + while(*url == ' ') url++; + + if (!casecmp(url, "ifl:", 4)) { + unsigned char *url2, *p, *q, *r; + const char urlbase[] = "http://www.google.com/search?btnI=1&q="; + + /* Note that this is totally bogus, and will not work at all in the + * presence of random characters in the ifl: url. */ + url2 = (unsigned char *)calloc(strlen(url) + sizeof urlbase, 1); + strcpy(url2, urlbase); + for (p = url + 4, q = url2 + strlen(url2); + *p /*&& (isalnum((int)*p) || strchr("\"`'+", (char)*p))*/; + ++p, ++q) + *q = *p; + r = translate_url(url2, cwd); + free(url2); + return r; + } + if (!casecmp("proxy://", url, 8)) goto prx; if (!parse_url(url, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &da, NULL, NULL)) { nu = stracpy(url);