blob: bda0a0f188fb308de6dd821f5e83acf284443d66 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/sh
# \
PATH=$UWEBDIR/bin:$PATH; exec jimsh $0 "$@"
# vim:se syn=tcl:
while {[stdin gets buf] >= 0} {
if {$buf eq "@INSERTINDEX@"} {
break
}
puts $buf
}
# Collect lines and commands
set lines {}
set commands {}
set c 0
while {[stdin gets buf] >= 0} {
if {[string match "~~*" $buf]} {
if {[string match "*:*" $prev]} {
incr c
set target cmd_$c
set lines [linsert $lines end-1 "\[\[$target\]\]"]
} else {
set target _$prev
}
foreach cmd [split $prev ":,"] {
set cmd [string trim $cmd]
if {$cmd ne ""} {
lappend commands [list $cmd $target]
}
}
}
lappend lines $buf
set prev $buf
}
# Output the index
puts {[frame="none",grid="none"]}
puts {|=========================}
set i 0
foreach command [lsort $commands] {
foreach {cmd target} $command break
puts -nonewline "|<<$target,$cmd>> "
incr i
if {$i % 8 == 0} {
puts ""
}
}
while {$i % 8 != 0} {
incr i
puts -nonewline "| "
}
puts ""
puts {|=========================}
puts [join $lines \n]
|