]> git.sur5r.net Git - i3/i3/blobdiff - i3-nagbar/main.c
i3-nagbar: add missing newline when printing version information
[i3/i3] / i3-nagbar / main.c
index 0fa75f8e0550dc9b00dd78b84c8826179b7d69ad..70ad93b0b1c385f7f776e3f0d43ba60893c11131 100644 (file)
@@ -61,7 +61,7 @@ xcb_connection_t *conn;
 xcb_screen_t *root_screen;
 
 /*
- * Having verboselog() and errorlog() is necessary when using libi3.
+ * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
  *
  */
 void verboselog(char *fmt, ...) {
@@ -80,6 +80,9 @@ void errorlog(char *fmt, ...) {
     va_end(args);
 }
 
+void debuglog(char *fmt, ...) {
+}
+
 /*
  * Starts the given application by passing it through a shell. We use double fork
  * to avoid zombie processes. As the started application’s parent exits (immediately),
@@ -159,8 +162,9 @@ static void handle_button_release(xcb_connection_t *conn, xcb_button_release_eve
     fclose(script);
 
     char *link_path;
+    char *exe_path = get_exe_path(argv0);
     sasprintf(&link_path, "%s.nagbar_cmd", script_path);
-    symlink(get_exe_path(argv0), link_path);
+    symlink(exe_path, link_path);
 
     char *terminal_cmd;
     sasprintf(&terminal_cmd, "i3-sensible-terminal -e %s", link_path);
@@ -172,6 +176,7 @@ static void handle_button_release(xcb_connection_t *conn, xcb_button_release_eve
     free(link_path);
     free(terminal_cmd);
     free(script_path);
+    free(exe_path);
 
     /* TODO: unset flag, re-render */
 }
@@ -336,7 +341,7 @@ int main(int argc, char *argv[]) {
     while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) {
         switch (o) {
             case 'v':
-                printf("i3-nagbar " I3_VERSION);
+                printf("i3-nagbar " I3_VERSION "\n");
                 return 0;
             case 'f':
                 FREE(pattern);
@@ -462,7 +467,8 @@ int main(int argc, char *argv[]) {
         uint32_t top_end_x;
         uint32_t bottom_start_x;
         uint32_t bottom_end_x;
-    } __attribute__((__packed__)) strut_partial = {0,};
+    } __attribute__((__packed__)) strut_partial;
+    memset(&strut_partial, 0, sizeof(strut_partial));
 
     strut_partial.top = font.height + 6;
     strut_partial.top_start_x = 0;