aboutsummaryrefslogtreecommitdiff
path: root/tests/server/tftpd.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-10-24 22:48:23 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-10-24 22:48:23 +0000
commit65ed69662513b14143e8821c72ea41d7c69113d9 (patch)
treef6a2de2b6eb6cf6b61cb7330f24c19c61884d0ed /tests/server/tftpd.c
parent3e3eaaada75b920dae214338e13a26fc4d02920a (diff)
Fixed the test TFTP server to support the >10000 test number notation
Added test cases 2002 and 2003 (the latter disabled for now)
Diffstat (limited to 'tests/server/tftpd.c')
-rw-r--r--tests/server/tftpd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index 71cf88992..7dafd78a8 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -654,8 +654,9 @@ static int validate_access(struct testcase *test,
const char *filename, int mode)
{
char *ptr;
- long testno;
+ long testno, partno;
int error;
+ char partbuf[80]="data";
logmsg("trying to get file: %s mode %x", filename, mode);
@@ -686,12 +687,23 @@ static int validate_access(struct testcase *test,
/* get the number */
testno = strtol(ptr, &ptr, 10);
- logmsg("requested test number %d", testno);
+ if(testno > 10000) {
+ partno = testno % 10000;
+ testno /= 10000;
+ }
+ else
+ partno = 0;
+
+
+ logmsg("requested test number %ld part %ld", testno, partno);
test->num = testno;
file = test2file(testno);
+ if(0 != partno)
+ sprintf(partbuf, "data%ld", partno);
+
if(file) {
FILE *stream=fopen(file, "rb");
if(!stream) {
@@ -703,7 +715,7 @@ static int validate_access(struct testcase *test,
}
else {
size_t count;
- test->buffer = (char *)spitout(stream, "reply", "data", &count);
+ test->buffer = (char *)spitout(stream, "reply", partbuf, &count);
fclose(stream);
if(test->buffer) {
test->rptr = test->buffer; /* set read pointer */