#!/bin/bash

#
# Launches viewer of specific algorithm version
# (needs to be merged with viewmpslogicdoc.bash)
#
# ggv was not working properly on the OPI's
#VIEWER=ggv
VIEWER=firefox
ALG_NAME=$1

if [[ -d "/afs" ]]; then
    CONFIG_PATH="/afs/slac.stanford.edu/u/xr/snorum/ioc/mpsConfiguration"
else
    CONFIG_PATH="/usr/local/lcls/epics/iocTop/MachineProtection/mpsConfiguration"
fi

ALG_NAME=`caget "$ALG_NAME_PV" | awk '{print $2}'`
PDF="${CONFIG_PATH}/algorithm/${1}/doc/MPSLogicDocumentation.pdf"

$VIEWER "$PDF"

