From 1dcf7be557c4f3d8a3b59079ed38781c2cc46ad6 Mon Sep 17 00:00:00 2001 From: Marcel Rodrigues Date: Fri, 19 Jun 2015 19:24:01 -0300 Subject: [PATCH] Make --save-cwd work with relative path as argument. --- rover.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rover.c b/rover.c index 9f08f1a..76208ad 100644 --- a/rover.c +++ b/rover.c @@ -808,7 +808,7 @@ main(int argc, char *argv[]) const char *key; DIR *d; EditStat edit_stat; - const char *save_cwd_file = NULL; + FILE *save_cwd_file = NULL; if (argc >= 2) { if (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) { @@ -827,7 +827,7 @@ main(int argc, char *argv[]) ); return 0; } else if (argc > 2 && !strcmp(argv[1], "--save-cwd")) { - save_cwd_file = argv[2]; + save_cwd_file = fopen(argv[2], "w"); argc -= 2; argv += 2; } } @@ -1156,9 +1156,8 @@ main(int argc, char *argv[]) free_marks(&rover.marks); delwin(rover.window); if (save_cwd_file != NULL) { - FILE *fd = fopen(save_cwd_file, "w"); - fputs(CWD, fd); - fclose(fd); + fputs(CWD, save_cwd_file); + fclose(save_cwd_file); } return 0; } -- 2.11.4.GIT