aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2019-04-12 23:50:23 +0200
committerPřemysl Janouch <p@janouch.name>2019-04-12 23:54:09 +0200
commitb7826860632296cfa321e57a33439c253cad1924 (patch)
treef52025d9775d4c5ff2d2131df4e4fb3f33e8175b
parentef904ccf8c244a725ccc5ec63e06d716a312eda8 (diff)
downloadsklad-b7826860632296cfa321e57a33439c253cad1924.tar.gz
sklad-b7826860632296cfa321e57a33439c253cad1924.tar.xz
sklad-b7826860632296cfa321e57a33439c253cad1924.zip
label-tool: don't hardcode the BDF path or listening port
-rw-r--r--label-tool/main.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/label-tool/main.go b/label-tool/main.go
index dd4f8c2..79cac4c 100644
--- a/label-tool/main.go
+++ b/label-tool/main.go
@@ -261,20 +261,27 @@ func handle(w http.ResponseWriter, r *http.Request) {
}
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
- fi, err := os.Open("../../ucs-fonts-75dpi100dpi/100dpi/luBS24.bdf")
+ fi, err := os.Open(bdf_path)
if err != nil {
log.Fatalln(err)
}
+
font, err = bdf.NewFromBDF(fi)
- if err != nil {
+ if err := fi.Close(); err != nil {
log.Fatalln(err)
}
- if err := fi.Close(); err != nil {
+ if err != nil {
log.Fatalln(err)
}
log.Println("starting server")
http.HandleFunc("/", handle)
- log.Fatal(http.ListenAndServe(":8080", nil))
+ log.Fatal(http.ListenAndServe(address, nil))
}