w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 3004c62881657cd3db76c071f852e3ec7e10b09b
parent 6016ac9e0724cb62ba6704b6685a17ac73b2ba90
Author: ukai <ukai>
Date:   Tue, 15 Jan 2002 03:45:02 +0000

[w3m-dev 02834] mailto: use external program

Diffstat:
Mconfigure | 4++++
Mframe.c | 6++++--
Mmain.c | 6+++++-
Mscripts/Makefile | 2+-
Murl.c | 19++++++++++++++++---
5 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/configure b/configure @@ -699,6 +699,9 @@ fi # protocols? ask_param "External URI loader support" use_external_uri_loader y +if [ "$use_external_uri_loader" = y ]; then + ask_param "Use w3mmail.cgi" use_w3mmailer y +fi ask_param "NNTP support" use_nntp $include_opt ask_param "Gopher support" use_gopher $include_opt @@ -2046,6 +2049,7 @@ $def_use_ssl $def_use_ssl_verify $def_ftppass_hostnamegen $def_use_external_uri_loader +$def_use_w3mmailer $def_use_nntp $def_use_gopher $def_use_alarm diff --git a/frame.c b/frame.c @@ -677,8 +677,10 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level, tag->value[j] = url_quote_conv(tag->value[j], code); parseURL2(tag->value[j], &url, &base); - if (url.scheme == SCM_MAILTO || - url.scheme == SCM_UNKNOWN || + if (url.scheme == SCM_UNKNOWN || +#ifndef USE_W3MMAILER + url.scheme == SCM_MAILTO || +#endif url.scheme == SCM_MISSING) break; a_target |= 1; diff --git a/main.c b/main.c @@ -2602,6 +2602,7 @@ followA(void) return; } } +#ifndef USE_W3MMAILER if (!strncasecmp(a->url, "mailto:", 7)) { /* invoke external mailer */ fmTerm(); @@ -2611,6 +2612,7 @@ followA(void) displayBuffer(Currentbuf, B_FORCE_REDRAW); return; } +#endif #ifdef USE_NNTP else if (!strncasecmp(a->url, "news:", 5) && strchr(a->url, '@') == NULL) { /* news:newsgroup is not supported */ @@ -3539,6 +3541,7 @@ cmd_loadURL(char *url, ParsedURL *current) { Buffer *buf; +#ifndef USE_W3MMAILER if (!strncasecmp(url, "mailto:", 7)) { /* invoke external mailer */ fmTerm(); @@ -3548,8 +3551,9 @@ cmd_loadURL(char *url, ParsedURL *current) displayBuffer(Currentbuf, B_FORCE_REDRAW); return; } +#endif #ifdef USE_NNTP - else if (!strncasecmp(url, "news:", 5) && strchr(url, '@') == NULL) { + if (!strncasecmp(url, "news:", 5) && strchr(url, '@') == NULL) { /* news:newsgroup is not supported */ disp_err_message("news:newsgroup_name is not supported", TRUE); return; diff --git a/scripts/Makefile b/scripts/Makefile @@ -6,7 +6,7 @@ LIB_DIR = $(prefix)/lib/w3m HELP_DIR = $(prefix)/lib/w3m RC_DIR = ~/.w3m -LIB_TARGETS = dirlist.cgi w3mhelp.cgi +LIB_TARGETS = dirlist.cgi w3mhelp.cgi w3mmail.cgi HELP_LIBS = w3mhelp-funcname.pl w3mhelp-funcdesc.pl MKDIR = mkdir -p diff --git a/url.c b/url.c @@ -69,7 +69,9 @@ struct cmdtable schemetable[] = { /* {"exec", SCM_EXEC}, */ {"nntp", SCM_NNTP}, {"news", SCM_NEWS}, +#ifndef USE_W3MMAILER {"mailto", SCM_MAILTO}, +#endif #ifdef USE_SSL {"https", SCM_HTTPS}, #endif /* USE_SSL */ @@ -945,9 +947,10 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current) int relative_uri = FALSE; parseURL(url, pu, current); +#ifndef USE_W3MMAILER if (pu->scheme == SCM_MAILTO) return; - +#endif if (pu->scheme == SCM_LOCAL) pu->file = expandName(pu->file); @@ -1107,10 +1110,12 @@ _parsedURL2Str(ParsedURL *pu, int pass) } tmp = Strnew_charp(scheme_str[pu->scheme]); Strcat_char(tmp, ':'); +#ifndef USE_W3MMAILER if (pu->scheme == SCM_MAILTO) { Strcat_charp(tmp, pu->file); return tmp; } +#endif #ifdef USE_NNTP if (pu->scheme != SCM_NEWS) #endif /* USE_NNTP */ @@ -1955,6 +1960,10 @@ filename_extension(char *path, int is_url) #ifdef USE_EXTERNAL_URI_LOADER static struct table2 **urimethods; +static struct table2 default_urimethods[] = { + {"mailto", "file:///$LIB/w3mmail.cgi?%s"}, + {NULL, NULL} +}; static struct table2 * loadURIMethods(char *filename) @@ -2046,11 +2055,15 @@ searchURIMethods(ParsedURL *pu) return NULL; for (i = 0; (ump = urimethods[i]) != NULL; i++) { - while (ump->item1 != NULL) { + for (; ump->item1 != NULL; ump++) { if (strcmp(ump->item1, scheme->ptr) == 0) { return Sprintf(ump->item2, url_quote(url->ptr)); } - ump++; + } + } + for (ump = default_urimethods; ump->item1 != NULL; ump++) { + if (strcmp(ump->item1, scheme->ptr) == 0) { + return Sprintf(ump->item2, url_quote(url->ptr)); } } return NULL;