summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-01-29 15:17:03 -0500
committerJune McEnroe <june@causal.agency>2018-01-29 15:17:03 -0500
commit8aeb2c2f6b8bd16a9888f17dad1f73a1209248ba (patch)
tree4712b233d73dfafea9563c2df81822a1e392a878 /bin
parentSupport fbclock fonts wider than 8 (diff)
downloadsrc-8aeb2c2f6b8bd16a9888f17dad1f73a1209248ba.tar.gz
src-8aeb2c2f6b8bd16a9888f17dad1f73a1209248ba.zip
Take fbclock font in env var
Diffstat (limited to 'bin')
-rw-r--r--bin/fbclock.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/fbclock.c b/bin/fbclock.c
index 19a48e4b..a7798b00 100644
--- a/bin/fbclock.c
+++ b/bin/fbclock.c
@@ -45,11 +45,11 @@ struct Psf2Header {
 static const uint32_t BG = 0x1D2021;
 static const uint32_t FG = 0xA99A84;
 
-int main(int argc, char *argv[]) {
+int main() {
     size_t count;
 
-    const char *fontPath = "/usr/share/kbd/consolefonts/Lat2-Terminus16.psfu.gz";
-    if (argc > 1) fontPath = argv[1];
+    const char *fontPath = getenv("FONT");
+    if (!fontPath) fontPath = "/usr/share/kbd/consolefonts/Lat2-Terminus16.psfu.gz";
 
     gzFile font = gzopen(fontPath, "r");
     if (!font) err(EX_NOINPUT, "%s", fontPath);
@@ -93,6 +93,7 @@ int main(int argc, char *argv[]) {
 
         char str[64];
         size_t len = strftime(str, sizeof(str), "%H:%M", local);
+        assert(len);
 
         for (int i = 0; i < (60 - local->tm_sec); ++i) {
             uint32_t left = info.xres - header.glyphWidth * len;