diff options
author | Wayne Davison <wayned@samba.org> | 2004-01-08 08:59:52 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2004-01-08 08:59:52 +0000 |
commit | c4cd2ca6bf60b13cb697e5461f8c8010be78791e (patch) | |
tree | 3155c7049d86cf7c3cd84d454906f560dd206a49 /wildtest.c | |
parent | 1ef00d2072ae5cb36282204ac2a4ada9ab4f2ff3 (diff) | |
download | rsync-c4cd2ca6bf60b13cb697e5461f8c8010be78791e.tar.gz |
We now take a TESTFILE arg on the command-line.
Diffstat (limited to 'wildtest.c')
-rw-r--r-- | wildtest.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -84,8 +84,14 @@ main(int argc, char **argv) } } - if ((fp = fopen("wildtest.txt", "r")) == NULL) { - fprintf(stderr, "Unable to open wildtest.txt.\n"); + argv = (char**)poptGetArgs(pc); + if (!argv || argv[1]) { + fprintf(stderr, "Usage: wildtest TESTFILE\n"); + exit(1); + } + + if ((fp = fopen(*argv, "r")) == NULL) { + fprintf(stderr, "Unable to open %s\n", *argv); exit(1); } @@ -104,8 +110,8 @@ main(int argc, char **argv) if (*++s != ' ' && *s != '\t') flag[i] = -1; if (flag[i] < 0) { - fprintf(stderr, "Invalid flag syntax on line %d of wildtest.txt:%s\n", - line, buf); + fprintf(stderr, "Invalid flag syntax on line %d of %s:\n%s", + line, *argv, buf); exit(1); } while (*++s == ' ' || *s == '\t') {} @@ -116,16 +122,16 @@ main(int argc, char **argv) string[i] = s; while (*s && *s != quote) s++; if (!*s) { - fprintf(stderr, "Unmatched quote on line %d of wildtest.txt:%s\n", - line, buf); + fprintf(stderr, "Unmatched quote on line %d of %s:\n%s", + line, *argv, buf); exit(1); } end[i] = s; } else { if (!*s || *s == '\n') { - fprintf(stderr, "Not enough strings on line %d of wildtest.txt:%s\n", - line, buf); + fprintf(stderr, "Not enough strings on line %d of %s:\n%s", + line, *argv, buf); exit(1); } string[i] = s; |