]> git.sur5r.net Git - i3/i3status/blobdiff - i3status.c
Fix compilation warning
[i3/i3status] / i3status.c
index 909fa4f1d84a32eec60193045c6ce569b83a88ba..8b6ca729595ac833ca5925d9d56edfc5d16b1c2e 100644 (file)
@@ -63,7 +63,7 @@ int general_socket;
 
 const char *wlan_interface = NULL;
 const char *eth_interface = NULL;
-const char *wmii_path = NULL;
+char *wmii_path = NULL;
 const char *time_format = NULL;
 bool use_colors = false;
 bool get_ethspeed = false;
@@ -136,10 +136,10 @@ int main(int argc, char *argv[]) {
                                 for (i = 0; i < num_run_watches; i += 2) {
                                         bool running = process_runs(run_watches[i+1]);
                                         if (use_colors)
-                                                snprintf(part, sizeof(part), "%s%s: %s",
+                                                snprintf(part, sizeof(part), "%s%s: %s%s",
                                                         (running ? color("#00FF00") : color("#FF0000")),
                                                         run_watches[i],
-                                                        (running ? "yes" : "no"));
+                                                        (running ? "yes" : "no"), endcolor());
                                         else snprintf(part, sizeof(part), "%s: %s", run_watches[i], (running ? "yes" : "no"));
                                         snprintf(pathbuf, sizeof(pathbuf), "%d%s", order[ORDER_RUN], run_watches[i]);
                                         write_to_statusbar(pathbuf, part, false);
@@ -152,12 +152,16 @@ int main(int argc, char *argv[]) {
                                         generate(ORDER_BATTERY, "battery", get_battery_info(current));
                         }
 
-                        if (j == order[ORDER_TIME] && time_format != NULL) {
-                                /* Get date & time */
-                                time_t current_time = time(NULL);
-                                struct tm *current_tm = localtime(&current_time);
-                                (void)strftime(part, sizeof(part), time_format, current_tm);
-                                generate(ORDER_TIME, "time", part);
+                        if (j == order[ORDER_TIME]) {
+                                if (time_format != NULL) {
+                                        /* Get date & time */
+                                        time_t current_time = time(NULL);
+                                        struct tm *current_tm = localtime(&current_time);
+                                        (void)strftime(part, sizeof(part), time_format, current_tm);
+                                        generate(ORDER_TIME, "time", part);
+                                } else {
+                                        generate(ORDER_TIME, "time", "");
+                                }
                         }
                 }