about summary refs log tree commit diff stats
path: root/src/tools
diff options
context:
space:
mode:
authorDaniel Santos <dacs.git@brilhante.top>2023-03-30 21:44:26 +0100
committerDaniel Santos <dacs.git@brilhante.top>2023-03-30 21:44:26 +0100
commit007f623ad8fc8de7a65bff82a603b853ad5b445f (patch)
treeaedb50ecd2d3dbcbe038fb3b56a8cc45425449b3 /src/tools
parent2093fe417f6a1d7f8741613a83ed81e18ae272c9 (diff)
downloadprofani-tty-007f623ad8fc8de7a65bff82a603b853ad5b445f.tar.gz
Editor executable support flags
 * Make editor executable into a string to be able to support
   (multiple) flags.
 * Change /help executable to suit this new feature

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/editor.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/editor.c b/src/tools/editor.c
index 350fb5b1..0efb4d6b 100644
--- a/src/tools/editor.c
+++ b/src/tools/editor.c
@@ -88,11 +88,16 @@ get_message_from_editor(gchar* message, gchar** returned_message)
     }
 
     char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
+    gchar* editor_with_filename = g_strdup_printf("%s %s", editor, filename);
+    gchar** editor_argv = g_strsplit(editor_with_filename, " ", 0);
+
+    g_free(editor_with_filename);
 
     // Fork / exec
     pid_t pid = fork();
     if (pid == 0) {
-        int x = execlp(editor, editor, filename, (char*)NULL);
+        int x = execvp(editor_argv[0], editor_argv);
+        g_strfreev(editor_argv);
         if (x == -1) {
             log_error("[Editor] Failed to exec %s", editor);
         }