diff options
author | dscho <dscho> | 2005-01-21 14:30:05 +0000 |
---|---|---|
committer | dscho <dscho> | 2005-01-21 14:30:05 +0000 |
commit | dbc826d4abc171bed44d1f42a22c2c5bdfef38ef (patch) | |
tree | c7d2d2f32f6549343bd17d836f86a754ba1c9777 /VisualNaCro | |
parent | ba10bceedd9169fabc120c22538649723b92af67 (diff) | |
download | libtdevnc-dbc826d4abc171bed44d1f42a22c2c5bdfef38ef.tar.gz libtdevnc-dbc826d4abc171bed44d1f42a22c2c5bdfef38ef.zip |
use Getopt
Diffstat (limited to 'VisualNaCro')
-rw-r--r-- | VisualNaCro/recorder.pl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/VisualNaCro/recorder.pl b/VisualNaCro/recorder.pl index f84b3f6..bbe3f25 100644 --- a/VisualNaCro/recorder.pl +++ b/VisualNaCro/recorder.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl +use Getopt::Long; use nacro; # TODO: take options @@ -9,6 +10,37 @@ $server="localhost"; $port=5900; $listen_port=5923; +if(!GetOptions( + "script:s" => \$output, + "listen:i" => \$listen_port +) || $#ARGV!=0) { + print STDERR "Usage: $ARGV0 [--script output_name] [--listen listen_port] server[:port]\n"; + exit 2; +} + +$output=~s/\.pl$//; + +$server=$ARGV[0]; + +if($server=~/^(.*):(\d+)$/) { + $server=$1; + $port=$2; + if($2<100) { + $port+=5900; + } +} + +if($listen_port<100) { + $listen_port+=5900; +} + +# do not overwrite script + +if(stat("$output.pl")) { + print STDERR "Will not overwrite $output.pl\n"; + exit 2; +} + # start connection $vnc=nacro::initvnc($server,$port,$listen_port); |