[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LYNX-DEV passing a url to a program
From: |
Jim Dennis |
Subject: |
Re: LYNX-DEV passing a url to a program |
Date: |
Tue, 16 Sep 1997 22:36:23 -0700 |
> I can the following command in the shell prompt:
> rpm -qip ftp://ftp.redhat.com/pub/contrib/i386/SOME_THING.rpm
> This command retrieves information about the file SOME_THING.rpm
That is a feature of the rpm program (Red Hat Package Manager).
> How can if configure lynx so that it could pass the current URL
> to the above command?
I tried to read that as:
"How can I configure Lynx so that it could pass the current
URL to the 'rpm' command?"
OH! You want to create a "helper app" for .rpm files?
Why didn't you just say so.
Lynx (and all of the old browsers) supported a feature
called "helper apps." This allows you to create a list of
associations between filename patterns (mostly "extensions")
and local programs.
Implicitly .html (and .htm and .shtml) files are handled by
the browser directly. Typically .au files are handled by a
sound player. You might configure .tar and .tar.gz files to
launch a copy of 'mc' (midnight commander -- a file browser
which is primarily found on Linux systems but is popular on
others as well).
For that mattern you'd probably be better off configuring
.rpm files to launch 'mc' since it knows how to "browse"
these files as easily as it can any directory tree.
In any event I don't have time to look up the details or
provide a tested example. However I can point you in the
right direction.
These "helper applications" are also known as MIME types.
MIME = multi-purpose mail extensions -- since this was
originally intended to be a way to include easier handling
of files attached/embedded in e-mail, to allow the creation
of multi-media e-mail with graphics, sound clips, animation,
and whatever. Also owing to that origin the default name of
the client configuration file is the .mailcap file in your
Unix (Linux) home directory.
So, try 'man mailcap'
(I con't know if Lynx uses this or not -- perhaps someone
else on the list can answer that).
> That is:
>
> I would like to press a key in lynx to invoke the rpm command and I
> would like that lynx pass the current URL as a parameter to the command.
Well, this isn't exactly what I've described. For that
I think you'd have to do one of two things:
Patch Lynx (write your own modifications in C).
Run Lynx under 'expect' and write an expect wrapper
script that would catch the keystroke you want to
assign to this and run a TCL/expect procedure that
did something like:
send Lynx the "=" command (to display
info about the current Lynx page and link
parse that screen for the "Filename:"
information.
extract/isolate the URL listed thereunder
(using expect's regex and string handling
functions).
send Lynx a Ctrl-Z (suspend) command.
wait for a shell prompt
issue the rpm command -- and paste in the
value it isolated above.
This psuedo code is pretty close to expect's own code
(send, and waitfor are common expect commands, and binding
keystrokes to functions is one of it's best features).
I don't have time to write and debug this right now (its
been months since I used expect/TCL) but it would probably
only take about an hour -- the screen scanning and string
isolation is the part I hate).
--
Jim Dennis (800) 938-4078 address@hidden
Proprietor, Starshine Technical Services: http://www.starshine.org
PGP 1024/2ABF03B1 Jim Dennis <address@hidden>
Key fingerprint = 2524E3FEF0922A84 A27BDEDB38EBB95A
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;