summaryrefslogtreecommitdiffstats
path: root/VisualNaCro/recorder.pl
diff options
context:
space:
mode:
authordscho <dscho>2005-01-21 14:30:05 +0000
committerdscho <dscho>2005-01-21 14:30:05 +0000
commitdbc826d4abc171bed44d1f42a22c2c5bdfef38ef (patch)
treec7d2d2f32f6549343bd17d836f86a754ba1c9777 /VisualNaCro/recorder.pl
parentba10bceedd9169fabc120c22538649723b92af67 (diff)
downloadlibtdevnc-dbc826d4abc171bed44d1f42a22c2c5bdfef38ef.tar.gz
libtdevnc-dbc826d4abc171bed44d1f42a22c2c5bdfef38ef.zip
use Getopt
Diffstat (limited to 'VisualNaCro/recorder.pl')
-rw-r--r--VisualNaCro/recorder.pl32
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);