sws and tftpd command line option naming adjustments

This commit is contained in:
Yang Tse 2010-01-08 01:48:54 +00:00
Родитель 8524c04ca9
Коммит a114b7b1c0
4 изменённых файлов: 86 добавлений и 19 удалений

Просмотреть файл

@ -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");

Просмотреть файл

@ -6,7 +6,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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)) {

Просмотреть файл

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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;
}
}

Просмотреть файл

@ -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;
}
}