Archived
3
0

graph script

This commit is contained in:
Philippe PITTOLI 2017-09-26 14:57:35 +02:00
parent 4ff34a227f
commit 7305833c6a

View File

@ -7,50 +7,40 @@ fi
echo "font : $FONT" echo "font : $FONT"
DIAG=diag # $1 = program, $2 = filename extension
for i in *\.$DIAG function graphit()
do {
PNG=$(echo ${i} | sed "s/$DIAG$/pdf/") 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
if [ ! -f ${PNG} ] || [ $(stat -c "%X" ${PNG}) -lt $(stat -c "%X" ${i}) ] PROGOPT="-Tpdf"
then 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 seqdiag ${i} echo touch ${PDF}
seqdiag -Tpdf -a -f $FONT ${i} touch ${PDF}
fi
echo touch ${PNG} done
touch ${PNG}
fi fi
done }
PKTDIAG=pktdiag graphit "seqdiag" "diag"
for i in *\.$PKTDIAG graphit "packetdiag" "pktdiag"
do graphit "nwdiag" "nwdiag"
PNG=$(echo ${i} | sed "s/$PKTDIAG$/pdf/") graphit "dot" "gviz-dot"
if [ ! -f ${PNG} ] || [ $(stat -c "%X" ${PNG}) -lt $(stat -c "%X" ${i}) ]
then
echo seqdiag ${i}
packetdiag -Tpdf -a -f $FONT ${i}
echo touch ${PNG}
touch ${PNG}
fi
done
# GDOT="gviz-dot"
# for i in *\.$GDOT
# do
# PDF=$(echo ${i} | sed "s/$GDOT$/pdf/")
#
# if [ ! -f ${PDF} ] || [ $(stat -c "%X" ${PDF}) -lt $(stat -c "%X" ${i}) ]
# then
#
# echo dot ${i}
# dot -Tpdf ${i} > ${PDF}
#
# echo touch ${PDF}
# touch ${PDF}
# fi
# done