blob: ebbaff78e3f8e0589cc5f2a99110f54ef0d53dd7 (
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
|
package main
import (
"fmt"
"os"
)
func main() {
if err := Main(os.Args[1:]...); err != nil {
fmt.Fprintf(os.Stderr, "%v: error: %v\n", os.Args[0], err)
os.Exit(1)
}
}
func Main(imgfilenames ...string) (err error) {
maybeSetErr := func(_err error) {
if _err != nil && err == nil {
err = _err
}
}
fs, sb, err := pass0(imgfilenames...)
if err != nil {
return err
}
defer func() {
maybeSetErr(fs.Close())
}()
foundNodes, err := pass1(fs, sb)
if err != nil {
return err
}
pass2(fs, foundNodes)
return nil
}
|