File: fixlab.sh

package info (click to toggle)
librnd 4.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,812 kB
  • sloc: ansic: 126,990; sh: 2,602; makefile: 2,145; awk: 7
file content (43 lines) | stat: -rwxr-xr-x 734 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
awk '
($2 == "->") {

	if (NF > 3) {
		attr=$0
		if (!(attr ~ "[[]"))
			attr = attr "[]"
	}
	else
		attr = "[]"

	tmp = "lbl" (++lbl)
	if (attr ~ "label")
		extra_label=""
	else
		extra_label="label=\"\""

	tmp_attr = attr
	attr1=attr
	attr2=attr

	if (extra_label == "")
		sub("^[^[]*[[]", "[style=filled fillcolor=\"#fefefe\" shape=plaintext ", tmp_attr)
	else {
#		tmp_attr = "[fixedsize=true width=0 shape=plaintext " extra_label "]"
		print $0
		next
	}

	sub("^[^[]*[[]", "[", attr1)
	sub("^[^[]*[[]", "[", attr2)
	sub("label=\".*\"", "", attr1)
	sub("label=\".*\"", "", attr2)
	sub("[[]", "[arrowhead=none ", attr1)

	print tmp, tmp_attr
	print $1, "->", tmp, attr1
	print tmp, "->", $3, attr2
	next
}
{ print $0 }
'