#!/bin/bash #----------------------------------------------- # Formats an Internet Draft using xml2rfc # # Parameters are input (xml) file and output (txt) # file. # # Result is 0 if no error, 1 if error. Also writes # any error text to stdout. #----------------------------------------------- # # Version 1.1 # May 4, 2007 # Randall Gellens # #----------------------------------------------- #----------------------------------------------- function set_creator_code () { if [ -x $SETFILE ]; then $SETFILE -c $EDITOR_CREATOR_CODE $1 #else #echo "$SETFILE doesn't exist or not executable" fi } #----------------------------------------------- SETFILE="/Developer/Tools/SetFile" EDITOR_CREATOR_CODE="R*ch" BIBLIO_DIR="$HOME/IETF/bibxml" ERR_FILE="/tmp/format_xml_rfc" XML2RFC="xml2rfc.tcl" # # For those of us who like BBEdit, often a # command-line flag or variant is used in # $EDITOR which doesn't return until the file # is closed. This is great for things like # crontab, but not so good when we want to just # open the file in the editor. So, if the # environment variable EDITOR_NOWAIT is defined, # use it, otherwise use EDITOR. # OPEN=${EDITOR_NOWAIT:-$EDITOR} if [ $# -lt 2 ]; then X=$(basename $0) echo "usage: $X input-file output-file"; exit 1 fi # # Locate the file xml2rfc.tcl, which is required by # the xml2rfc tools # if [ -e $XML2RFC ]; then XML2RFC=$XML2RFC elif [ -e ~/$XML2RFC ]; then XML2RFC=~/$XML2RFC elif [ -e /usr/local/bin/$XML2RFC ]; then XML2RFC=/usr/local/bin/$XML2RFC else echo "No such file: $XML2RFC" exit 1 fi inputF="$1" outputF="$2" sourceD=`dirname "$1"` #echo "Input file: $inputF" #echo "Output file: $outputF" #echo "Directory: $sourceD" XML_LIBRARY="$XML_LIBRARY:$sourceD" for bibxmlD in $(ls $BIBLIO_DIR) do if [ -d "$BIBLIO_DIR/$bibxmlD" ]; then XML_LIBRARY="$XML_LIBRARY:$BIBLIO_DIR/$bibxmlD" fi done #echo "XML_LIBRARY: $XML_LIBRARY" tclsh > $ERR_FILE 2>&1 <