diff --git a/tests/httpserver.pl b/tests/httpserver.pl index ae1bcec28..22b79159b 100755 --- a/tests/httpserver.pl +++ b/tests/httpserver.pl @@ -9,6 +9,9 @@ my $port = 8999; # just a default my $ipv6; my $pid=".http.pid"; # name of the pidfile my $fork; + +my $flags = ""; + do { if($ARGV[0] eq "-v") { $verbose=1; @@ -33,4 +36,9 @@ do { } } while(shift @ARGV); -exec("server/sws --pidfile $pid$fork $ipv6$port $dir"); +$flags .= "--pidfile \"$pid\" "; +$flags .= "--fork " if(defined($fork)); +$flags .= "--ipv6 " if(defined($ipv6)); +$flags .= "--port $port --srcdir \"$dir\""; + +exec("server/sws $flags"); diff --git a/tests/runtests.pl b/tests/runtests.pl index 65abc41e7..3f333063c 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -1167,7 +1167,7 @@ sub runtftpserver { # start our server: my $flag=$debugprotocol?"-v ":""; - $flag .= "-s \"$srcdir\" "; + $flag .= "--srcdir \"$srcdir\" "; if($idnum > 1) { $flag .="--id $idnum "; } @@ -1175,7 +1175,7 @@ sub runtftpserver { $flag .="--ipv6 "; } - $cmd="./server/tftpd --pidfile $pidfile $flag $port"; + $cmd="./server/tftpd --pidfile $pidfile $flag --port $port"; my ($tftppid, $pid2) = startnew($cmd, $pidfile, 15, 0); if($tftppid <= 0 || !kill(0, $tftppid)) { diff --git a/tests/server/sws.c b/tests/server/sws.c index 5f8900239..9b6d9da9a 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -1051,6 +1051,18 @@ int main(int argc, char *argv[]) if(argc>arg) pidname = argv[arg++]; } + else if(!strcmp("--logfile", argv[arg])) { + arg++; + if(argc>arg) + serverlogfile = argv[arg++]; + } + else if(!strcmp("--ipv4", argv[arg])) { +#ifdef ENABLE_IPV6 + ipv_inuse = "IPv4"; + use_ipv6 = FALSE; +#endif + arg++; + } else if(!strcmp("--ipv6", argv[arg])) { #ifdef ENABLE_IPV6 ipv_inuse = "IPv6"; @@ -1064,13 +1076,31 @@ int main(int argc, char *argv[]) arg++; } #endif - else if(argc>arg) { - - if(atoi(argv[arg])) - port = (unsigned short)atoi(argv[arg++]); - - if(argc>arg) - path = argv[arg++]; + else if(!strcmp("--port", argv[arg])) { + arg++; + if(argc>arg) { + port = (unsigned short)atoi(argv[arg]); + arg++; + } + } + else if(!strcmp("--srcdir", argv[arg])) { + arg++; + if(argc>arg) { + path = argv[arg]; + arg++; + } + } + else { + puts("Usage: sws [option]\n" + " --version\n" + " --logfile [file]\n" + " --pidfile [file]\n" + " --ipv4\n" + " --ipv6\n" + " --port [port]\n" + " --srcdir [path]\n" + " --fork"); + return 0; } } diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index c569085dc..88377a829 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -682,6 +682,18 @@ int main(int argc, char **argv) if(argc>arg) pidname = argv[arg++]; } + else if(!strcmp("--logfile", argv[arg])) { + arg++; + if(argc>arg) + serverlogfile = argv[arg++]; + } + else if(!strcmp("--ipv4", argv[arg])) { +#ifdef ENABLE_IPV6 + ipv_inuse = "IPv4"; + use_ipv6 = FALSE; +#endif + arg++; + } else if(!strcmp("--ipv6", argv[arg])) { #ifdef ENABLE_IPV6 ipv_inuse = "IPv6"; @@ -689,13 +701,30 @@ int main(int argc, char **argv) #endif arg++; } - else if(argc>arg) { - - if(atoi(argv[arg])) - port = (unsigned short)atoi(argv[arg++]); - - if(argc>arg) - path = argv[arg++]; + else if(!strcmp("--port", argv[arg])) { + arg++; + if(argc>arg) { + port = (unsigned short)atoi(argv[arg]); + arg++; + } + } + else if(!strcmp("--srcdir", argv[arg])) { + arg++; + if(argc>arg) { + path = argv[arg]; + arg++; + } + } + else { + puts("Usage: tftpd [option]\n" + " --version\n" + " --logfile [file]\n" + " --pidfile [file]\n" + " --ipv4\n" + " --ipv6\n" + " --port [port]\n" + " --srcdir [path]\n"); + return 0; } }