]> git.sur5r.net Git - i3/i3status/commitdiff
Merge pull request #40 from afh/pull/osx
authorMichael Stapelberg <stapelberg@users.noreply.github.com>
Wed, 8 Jul 2015 06:12:13 +0000 (23:12 -0700)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Wed, 8 Jul 2015 06:12:13 +0000 (23:12 -0700)
Mac OS X compatibility changes

Makefile
i3status.c
man/Makefile
src/print_cpu_temperature.c
src/print_disk_info.c

index cf52d9067a59a46baec9a0c4f209f86fe45295ec..1823f3d25bd812c7244b28d584d4bf64dfc657e6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,8 +47,8 @@ ifeq ($(OS),OpenBSD)
 LIBS+=-lossaudio
 endif
 
-ifeq ($(OS), NetBSD)
-LIBS+= -lprop
+ifeq ($(OS),NetBSD)
+LIBS+=-lprop
 endif
 
 # This probably applies for any pkgsrc based system
index 46d557cd9885f47a78dee88468739cbe3bf18326..000584a8405d861cf678b296dc02dc04557e8b0d 100644 (file)
@@ -692,7 +692,12 @@ int main(int argc, char *argv[]) {
          * We also align to 60 seconds modulo interval such
          * that we start with :00 on every new minute. */
         struct timespec ts;
+#if defined(__APPLE__)
+        gettimeofday(&tv, NULL);
+        ts.tv_sec = tv.tv_sec;
+#else
         clock_gettime(CLOCK_REALTIME, &ts);
+#endif
         ts.tv_sec += interval - (ts.tv_sec % interval);
         ts.tv_nsec = 0;
 
index ffcb80c391a038a75040fef3f36fff4353dda272..1db82a4300e9ef91ca44a8b5d98129e37cbcfe22 100644 (file)
@@ -1,8 +1,9 @@
 all: i3status.1
 
 A2X?=a2x
+A2X_FLAGS=
 
 i3status.1: asciidoc.conf i3status.man
-       ${A2X} -f manpage --asciidoc-opts="-f asciidoc.conf" i3status.man
+       ${A2X} -f manpage --asciidoc-opts="-f asciidoc.conf" ${A2X_FLAGS} i3status.man
 clean:
        rm -f i3status.xml i3status.1 i3status.html
index c0a6baa11569da421ab09068d01736cad57c1466..71ee4d4c57ecf164817d54de4190e05f6148bdcd 100644 (file)
@@ -261,8 +261,8 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
     OUTPUT_FULL_TEXT(buffer);
     return;
 error:
-#endif
     free(thermal_zone);
+#endif
 
     OUTPUT_FULL_TEXT("can't read temp");
     (void)fputs("i3status: Cannot read temperature. Verify that you have a thermal zone in /sys/class/thermal or disable the cpu_temperature module in your i3status config.\n", stderr);
index 7fd47b9d916ded11ef2352de930ef41fe12c9ac9..e5e3ab17587acdc52333adc8e604c581b6b90f7f 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #include <sys/types.h>
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 #include <sys/param.h>
 #include <sys/mount.h>
 #else
@@ -59,7 +59,7 @@ static int print_bytes_human(char *outwalk, uint64_t bytes, const char *prefix_t
  * Determines whether remaining bytes are below given threshold.
  *
  */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 static bool below_threshold(struct statfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) {
 #else
 static bool below_threshold(struct statvfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) {
@@ -116,7 +116,7 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch
 
     INSTANCE(path);
 
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
     struct statfs buf;
 
     if (statfs(path, &buf) == -1)