|
|
@ -434,13 +434,19 @@ read_input_from_editor(void) |
|
|
|
FILE *f; |
|
|
|
|
|
|
|
editor = get_editor(); |
|
|
|
command = xmalloc(strlen(editor) + sizeof(tmp_filename) + 1); |
|
|
|
|
|
|
|
tmp_fd = mkstemp(tmp_filename); |
|
|
|
if ( (tmp_fd = mkstemp(tmp_filename)) == -1 ) |
|
|
|
err(EXIT_FAILURE, "cannot create temporary file"); |
|
|
|
|
|
|
|
command = xmalloc(strlen(editor) + sizeof(tmp_filename) + 1); |
|
|
|
sprintf(command, "%s %s", editor, tmp_filename); |
|
|
|
system(command); |
|
|
|
|
|
|
|
f = fdopen(tmp_fd, "r"); |
|
|
|
if ( system(command) == -1 ) |
|
|
|
err(EXIT_FAILURE, "cannot execute editor '%s'", editor); |
|
|
|
|
|
|
|
if ( (f = fdopen(tmp_fd, "r")) == NULL ) |
|
|
|
err(EXIT_FAILURE, "cannot open temporary file"); |
|
|
|
|
|
|
|
unlink(tmp_filename); |
|
|
|
free(command); |
|
|
|
|
|
|
|