summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-01-29 15:17:03 -0500
committerJune McEnroe <programble@gmail.com>2018-01-29 15:17:03 -0500
commit24c85b840020db3f504a0bdb0b954e26c162d882 (patch)
tree0656407a30a536a4c775b6398b0c0e3a42261884
parentSupport fbclock fonts wider than 8 (diff)
downloadsrc-24c85b840020db3f504a0bdb0b954e26c162d882.tar.gz
src-24c85b840020db3f504a0bdb0b954e26c162d882.zip
Take fbclock font in env var
-rw-r--r--bin/fbclock.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/fbclock.c b/bin/fbclock.c
index d35369ca..cac3b272 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;