aboutsummaryrefslogtreecommitdiff
path: root/tests/server/sws.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-12-14 21:52:16 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-12-14 21:52:16 +0000
commitdc28a9c0c19c324a0740669e3cc71e80b07a848e (patch)
tree392cc9aa63eaadf8f455d5f391198690cf4206c1 /tests/server/sws.c
parent1faef62d597c78ea5601ed94814f4a188ec17a86 (diff)
make sure the ipv6 http server gets its pid stored in a separate file
Diffstat (limited to 'tests/server/sws.c')
-rw-r--r--tests/server/sws.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index f690ab3e1..f53da9054 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -728,11 +728,12 @@ int main(int argc, char *argv[])
int sock, msgsock, flag;
unsigned short port = DEFAULT_PORT;
FILE *pidfile;
+ char *pidname= (char *)".http.pid";
struct httprequest req;
int rc;
+ int arg=1;
- if(argc>1) {
- int arg=1;
+ while(argc>arg) {
if(!strcmp("--version", argv[arg])) {
printf("sws IPv4%s\n",
#ifdef ENABLE_IPV6
@@ -743,20 +744,24 @@ int main(int argc, char *argv[])
);
return 0;
}
- if(!strcmp("--ipv6", argv[arg])) {
+ else if(!strcmp("--pidfile", argv[arg])) {
+ arg++;
+ if(argc>arg)
+ pidname = argv[arg++];
+ }
+ else if(!strcmp("--ipv6", argv[arg])) {
#ifdef ENABLE_IPV6
use_ipv6=TRUE;
#endif
arg++;
}
- if(argc>arg) {
+ else if(argc>arg) {
if(atoi(argv[arg]))
port = (unsigned short)atoi(argv[arg++]);
if(argc>arg)
- path = argv[arg];
-
+ path = argv[arg++];
}
}
@@ -820,7 +825,7 @@ int main(int argc, char *argv[])
exit(1);
}
- pidfile = fopen(".http.pid", "w");
+ pidfile = fopen(pidname, "w");
if(pidfile) {
fprintf(pidfile, "%d\n", (int)getpid());
fclose(pidfile);