#! /bin/sh

if [ $# -eq 3 ]
then

  HOTLIST=$1
  SS=$2
  SUBJECT=$3

  #open a ssci commands file, make sure the subject exists
  echo newsubject \"$SUBJECT\" > $$.tmp

  #open hotlist, bind to standard in & read past first two lines
  exec <$HOTLIST
  read null
  read null

  while read LINE1
	do
	read LINE2 
	TITLE=$LINE2
	set $LINE1
	URL=$1
	echo newresource \"$URL\" \"$TITLE\" \"$SUBJECT\" >> $$.tmp
	done

  #run the commands on ssci
  ssci $SS < $$.tmp
  rm $$.tmp

else
  echo need three args:
  echo	 _hotlist file_ _name of subject space_ _subject to fill_ 
  echo	eg fill-ss-with-hotlist ~/.mosaic-hotlist-default test-ss none
fi



