]> git.sur5r.net Git - i3/i3status/blobdiff - i3status.c
Update wrt. recent OpenBSD changes.
[i3/i3status] / i3status.c
index b2b1714508cddacd792ed82a8947d0a6aec4638e..3c5e3ce06e2246316c5bd71dc0751669ed8937e6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * i3status – Generates a status line for dzen2 or xmobar
  *
- * Copyright © 2008-2011 Michael Stapelberg and contributors
+ * Copyright © 2008-2012 Michael Stapelberg and contributors
  * Copyright © 2009 Thorsten Toepper <atsutane at freethoughts dot de>
  * Copyright © 2010 Axel Wagner <mail at merovius dot de>
  * Copyright © 2010 Fernando Tarlá Cardoso Lemos <fernandotcl at gmail dot com>
@@ -29,6 +29,7 @@
 #include <locale.h>
 
 #include <yajl/yajl_gen.h>
+#include <yajl/yajl_version.h>
 
 #include "i3status.h"
 
@@ -295,11 +296,11 @@ int main(int argc, char *argv[]) {
                 if ((char)o == 'c')
                         configfile = optarg;
                 else if ((char)o == 'h') {
-                        printf("i3status " VERSION " © 2008-2011 Michael Stapelberg and contributors\n"
+                        printf("i3status " VERSION " © 2008-2012 Michael Stapelberg and contributors\n"
                                 "Syntax: %s [-c <configfile>] [-h] [-v]\n", argv[0]);
                         return 0;
                 } else if ((char)o == 'v') {
-                        printf("i3status " VERSION " © 2008-2011 Michael Stapelberg and contributors\n");
+                        printf("i3status " VERSION " © 2008-2012 Michael Stapelberg and contributors\n");
                         return 0;
                 }
 
@@ -346,7 +347,11 @@ int main(int argc, char *argv[]) {
                         || !valid_color(cfg_getstr(cfg_general, "color_separator")))
                die("Bad color format");
 
+#if YAJL_MAJOR >= 2
         yajl_gen json_gen = yajl_gen_alloc(NULL);
+#else
+        yajl_gen json_gen = yajl_gen_alloc(NULL, NULL);
+#endif
 
         if (output_format == O_I3BAR) {
                 /* Initialize the i3bar protocol. See i3/docs/i3bar-protocol
@@ -466,7 +471,11 @@ int main(int argc, char *argv[]) {
                 if (output_format == O_I3BAR) {
                         yajl_gen_array_close(json_gen);
                         const unsigned char *buf;
+#if YAJL_MAJOR >= 2
                         size_t len;
+#else
+                        unsigned int len;
+#endif
                         yajl_gen_get_buf(json_gen, &buf, &len);
                         write(STDOUT_FILENO, buf, len);
                         yajl_gen_clear(json_gen);