sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 76aa9c05736b0e4e2f06fa45945e5cf702347c48
parent ef78f6308081ab48881a1ceb176b4711ebd166ab
Author: sin <sin@2f30.org>
Date:   Tue Apr 21 14:30:11 +0100

Add support to tar multiple files in a single run

Diffstat:
tar.c | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tar.c b/tar.c @@ -341,7 +341,7 @@ static void usage(void) { eprintf("usage: %s [-C dir] [-j | -z] -x [-m | -t] [-f file]\n" - " %s [-C dir] [-h] -c dir [-f file]\n", argv0, argv0); + " %s [-C dir] [-h] -c dir ... [-f file]\n", argv0, argv0); } int @@ -379,10 +379,11 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (!mode || argc != (mode == 'c')) - usage(); - if (mode == 'c' && filtermode) + if (!mode) usage(); + if (mode == 'c') + if (!argc || filtermode) + usage(); switch (mode) { case 'c': @@ -401,7 +402,8 @@ main(int argc, char *argv[]) } if (chdir(dir) < 0) eprintf("chdir %s:", dir); - recurse(argv[0], NULL, &r); + for (; *argv; argc--, argv++) + recurse(*argv, NULL, &r); break; case 't': case 'x':