about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-09-01 14:29:47 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-09-01 14:29:47 +0200
commite9e5b4039b887b077f862818ee3508603e965952 (patch)
tree9af37049bee21d979ed548c676502bfc1cde1dad
parent02cd33f61a141767a907f4e37be06f8f1b244632 (diff)
downloadredo-c-e9e5b4039b887b077f862818ee3508603e965952.tar.gz
redo-c-e9e5b4039b887b077f862818ee3508603e965952.tar.xz
redo-c-e9e5b4039b887b077f862818ee3508603e965952.zip
cleanup
-rw-r--r--redo.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/redo.c b/redo.c
index 8e92218..f09b7c4 100644
--- a/redo.c
+++ b/redo.c
@@ -9,16 +9,9 @@ current bugs:
 
   exts: prepend ./? --- execl should be good enough
 
-  no directory handling at all
-    - fiddle .dep file lookup
-    - chdir to basename for each argument
-
   test job server properly
 */
 
-// XXX drop asprintf
-#define _GNU_SOURCE 
-
 #include <poll.h>
 #include <stdio.h>
 #include <sys/types.h>
@@ -717,6 +710,7 @@ record_deps(int targetc, char *targetv[])
 	for (targeti = 0; targeti < targetc; targeti++) {
 		int fd = open(targetv[targeti], O_RDONLY);
 		char *hash = hashfile(fd);
+		// here, we write out the unmodified target name!
 		dprintf(dep_fd, "=%s!%s\n", hash, targetv[targeti]);
 		close(fd);
 	}
@@ -740,8 +734,11 @@ main(int argc, char *argv[])
 
 	force = envfd("REDO_FORCE");
 
-	// XXX check if this is safe...
-	char *program = basename(argv[0]);
+	char *program;
+	if ((program = strrchr(argv[0], '/')))
+		program++;
+	else
+		program = argv[0];
 
 	// XXX argument parsing: -k -jN -x/-v -f -C