3
0
Fork 0
This repository has been archived on 2022-01-17. You can view files and clone it, but cannot push or open issues/pull-requests.
recipes-parser/grammar/graph-this.sh

47 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
if [ "$FONT" = "" ]
then
FONT=/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf
fi
echo "font : $FONT"
# $1 = program, $2 = filename extension
function graphit()
{
PROG=$1
FNEXT=$2
ls *.$FNEXT 2>/dev/null 1>&2
if [ $? -eq 0 ]; then
for i in *\.$FNEXT
do
PDF=$(echo ${i} | sed "s/$FNEXT$/pdf/")
if [ ! -f ${PDF} ] || [ $(stat -c "%X" ${PDF}) -lt $(stat -c "%X" ${i}) ]
then
PROGOPT="-Tpdf"
case $PROG in
"seqdiag" | "packetdiag" | "nwdiag")
PROGOPT="$PROGOPT -a -f $FONT"
echo ${PROG} ${PROGOPT} ${i}
${PROG} ${PROGOPT} ${i}
;;
"dot")
echo "${PROG} ${PROGOPT} ${i} > ${PDF}"
${PROG} ${PROGOPT} ${i} > ${PDF}
;;
esac
echo touch ${PDF}
touch ${PDF}
fi
done
fi
}
graphit "seqdiag" "diag"
graphit "packetdiag" "pktdiag"
graphit "nwdiag" "nwdiag"
graphit "dot" "dot"