-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathB
executable file
·33 lines (28 loc) · 855 Bytes
/
B
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
#!/usr/bin/env tclsh
#
# open one or more files with "ma", or locate already open instance
set exec_prefix ""
if {[info exists env(HERE)]} {
set exec_prefix $env(HERE)/exec/
}
if {$argc == 0} {
puts stderr "usage: B FILENAME[:ADDR] ..."
exit 1
}
foreach x $argv {
if {[regexp {^(.*):([^:]*)$} $x whole file addr]} {
set fname [file normalize $whole]
if {[file exists $fname]} {
exec ${exec_prefix}ma-eval -async MA-registry FindFile "{$fname}" &
continue
}
set fname [file normalize $file]
if {[file exists $fname]} {
exec ${exec_prefix}ma-eval -async MA-registry FindFile "{$fname}" $addr &
continue
}
} else {
set fname [file normalize $x]
exec ${exec_prefix}ma-eval -async MA-registry FindFile "{$fname}" &
}
}