shithub: clone

Download patch

ref: bf8492295e5669793b6279704c43ec06ed305849
parent: dec6ba0839287843baddfed39179e7b094c38715
author: kvik <kvik@a-b.xyz>
date: Tue Oct 30 14:19:40 EDT 2018

accept multiple source files/dirs

--- a/clone.c
+++ b/clone.c
@@ -383,7 +383,7 @@
 threadmain(int argc, char *argv[])
 {
 	int i;
-	char *src, *dst, *p;
+	char *dst, *p;
 
 	ARGBEGIN{
 	case 'b':
@@ -406,8 +406,7 @@
 	}ARGEND;
 	if(argc < 2)
 		usage();
-	src = argv[0];
-	dst = argv[1];
+	dst = argv[argc - 1];
 
 	filechan = chancreate(sizeof(File*), fileprocs);
 	blkchan = chancreate(sizeof(Blk*), blkprocs);
@@ -417,7 +416,8 @@
 	for(i = 0; i < blkprocs; i++)
 		proccreate(blkproc, nil, mainstacksize);
 
-	clone(src, dst);
+	for(i = 0; i < argc -1; i++)
+		clone(argv[i], dst);
 
 	for(i = 0; i < fileprocs; i++){
 		sendp(filechan, nil);