#!/bin/csh -f # wxbg2 -- Get a weather map image and put it in the X11 root window # # This is a shorter version of the wxbg script, using httpcat for http # (instead of ftp) to get the map image. (Use wxbg for ftp'ing images.) # # Usage: wxbg2 [-v] [-] [URL] # # The optional - flag will display one of the many preset # URL's in the list below. Or you can specify the URL on the command # line (only http is currently supported). The -v "verbose" flag # displays the URL itself on stdout. # # Requirements: the 'httpcat' perl script and the 'xv' display program. # # You can get httpcat from: # ftp://feynman.physics.lsa.umich.edu/pub/myers/src/www # # See http://weather.unisys.com/surface/details.html for info on # how to read the maps, or http://weather.unisys.com/ for general info. # # Eric Myers - 26 July 1999 # Department of Physics, University of Michigan, Ann Arbor # @(#) $Id: wxbg2,v 2.0 1999/08/10 21:38:45 myers Exp myers $ ###################################################################### # Configuration: edit for your installation # Where can we find httpcat and xv? set path =( $HOME/bin /usr/local/bin /usr/X11R6/bin/ /usr/bin/ /bin ) # Pick the image you want (some can be coarse or cluttered). # Any URL to an image will do (it doesn't even have to be a weather map) # as long as it uses http (not ftp -- use wxbg for that). # Feel free to add to this list -- just remember to escape the line end. set URLLIST=( \ http://weather.unisys.com/satellite/sat_sfc_map.gif \ http://weather.unisys.com/images/sat_sfc_map.gif \ http://weather.unisys.com/surface/sfc_depict.gif \ http://weather.unisys.com/surface/sfc_map.gif \ http://weather.unisys.com/surface/sfc_mw.gif \ http://weather.unisys.com/surface/images/sfc_map.gif \ ) # Where to save the map temporarily? set TMPFILE=/usr/tmp/wxmap.gif # Which X display? This need not be set if you run the script # interactively, but it has to be set if you want to run from cron. set DISPLAY="-display :0" ###################################################################### set N = $#URLLIST # number of URL's in the list set J = 1 # which one to display? set opt_v=0 # verbose? # Parse command line options: while ( $#argv ) switch ( $1 ) case -[0-9]*: @ J = 0 - $1 breaksw case -v: set opt_v=1 breaksw case -*: echo "${0:t}: unknown flag $1" exit 1 default: set URL="$1" endsw shift end # Use $J to select which URL to use. But use $URL if it was specified. if ( $J < 1 ) set J=1 if ( $J > $N ) then echo ${0:t}: there are only $N possible maps. Using -$N. set J=$N endif if ( ! $?URL ) then set URL=$URLLIST[$J] endif if ( $opt_v ) echo "$URL" # Okay, go get the file and display it: httpcat $URL > $TMPFILE if ( ! -z $TMPFILE ) then xv $DISPLAY -max -root -quit $TMPFILE endif exit