ZURL - Zephyr hack for zwriting people URLs.
This is a hack for the truely lazy. It explains how to zwrite a URL to somebody, and allow them to execute a browser on that URL with a single mouse click. Included is a Perl/Tk ZURL handler called handle_zurl. All it (or any replacement you care to write) needs to do is read some information from stdin, and execute the browser. The handle_zurl script included uses a Tk dialog to get user verification for a little added security. Most of the work is acutally done by zwgc, so this file mostly explains how to setup your .zwgc.desc properly. If you run zwgc without X, you will get a formatted normal zephyr rather than having handle_zurl executed.
In order to use ZURL, you have to do some stuff. You should have a
.zwgc.desc file in your home directory. Edit it and find the
case statement that switches on $class.
There will be something like:
case $class
match "WG_CTL_CLASS"
exit
[. . .]
endcase
and you need to add a match statement. Make sure you
place it under this case statement, and not some
other nested one. The magic thing to add is:
match "URL"
if (zvar("zurl_accept") == "true") then
if ($output_driver != "X") then
fields signature body
print "@center(@b(ZURL) From: "+$fullsender
print " on "+$fromhost
print " at "+$time+"\n\n@b("+$body+"))\n"
put
else
fields signature body
set urlport = "urlport"
execport $urlport zvar("zurl_handler")
print zvar("zurl_browser")+"\n"+$sender
print "@"+$fromhost+"\n"+$auth
print "\n"+$body+"\n"
put $urlport
closeport $urlport
endif
endif
exit
After that, you need to set some ``zephyr variables''. The variables known are:
zurl_accept - if not true , then ignore
ZURLs completely.
zurl_handler - set to the full path of
handle_zurl, or some other program if one exists.
zurl_browser - the web browser that you want to use.
Must be able to be executed with just a URL on the command line,
like:
% chimera http://www.cs.unlv.edu/you can always write a shell script wrapper if this is not the case.
To send a ZURL to somebody, you need to zwrite them with the class set to URL and the message body containing only the URL you want to send. For example:
% zwrite somebody -c URL -m http://www.cs.unlv.edu/If you actually do it that way, you are not nearly lazy enough for ZURL. Here is a Bourne shell function that makes it easier. Note that you can even send to more than one user at a time.
zurl ()
{
set +u;
if [ -z "$1" -o -z "$2" ]; then
echo usage: zurl \<url\> \<list of users\>;
return 1;
fi;
url="$1";
shift;
zwrite $* -c URL -m $url >/dev/null
}
~/.zwgc.desc the user's Zephyr description file.
zctl(1) , zephyr(1) , zwgc(1) , zwrite(1)
This is both the first Perl 5 program and the first Tk program I have written. There are undoubtedly better ways do to this.
I used strftime from the POSIX module because I thought it was neat. This means that it won't work on systems that don't have the POSIX module, but it is trivial to change the code to make it do the right thing for your system.
This is also my first manpage, so any comments on it are appreciated. It is written in Larry Wall's POD format, which appears to make nice looking man pages and nice looking HTML, and nice look LaTeX, etc.
(c) Copyright 1996 by Steve Lumos. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Please send me any improvements you make.
Steve Lumos <slumos@cs.unlv.edu>