label-tool: don't hardcode the BDF path or listening port
This commit is contained in:
parent
ef904ccf8c
commit
b782686063
@ -261,20 +261,27 @@ func handle(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if len(os.Args) != 3 {
|
||||||
|
log.Fatalf("usage: %s ADDRESS BDF-FILE\n", os.Args[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
address, bdf_path := os.Args[1], os.Args[2]
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
fi, err := os.Open("../../ucs-fonts-75dpi100dpi/100dpi/luBS24.bdf")
|
fi, err := os.Open(bdf_path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
font, err = bdf.NewFromBDF(fi)
|
font, err = bdf.NewFromBDF(fi)
|
||||||
if err != nil {
|
if err := fi.Close(); err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
if err := fi.Close(); err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("starting server")
|
log.Println("starting server")
|
||||||
http.HandleFunc("/", handle)
|
http.HandleFunc("/", handle)
|
||||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
log.Fatal(http.ListenAndServe(address, nil))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user