#!/bin/sh
# @(#) stock 1.2 Delta: 95/10/12 17:18:19 Extraction: 95/10/12 17:19:27 @(#)
#
# stock
#
# author: l. loebel carpenter, computing division, fermilab
#
# history:
# 27sep95	lll	Initial.  Merely a wrapper to pass commands to
#			the VMS system stock.fnal.gov hosting the
#			actual One True stock command.
#
#

# parameters which are needed in the program and may need to be
# set later:

server="stock.fnal.gov"			# an alias in the name server
user="stock_svr"			# a blind account for serving stock information
if [ `funame -s` = "HP-UX" ]
then
	RSH=remsh
else
	RSH=rsh
fi

#Check to make sure some arguments were given to avoid VMS error message
if [ $# -eq 0 ]
then
	echo "$0: Usage: stock searchstring1 [,searchstring2...]"
	exit 1
fi

#
# first get the [unix-style] command line, complete with " -" instead of 
# the vms style "/" character.  convert.
# NOTE that we require a space before the options (unlike VMS), because
# we do NOT want to convert the "-" character that might appear inside
# of a name!  (We assume that names don't ever contain " -"...)  We need to
# manually add a leading " " so that if the first character of the ${*} is
# a minus, it also gets converted.
#

cmdvals=`echo " ${*}" | sed 's% -% \/%g'`
#
# now rsh over to the server node and let it handle the 
# actual stock command.
#

${RSH} ${server} -l ${user} "stock ${cmdvals}"
exit 0
