Saurabh T <saur...@hotmail.com> writes:

> 1. In the function do_type_query (session/download.c), the variable 
> 'handler', which
> comes from the get_mime_type_handler call in setup_download_handler in the
> same file, is NULL. Thus the dialog box that comes up when you hit say 'view
> image' has the title "Unknown type" (from the 'else'  block in do_type_query) 
> but
> mentions the correct mime type in the text, for example:
> What would you like to do with the file 'blah.png' (type: image/png)?
>
> 2. Since there's no mime handler, none of the 'set mime.handler.*' options in
> elinks.conf work, so in the above dialog box, the program field is blank, no
> matter how the file handling is configured.

How have you configured it, then?  AFAICT, there are two ways
ELinks can find a program to run for a given MIME content type:

(a) Map the MIME content type to a handler name via the
    mime.type.* options, and then map handler name to a program
    via the mime.handler.* options.
(b) Map the MIME content type directly to a program, by reading
    a mailcap file.

Which of these are you trying to use?  You mentioned mime.handler.*
so I guess you're trying (a).  Did you set mime.type.* too?

set mime.type.image.png = "pngpicture"
set mime.handler.pngpicture.win32 = "some-viewer %"
set mime.handler.pngpicture.win32-xwin = "some-viewer %"
set mime.handler.pngpicture.unix = "some-viewer %"
set mime.handler.pngpicture.unix-xwin = "some-viewer %"

I don't know whether SYSTEM_STR is "win32" or "unix" on Cygwin,
nor whether you have X there.

> 3. If I actually manually type in a program name, the % should represent the
> filename but it gets badly mangled: there is an error of the following sort 
> from the application:
> Could not find file c:cygwintmpelinks22d184.0.blah.png (something like that).

That is probably a bug in subst_file() in src/session/download.c.
It gets the name of a temporary file as a parameter.  On most
systems, when it sees the '%', it calls add_shell_quoted_to_string(),
which adds 'single quotes' around the name and escapes any similar
quotes within the name.  On Cygwin however, subst_file() instead
calls cygwin_conv_to_full_win32_path() and add_to_string().
I guess the result of cygwin_conv_to_full_win32_path() has
backslashes as directory separators, and subst_file() then returns
those as part of the command to be executed by the shell; but if
the shell is a Unix-like shell from Cygwin, then it treats the
backslashes as quoting characters instead.

There is this line in subst_file():

                        add_to_string(&name, new_path);

Perhaps if you changed it to:

                        add_shell_quoted_to_string(&name, new_path, 
strlen(new_path));

then it would work better?
_______________________________________________
elinks-users mailing list
elinks-users@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-users

Reply via email to