* dwmstatus for OpenBSD
       
   URI git clone git://git.codevoid.de/dwmstatus-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit 0c1dd4b7655776b467d96a77f13ff844302379ef
   DIR parent ed8774c79ae4551cc1c33deb2c4a053756a0ecb8
   URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de>
       Date:   Mon,  4 Jun 2018 09:32:36 +0200
       
       ifdef __FreeBSD__ and Linux
       
       Diffstat:
         M Makefile                            |       1 +
         M dwmstatus.c                         |      39 +++++++++++++++++++++++++++----
       
       2 files changed, 35 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/Makefile b/Makefile
       @@ -4,6 +4,7 @@ include config.mk
        
        SRC = ${NAME}.c
        OBJ = ${SRC:.c=.o}
       +CC  = clang
        
        all: options ${NAME}
        
   DIR diff --git a/dwmstatus.c b/dwmstatus.c
       @@ -24,8 +24,12 @@
        #include <X11/Xlib.h>
        
        // getfreespace
       -#include <sys/param.h>
       -#include <sys/mount.h>
       +#ifdef __FreeBSD__
       +#include <sys/param.h> // freebsd
       +#include <sys/mount.h> // freebsd
       +#else
       +#include <sys/vfs.h>
       +#endif
        
        // configuration
        #define UPDATE_INTERVAL 10
       @@ -78,6 +82,7 @@ getfreespace(const char *path) {
         */ 
        char *
        getsysctl(char *input_str) {
       +#ifdef __FreeBSD__
            char   *ret_val;
            size_t ret_size;
        
       @@ -95,6 +100,9 @@ getsysctl(char *input_str) {
        
            // caller must know how to interpret this (s or i)
            return ret_val;
       +#else
       +    return smprintf("N/A");
       +#endif
        }
        
        /* Use FreeBSDs mixer device to determine the master
       @@ -102,6 +110,7 @@ getsysctl(char *input_str) {
         */
        char *
        getvolume(char *mixerpath) {
       +#ifdef __FreeBSD__
            char defaultmixer[] = "/dev/mixer";
            int mixfd, vol, devmask = 0;
        
       @@ -120,6 +129,10 @@ getvolume(char *mixerpath) {
            }
            close(mixfd);
            return smprintf("%i", vol & 0x7f);
       +#else
       +    return smprintf("N/A");
       +#endif
       +
        } 
        
        void
       @@ -255,13 +268,14 @@ gettemperature(char *base, char *sensor)
        // update all values and print statusbar
        void update() {
            char *status;
       +
       +#ifdef __FreeBSD__
            char *datetime;
            char *cputemp;
            char *cpufreq;
            char *battery;
            char *volume;
            char *freespace;
       -
            // cpu temperature
            cputemp  = smprintf("%i", ZEROCTOC((int)getsysctl("hw.acpi.thermal.tz0.temperature")));
        
       @@ -289,14 +303,29 @@ void update() {
            } else {
                status   = smprintf("!!! LOW DISK SPACE WARNING !!! /:%sMB LOAD:%s TEMP:%s°C FREQ:%sMhz BAT:%s%% VOL:%s | %s ", freespace, loadavg(), cputemp, cpufreq, battery, volume, datetime);
            }
       -    setstatus(status);
       -
            free(freespace);
            free(volume);
            free(battery);
            free(cputemp);
            free(cpufreq);
            free(datetime);
       +#else
       +    char *datetime;
       +    char *freespace;
       +    // date and time
       +    datetime = mktimes("%d.%m.%Y %H:%M", tzberlin);
       +    // free disk space (root/home)
       +    freespace = getfreespace("/");
       +    if(atoi(freespace) > LOW_DISKSPACE) {
       +        status   = smprintf("/:%sMB LOAD:%s | %s ", freespace, loadavg(), datetime);
       +    } else {
       +        status   = smprintf("!!! LOW DISK SPACE WARNING !!! /:%sMB LOAD:%s | %s ", freespace, loadavg(), datetime);
       +    }
       +    free(datetime);
       +    free(freespace);
       +#endif
       +
       +    setstatus(status);
            free(status);
        }