Commit 9a1a450b 9a1a450bd1132c8a5426de7f0cd0570103c4af66 by Sergey Poznyakoff

(run_editor): A wrapper around mail_execute().

(var_shell): Use run_editor.
1 parent a86f79fc
...@@ -175,7 +175,8 @@ var_shell (int argc, char **argv, compose_env_t *env) ...@@ -175,7 +175,8 @@ var_shell (int argc, char **argv, compose_env_t *env)
175 { 175 {
176 int status; 176 int status;
177 ofile = env->ofile; 177 ofile = env->ofile;
178 status = mail_shell (argc, argv); 178 ++*argv;
179 status = mail_execute (1, argc, argv);
179 ofile = env->file; 180 ofile = env->file;
180 return status; 181 return status;
181 } 182 }
...@@ -298,6 +299,17 @@ var_deadletter (int argc ARG_UNUSED, char **argv ARG_UNUSED, ...@@ -298,6 +299,17 @@ var_deadletter (int argc ARG_UNUSED, char **argv ARG_UNUSED,
298 return 0; 299 return 0;
299 } 300 }
300 301
302 static void
303 run_editor (char *ed, char *arg)
304 {
305 char *argv[3];
306
307 argv[0] = ed;
308 argv[1] = arg;
309 argv[2] = NULL;
310 return mail_execute (1, 2, argv);
311 }
312
301 static int 313 static int
302 var_run_editor (char *ed, int argc, char **argv, compose_env_t *env) 314 var_run_editor (char *ed, int argc, char **argv, compose_env_t *env)
303 { 315 {
...@@ -320,7 +332,7 @@ var_run_editor (char *ed, int argc, char **argv, compose_env_t *env) ...@@ -320,7 +332,7 @@ var_run_editor (char *ed, int argc, char **argv, compose_env_t *env)
320 do 332 do
321 { 333 {
322 fclose (fp); 334 fclose (fp);
323 util_do_command ("!%s %s", ed, filename); 335 run_editor (ed, filename);
324 fp = fopen (filename, "r"); 336 fp = fopen (filename, "r");
325 } 337 }
326 while ((rc = parse_headers (fp, env)) < 0); 338 while ((rc = parse_headers (fp, env)) < 0);
...@@ -341,7 +353,7 @@ var_run_editor (char *ed, int argc, char **argv, compose_env_t *env) ...@@ -341,7 +353,7 @@ var_run_editor (char *ed, int argc, char **argv, compose_env_t *env)
341 { 353 {
342 fclose (env->file); 354 fclose (env->file);
343 ofile = env->ofile; 355 ofile = env->ofile;
344 util_do_command ("!%s %s", ed, env->filename); 356 run_editor (ed, env->filename);
345 } 357 }
346 358
347 env->file = fopen (env->filename, "a+"); 359 env->file = fopen (env->filename, "a+");
......