summaryrefslogtreecommitdiff
path: root/wildtest.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-01-08 08:59:52 +0000
committerWayne Davison <wayned@samba.org>2004-01-08 08:59:52 +0000
commitc4cd2ca6bf60b13cb697e5461f8c8010be78791e (patch)
tree3155c7049d86cf7c3cd84d454906f560dd206a49 /wildtest.c
parent1ef00d2072ae5cb36282204ac2a4ada9ab4f2ff3 (diff)
downloadrsync-c4cd2ca6bf60b13cb697e5461f8c8010be78791e.tar.gz
We now take a TESTFILE arg on the command-line.
Diffstat (limited to 'wildtest.c')
-rw-r--r--wildtest.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/wildtest.c b/wildtest.c
index 48161d90..73e97a9c 100644
--- a/wildtest.c
+++ b/wildtest.c
@@ -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;