#!/bin/sh # # halogentry.file, halogentry.edt, halogentry.emacs, halogentry.vi, # # 10/15/97 (saw) Replacement for the halogentry.* scripts. # 10/31/97 (saw) V2 - New modes for preformated and text files. # # Scripts for different editors may be soft linked to this script # (halogentry.file). This script will look at the word after the last "." in # it's own name to find out which editor to use. If commandline arguments are # given, then no editor is called. Instead $1 is used as the filename of # pre-prepared html file to insert into the elog. If $2 exists, then it is # used as the keyword. # usage () { echo "Usage:" echo " halogentry.html filename [key phrase]" echo " Pass file unmodified to elog. For use where file contains" echo " www ready html code." echo " halogentry.text filename [key phrase]" echo " Replace blank lines with line breaks" echo " halogentry.pre filename [key phrase]" echo " halogentry.file filename [key phrase]" echo " Filename is preformatted. Wrap it with
" echo " Good for use with program output or listings" echo "" echo " If the key phrase is more than one word, surround it with a pair of \"'s" exit } rootdir=/home/adaq/halog webdir=/home/adaq/public_html/halog/log/tmp_html bindir=$rootdir/src destination=$rootdir/tmp pwd=`pwd` lognum=`$bindir/halognumber` # Make a feeble attempt to get a unique activity file activity_file_created=0 # Probably should have some infinite loop protection until [ $activity_file_created -eq 1 ]; do # Derive activity_file and logdate from same date. dateelements=`date "+%H:%M:%S:%y:%Y:%d:%e:%m:%B"` activity_file_basename=`echo $dateelements | sed -e 's/\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/\4\8\6\1\2\3/'` activity_file_text=$destination/$activity_file_basename.text logdate=`echo $dateelements | sed -e 's/\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/\1:\2:\3 on \9 \7, \5/'` if [ ! -e $activity_file_text ]; then touch $activity_file_text activity_file_created=1 else sleep 1 fi done activity_file_html=$webdir/$activity_file_basename.html activity_file_new=$destination/$activity_file_basename.new.html mode=${0##*.} if [ $# -gt 0 ]; then # We have a prepared html file to log $bindir/halogheader $LOGNAME "$logdate" "$lognum" > $activity_file_new if [ $# -gt 1 ]; then if [ $# -gt 2 ]; then echo "" >>$activity_file_new fi echo "keyword=$2
" >>$activity_file_new cat $1 >> $activity_file_new echo "" >>$activity_file_new ;; esac echo "