File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / curl / tests / rtspserver.pl
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 3 10:01:16 2020 UTC (5 years ago) by misho
Branches: curl, MAIN
CVS tags: v7_70_0p4, HEAD
curl

    1: #!/usr/bin/env perl
    2: #***************************************************************************
    3: #                                  _   _ ____  _
    4: #  Project                     ___| | | |  _ \| |
    5: #                             / __| | | | |_) | |
    6: #                            | (__| |_| |  _ <| |___
    7: #                             \___|\___/|_| \_\_____|
    8: #
    9: # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
   10: #
   11: # This software is licensed as described in the file COPYING, which
   12: # you should have received as part of this distribution. The terms
   13: # are also available at https://curl.haxx.se/docs/copyright.html.
   14: #
   15: # You may opt to use, copy, modify, merge, publish, distribute and/or sell
   16: # copies of the Software, and permit persons to whom the Software is
   17: # furnished to do so, under the terms of the COPYING file.
   18: #
   19: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
   20: # KIND, either express or implied.
   21: #
   22: #***************************************************************************
   23: 
   24: BEGIN {
   25:     push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
   26:     push(@INC, ".");
   27: }
   28: 
   29: use strict;
   30: use warnings;
   31: 
   32: use serverhelp qw(
   33:     server_pidfilename
   34:     server_logfilename
   35:     );
   36: 
   37: use sshhelp qw(
   38:     exe_ext
   39:     );
   40: 
   41: my $verbose = 0;     # set to 1 for debugging
   42: my $port = 8990;     # just a default
   43: my $ipvnum = 4;      # default IP version of rtsp server
   44: my $idnum = 1;       # default rtsp server instance number
   45: my $proto = 'rtsp';  # protocol the rtsp server speaks
   46: my $pidfile;         # rtsp server pid file
   47: my $portfile;
   48: my $logfile;         # rtsp server log file
   49: my $srcdir;
   50: 
   51: my $flags  = "";
   52: my $path   = '.';
   53: my $logdir = $path .'/log';
   54: 
   55: while(@ARGV) {
   56:     if($ARGV[0] eq '--pidfile') {
   57:         if($ARGV[1]) {
   58:             $pidfile = $ARGV[1];
   59:             shift @ARGV;
   60:         }
   61:     }
   62:     elsif($ARGV[0] eq '--portfile') {
   63:         if($ARGV[1]) {
   64:             $portfile = $ARGV[1];
   65:             shift @ARGV;
   66:         }
   67:     }
   68:     elsif($ARGV[0] eq '--logfile') {
   69:         if($ARGV[1]) {
   70:             $logfile = $ARGV[1];
   71:             shift @ARGV;
   72:         }
   73:     }
   74:     elsif($ARGV[0] eq '--srcdir') {
   75:         if($ARGV[1]) {
   76:             $srcdir = $ARGV[1];
   77:             shift @ARGV;
   78:         }
   79:     }
   80:     elsif($ARGV[0] eq '--ipv4') {
   81:         $ipvnum = 4;
   82:     }
   83:     elsif($ARGV[0] eq '--ipv6') {
   84:         $ipvnum = 6;
   85:     }
   86:     elsif($ARGV[0] eq '--port') {
   87:         if($ARGV[1] =~ /^(\d+)$/) {
   88:             $port = $1;
   89:             shift @ARGV;
   90:         }
   91:     }
   92:     elsif($ARGV[0] eq '--id') {
   93:         if($ARGV[1] =~ /^(\d+)$/) {
   94:             $idnum = $1 if($1 > 0);
   95:             shift @ARGV;
   96:         }
   97:     }
   98:     elsif($ARGV[0] eq '--verbose') {
   99:         $verbose = 1;
  100:     }
  101:     else {
  102:         print STDERR "\nWarning: rtspserver.pl unknown parameter: $ARGV[0]\n";
  103:     }
  104:     shift @ARGV;
  105: }
  106: 
  107: if(!$srcdir) {
  108:     $srcdir = $ENV{'srcdir'} || '.';
  109: }
  110: if(!$pidfile) {
  111:     $pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
  112: }
  113: if(!$logfile) {
  114:     $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
  115: }
  116: 
  117: $flags .= "--pidfile \"$pidfile\" ".
  118:     "--portfile \"$portfile\" ".
  119:     "--logfile \"$logfile\" ";
  120: $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
  121: 
  122: exec("server/rtspd".exe_ext('SRV')." $flags");

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>