1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

MIME: When there is no % in the handler string (no %s in the mailcap entry)

the handler reads data from stdin. I think it only works with copiousoutput.

[ Part 1/2 of commit 4a7b9415e1 on the
  witekfl branch, fixes bug 916.  I'm leaving out delayed_goto_uri()
  for now because I don't understand its purpose.  --KON ]
This commit is contained in:
Witold Filipczyk 2007-02-21 13:43:16 +01:00 committed by Kalle Olavi Niemitalo
parent 988313ac9b
commit b3fa9a7019

View File

@ -785,6 +785,9 @@ static unsigned char *
subst_file(unsigned char *prog, unsigned char *file)
{
struct string name;
/* When there is no %s in the mailcap entry, the handler program reads
* data from stdin instead of a file. */
int input = 1;
if (!init_string(&name)) return NULL;
@ -797,6 +800,7 @@ subst_file(unsigned char *prog, unsigned char *file)
prog += p;
if (*prog == '%') {
input = 0;
#if defined(HAVE_CYGWIN_CONV_TO_FULL_WIN32_PATH)
#ifdef MAX_PATH
unsigned char new_path[MAX_PATH];
@ -813,6 +817,19 @@ subst_file(unsigned char *prog, unsigned char *file)
}
}
if (input) {
struct string s;
if (init_string(&s)) {
add_to_string(&s, "/bin/cat ");
add_char_to_string(&s, '"');
add_to_string(&s, file);
add_to_string(&s, "\" | ");
add_string_to_string(&s, &name);
done_string(&name);
return s.source;
}
}
return name.source;
}