diff options
author | Lucas Eckels <eckels@google.com> | 2012-08-06 15:07:02 -0700 |
---|---|---|
committer | Lucas Eckels <eckels@google.com> | 2012-08-08 09:28:48 -0700 |
commit | 9bd90e6e25f1e55f50201c87a1b5837de7e5b64a (patch) | |
tree | d2061a00d7d0ee884170bc955fceeed2d0edf284 /tests/tftpserver.pl | |
parent | e6f2b03027b5feb92b30f5d47801ec3fabe9fd95 (diff) | |
download | android_external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.gz android_external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.bz2 android_external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.zip |
Add Music Manager's curl 7.21.2 source.
Change-Id: I259a43fa52d581524a5ce8ae1711467acb1d9d50
Diffstat (limited to 'tests/tftpserver.pl')
-rwxr-xr-x | tests/tftpserver.pl | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/tests/tftpserver.pl b/tests/tftpserver.pl new file mode 100755 index 0000000..c5382ec --- /dev/null +++ b/tests/tftpserver.pl @@ -0,0 +1,109 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# 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 +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +BEGIN { + @INC=(@INC, $ENV{'srcdir'}, '.'); +} + +use strict; +use warnings; + +use serverhelp qw( + server_pidfilename + server_logfilename + ); + +my $verbose = 0; # set to 1 for debugging +my $port = 8997; # just a default +my $ipvnum = 4; # default IP version of tftp server +my $idnum = 1; # dafault tftp server instance number +my $proto = 'tftp'; # protocol the tftp server speaks +my $pidfile; # tftp server pid file +my $logfile; # tftp server log file +my $srcdir; +my $fork; + +my $flags = ""; +my $path = '.'; +my $logdir = $path .'/log'; + +while(@ARGV) { + if($ARGV[0] eq '--pidfile') { + if($ARGV[1]) { + $pidfile = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--logfile') { + if($ARGV[1]) { + $logfile = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--srcdir') { + if($ARGV[1]) { + $srcdir = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--ipv4') { + $ipvnum = 4; + } + elsif($ARGV[0] eq '--ipv6') { + $ipvnum = 6; + } + elsif($ARGV[0] eq '--port') { + if($ARGV[1] =~ /^(\d+)$/) { + $port = $1; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--id') { + if($ARGV[1] =~ /^(\d+)$/) { + $idnum = $1 if($1 > 0); + shift @ARGV; + } + } + elsif($ARGV[0] eq '--verbose') { + $verbose = 1; + } + else { + print STDERR "\nWarning: tftpserver.pl unknown parameter: $ARGV[0]\n"; + } + shift @ARGV; +} + +if(!$srcdir) { + $srcdir = $ENV{'srcdir'} || '.'; +} +if(!$pidfile) { + $pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum); +} +if(!$logfile) { + $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum); +} + +$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; +$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; + +exec("server/tftpd $flags"); |