lovely and talented sake broadcast on comp.unix.bsd.freebsd.misc:
Quote:> Hi,
> from what i understand when you write of "invoked by lynx"
> you mean the script is part of a web page and invoked by
> a browser client (cgi thing).
No. What I mean is a web page has a link to an image, lynx can
identify the MIME type from the file extension, and I want lynx to
call something to display the image, all of this being done client
side. The server has nothing to do with except to serve the image in
the ordinary way when lynx asks for it. The thing that can display
the image when lynx is in the console is zgv. In X lynx is usually
configured to use xv to display images. Lynx can be configured to
use various handlers for various MIME types or it will use the
handlers in mailcap or .mailcap if it can find either of these. The
special problem with images is that image handlers require graphics
modes, which the console can reach but other ttyvs can't. This is
why a script has to be written to test for the console before
actually launching the graphics handler.
Quote:> The invoked script will inherit the enviroment from
> the web server wich is not attached to a terminal as most
> of the daemons in the standard config.
Well, I settled for the cheap hack (I often do) and
test for ttyv0 on login, setting $CONSOLE if true.
Since all of this is client-side, the client-side
environment is what counts, and I cannot see anything
in the environment that my shell (BASH) automatically
sets that will tell me whether I am in the console.
Quote:> if the above asummption is correct you will have to
> either get the tty of the client browser or you will have to
> do a two step: write picutre into file and then present it
> on the web (i have no experiences with zgv what so ever).
I had to hack it for a while to convince it to run on FreeBSD.
It's a very swift image viewer for the console that relies on
the svgalib (with the security issues that entails for some
people).
Here is the running script. (I will not advise anyone
how to hack zgv because I am not sure how horrible I
made things from a security standpoint.)
#!/bin/sh
#This is to handle images for lynx. If in X, lynx shouldn't really
#use it and should be configured to call xzgv (or your favorite X
#image viewer) itself, but provision is made here for completeness.
#Zgv will only work in the console, so this should refuse to start in
#other ttyvs. $CONSOLE is set in /ect/profile at login if login
#is on ttyv0.
if [ "$DISPLAY" = "" ];
then
if [ "$CONSOLE" = "yes" ];
then
zgv -i -J 1 -k -z $1
else
echo not in console
fi
else
xzgv $1
#or your favorite X image viewer
fi
#end
Quote:> You should also take look at
> comp.unix.shell
> comp.infosystems.www.authoring.cgi
> hope this heps
> sake.
--
War on Terrorism: Treat Readers like Mushrooms
"If the story needs rewriting to play down the civilian casualties, DO IT."
-Memo, _Panama City_ (FL) _News Herald_