diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-04-19 20:59:44 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-04-19 20:59:44 -0400 |
commit | 95f01124b30bd8ed7aa1a85658836890bcc4c228 (patch) | |
tree | bc3ccceb1059a461387b12457cb7260e437c52d2 | |
parent | f8498ea2a1e6230aa7b92be784db070045d36255 (diff) |
reenable v command
-rw-r--r-- | more.c | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -132,6 +132,7 @@ static int more_open(struct more_file *mf) static void more_close(struct more_file *mf) { + /* TODO: maybe save these ? */ if (mf->backing != mf->f) { fclose(mf->backing); } @@ -285,7 +286,7 @@ static void more_help(void) remove(path); } -static struct more_file more_invoke_editor(struct more_file *mf) +static void more_invoke_editor(struct more_file *mf) { extern char **environ; char *editor = getenv("EDITOR"); @@ -308,28 +309,21 @@ static struct more_file more_invoke_editor(struct more_file *mf) argv[2] = NULL; } - struct more_file ret = *mf; - def_prog_mode(); reset_shell_mode(); pid_t pid; if (posix_spawnp(&pid, editor, NULL, NULL, argv, environ) == 0) { - char *path = strdup(mf->path); size_t line = mf->topline; more_close(mf); - waitpid(pid, NULL, 0); - - //ret = more_open(path); - ret.topline = line; - free(path); + more_open(mf); + mf->topline = line; } else { - wprintw(more_status, "%s %s: %s\n", editor, mf->path, strerror(errno)); + wprintw(more_status, "%s %s: %s\n", editor, mf->path, + strerror(errno)); } reset_prog_mode(); - - return ret; } static struct more_file more_examine(struct more_file *mf) |