summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2018-09-19 16:53:41 +0930
committerdaniel-Jones <daniel@danieljon.es>2018-09-19 16:53:41 +0930
commit3bd31a22fb78954a67658a13b82344c896b15ac9 (patch)
tree858b5f931ca142d5850ee746e0f5a3270b9cba22
parent024d14450abc9b9bdd47ae3a61f8664a5271553a (diff)
downloadbinstatus-3bd31a22fb78954a67658a13b82344c896b15ac9.tar.gz
binstatus-3bd31a22fb78954a67658a13b82344c896b15ac9.zip
fix segfault, woops. changed readme a bit
-rw-r--r--README.md2
-rw-r--r--binstatus.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/README.md b/README.md
index 6fea9ce..0e198bd 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-By default this program will set your root windows name to the time in binary, however if you set the environment variable binstatus to 'dec' (export binstatus=dec) it will display the time as hh:mm.
+By default this program will set your root windows name to the time in binary, however if you set the environment variable binstatus to 'dec' (export binstatus=dec) it will display the time as hh:mm. 'bin' is also a valid value, that will be the time in binary. Any other value will not output anything, dwm or your window manager may use its own string.
compile:
diff --git a/binstatus.c b/binstatus.c
index 046e09e..c521677 100644
--- a/binstatus.c
+++ b/binstatus.c
@@ -43,15 +43,16 @@ void
formatstring(char *status, int *time)
{
char *env = getenv("binstatus");
- if (strcmp(env, "dec") == 0)
- {
- snprintf(status, MAXLENGTH, "%02d:%02d", time[0], time[1]);
- }
- else
+ if (!env || strcmp(env, "bin") == 0)
{
+
snprintf(status, MAXLENGTH, "%05d %06d", dectobin(time[0]),
dectobin(time[1]));
}
+ else if (strcmp(env, "dec") == 0)
+ {
+ snprintf(status, MAXLENGTH, "%02d:%02d", time[0], time[1]);
+ }
}
int