Fix help about command-line arguments that do require a parameter.
[claws.git] / src / main.c
index 1fc5c7042be16d1c3debe8941cdd64c16575a6e4..8e2f2948ca8643ed6f4ee8ee391176edff59d557 100644 (file)
@@ -641,6 +641,16 @@ static void sc_session_manager_connect(MainWindow *mainwin)
                                NULL, &client_id,
                                256, error_string_ret);
 
+               /* From https://www.x.org/releases/X11R7.7/doc/libSM/SMlib.txt:
+                * If SmcOpenConnection succeeds, it returns an opaque connection
+                * pointer of type SmcConn and the client_id_ret argument contains
+                * the client ID to be used for this session. The client_id_ret
+                * should be freed with a call to free when no longer needed. On
+                * failure, SmcOpenConnection returns NULL, and the reason for
+                * failure is returned in error_string_ret. */
+               if (mainwin->smc_conn != NULL)
+                       g_free(client_id);
+
                if (error_string_ret[0] || mainwin->smc_conn == NULL)
                        g_warning ("While connecting to session manager: %s.",
                                error_string_ret);
@@ -1683,6 +1693,7 @@ static void exit_claws(MainWindow *mainwin)
                if (prefs_common.last_opened_folder != NULL)
                        g_free(prefs_common.last_opened_folder);
                prefs_common.last_opened_folder =
+                       !prefs_common.goto_last_folder_on_startup ? NULL :
                        folder_item_get_identifier(item);
        }
 
@@ -1974,7 +1985,7 @@ static void parse_cmd_opt(int argc, char *argv[])
                                          "                         use - as file name for reading from standard input;\n"
                                          "                         content format: headers first (To: required) until an\n"
                                          "                         empty line, then mail body until end of file."));
-                       g_print("%s\n", _("  --subscribe [uri]      subscribe to the given URI if possible"));
+                       g_print("%s\n", _("  --subscribe uri        subscribe to the given URI if possible"));
                        g_print("%s\n", _("  --attach file1 [file2]...\n"
                                          "                         open composition window with specified files\n"
                                          "                         attached"));
@@ -2009,7 +2020,7 @@ static void parse_cmd_opt(int argc, char *argv[])
                        g_print("%s\n", _("  --version -v           output version information and exit"));
                        g_print("%s\n", _("  --version-full -V      output version and built-in features information and exit"));
                        g_print("%s\n", _("  --config-dir           output configuration directory"));
-                       g_print("%s\n", _("  --alternate-config-dir [dir]\n"
+                       g_print("%s\n", _("  --alternate-config-dir directory\n"
                                          "                         use specified configuration directory"));
                        g_print("%s\n", _("  --geometry -geometry WxH+X+Y\n"
                                          "                         set geometry for main window"));
@@ -2390,11 +2401,11 @@ static gint prohibit_duplicate_launch(void)
        } else if (cmd.send) {
                fd_write_all(uxsock, "send\n", 5);
        } else if (cmd.online_mode == ONLINE_MODE_ONLINE) {
-               fd_write(uxsock, "online\n", 6);
+               fd_write(uxsock, "online\n", 7);
        } else if (cmd.online_mode == ONLINE_MODE_OFFLINE) {
-               fd_write(uxsock, "offline\n", 7);
+               fd_write(uxsock, "offline\n", 8);
        } else if (cmd.debug) {
-               fd_write(uxsock, "debug\n", 7);
+               fd_write(uxsock, "debug\n", 6);
        } else if (cmd.status || cmd.status_full) {
                gchar buf[BUFFSIZE];
                gint i;
@@ -2417,7 +2428,10 @@ static gint prohibit_duplicate_launch(void)
                        fd_gets(uxsock, buf, sizeof(buf) - 1);
                        buf[sizeof(buf) - 1] = '\0';
                        if (!strncmp(buf, ".\n", 2)) break;
-                       claws_fputs(buf, stdout);
+                       if (claws_fputs(buf, stdout) == EOF) {
+                               g_warning("writing to stdout failed.");
+                               break;
+                       }
                }
        } else if (cmd.exit) {
                fd_write_all(uxsock, "exit\n", 5);
@@ -2428,7 +2442,10 @@ static gint prohibit_duplicate_launch(void)
                        fd_gets(uxsock, buf, sizeof(buf) - 1);
                        buf[sizeof(buf) - 1] = '\0';
                        if (!strncmp(buf, ".\n", 2)) break;
-                       claws_fputs(buf, stdout);
+                       if (claws_fputs(buf, stdout) == EOF) {
+                               g_warning("writing to stdout failed.");
+                               break;
+                       }
                }
        } else if (cmd.reset_statistics) {
                fd_write(uxsock, "reset_statistics\n", 17);
@@ -2448,7 +2465,10 @@ static gint prohibit_duplicate_launch(void)
                        fd_gets(uxsock, buf, sizeof(buf) - 1);
                        buf[sizeof(buf) - 1] = '\0';
                        if (!strncmp(buf, ".\n", 2)) break;
-                       claws_fputs(buf, stdout);
+                       if (claws_fputs(buf, stdout) == EOF) {
+                               g_warning("writing to stdout failed.");
+                               break;
+                       }
                }
        } else {
 #ifdef G_OS_UNIX