func main() { log.SetFlags(0) log.SetPrefix("ogleproxy: ") flag.Parse() if *textFlag == "" { fmt.Printf("OGLE BAD\n") flag.Usage() os.Exit(2) } s, err := server.New(*textFlag) if err != nil { fmt.Printf("OGLE BAD\n%s\n", err) os.Exit(2) } err = rpc.Register(s) if err != nil { fmt.Printf("OGLE BAD\n%s\n", err) os.Exit(2) } fmt.Println("OGLE OK") log.Print("start server") // TODO: Usually done in a go. rpc.ServeConn(&rwc{ os.Stdin, os.Stdout, }) log.Print("finish server") }
// New creates a new program from the specified file. // The program can then be started by the Run method. func New(textFile string) (*Local, error) { s, err := server.New(textFile) return &Local{s: s}, err }