X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=editor.c;h=d8340031d24828483697c10257806efedfe041f5;hb=452c6d506b1a6dcf24d4ceaa592afc39c1c1a60e;hp=615f5754d66ba7ea611a4837b1ff802f9f9de598;hpb=800d1fb0ab4bc9c1f4cd13f7cb7d8851f23a3e50;p=git.git diff --git a/editor.c b/editor.c index 615f5754d..d8340031d 100644 --- a/editor.c +++ b/editor.c @@ -36,26 +36,9 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en return error("Terminal is dumb, but EDITOR unset"); if (strcmp(editor, ":")) { - size_t len = strlen(editor); - int i = 0; - int failed; - const char *args[6]; - struct strbuf arg0 = STRBUF_INIT; + const char *args[] = { editor, path, NULL }; - if (strcspn(editor, "|&;<>()$`\\\"' \t\n*?[#~=%") != len) { - /* there are specials */ - strbuf_addf(&arg0, "%s \"$@\"", editor); - args[i++] = "sh"; - args[i++] = "-c"; - args[i++] = arg0.buf; - } - args[i++] = editor; - args[i++] = path; - args[i] = NULL; - - failed = run_command_v_opt_cd_env(args, 0, NULL, env); - strbuf_release(&arg0); - if (failed) + if (run_command_v_opt_cd_env(args, RUN_USING_SHELL, NULL, env)) return error("There was a problem with the editor '%s'.", editor); }