From d5b4c8e368050cf1b84b03c1379bbbc3c817a713 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 16 Feb 2012 23:29:29 +0000 Subject: Implement the i3bar JSON protocol This hardcodes all the JSON parts. Strings are not properly escaped currently. The best/easiest way to fix this is by actually using libyajl. --- src/print_ddate.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/print_ddate.c') diff --git a/src/print_ddate.c b/src/print_ddate.c index 453e5a2..0401a3f 100644 --- a/src/print_ddate.c +++ b/src/print_ddate.c @@ -4,6 +4,8 @@ #include #include +#include "i3status.h" + /* define fixed output-Strings */ char *season_long[5] = { "Chaos", @@ -200,6 +202,10 @@ void print_ddate(const char *format, struct tm *current_tm) { if (form == NULL) if ((form = malloc(strlen(format) + 1)) == NULL) return; + if (output_format == O_I3BAR) + printf("{\"name\":\"ddate\", \"full_text\":\""); strcpy(form, format); format_output(form, dt); + if (output_format == O_I3BAR) + printf("\"}"); } -- cgit v1.2.3