about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-03-09 12:57:19 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-03-09 12:57:19 +0100
commit1390a76b97dec19c77486f2995a5018a10ae35da (patch)
treef9045d579f767cc565af5dbf539bad564b41f302
parent6cf8c1bcc1e1cc6577fdebfa8b6ba3d2256365ad (diff)
downloadredo-c-1390a76b97dec19c77486f2995a5018a10ae35da.tar.gz
redo-c-1390a76b97dec19c77486f2995a5018a10ae35da.tar.xz
redo-c-1390a76b97dec19c77486f2995a5018a10ae35da.zip
use "all" as default target only when "redo" is called directly
Closes #12.
-rw-r--r--redo.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/redo.c b/redo.c
index 181e3c4..ef130f0 100644
--- a/redo.c
+++ b/redo.c
@@ -968,14 +968,17 @@ main(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
-	if (argc == 0) {
-		argc = 1;
-		argv[0] = (char *)"all";    // XXX safe?
-	}
-
 	dir_fd = keepdir();
 
 	if (strcmp(program, "redo") == 0) {
+		char all[] = "all";
+		char *argv_def[] = { all };
+
+		if (argc == 0) {
+			argc = 1;
+			argv = argv_def;
+		}
+
 		fflag = 1;
 		redo_ifchange(argc, argv);
 		procure();