#! /usr/bin/awk -f
#
# trnsfig.awk -- adds a missing "set linewidth" operation when splines
# are used. This error in fig2dev applies (at least) to version 3.1.2.
#
# Harald Albrecht, albrecht@igpm.rwth-aachen.de
#
/[0-9]+.[0-9]* slw/ {
	nops = split(substr($0, match($0, "[0-9]+.[0-9]* slw")), ops)
	linewidth = ops[1]
}

/^gs n [0-9]+.[0-9]* [0-9]+.[0-9]* m/ {
	sub("gs n", "gs " linewidth " slw\nn")
}

{
	print
}
# End of trnsfig.awk
