mkarrows.sh 880 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #! /bin/ksh
  2. #
  3. # usage: mkarrows.sh [-s] <arrow>
  4. #
  5. # where arrow starts with *_ and has a suffix indicating the
  6. # desired output format.
  7. SHAPE=
  8. while getopts ":s" c; do
  9. case "$c" in
  10. s)
  11. STYLE="shape=point style=invis"
  12. ;;
  13. esac
  14. done
  15. shift OPTIND-1
  16. if (( $# == 0 ))
  17. then
  18. echo "genarrows: missing arrow name argument"
  19. exit 1
  20. fi
  21. TGT=$1 # abc_arrowname.fmt
  22. ARROW=${1%.*} # abc_arrowname
  23. FMT=${1#$ARROW.} # fmt
  24. A=${ARROW#*_} # arrowname
  25. F=$ARROW.dot # abc_arrowname.dot
  26. #for s in $(cat $INFILE)
  27. #do
  28. # if [[ a_$s.gif -ot genarrows ]]
  29. # then
  30. # F=$s.dot
  31. exec 3> $F
  32. echo "digraph G {" >&3
  33. echo " rankdir=LR;" >&3
  34. echo " T [shape=point];" >&3
  35. echo " H [label=\"\" $STYLE];" >&3
  36. echo " T -> H [arrowhead=$A];" >&3
  37. echo "}" >&3
  38. exec 3>&-
  39. dot -Tgif $F > $TGT
  40. rm -f $F
  41. # fi
  42. #done