OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.5/] [tools/] [bin/] [telnet_starter] - Blame information for rev 37

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wfjm
#!/usr/bin/perl -w
2
# $Id: telnet_starter 314 2010-07-09 17:38:41Z mueller $
3
#
4
# Copyright 2009-2010 by Walter F.J. Mueller 
5
#
6
# This program is free software; you may redistribute and/or modify it under
7
# the terms of the GNU General Public License as published by the Free
8
# Software Foundation, either version 2, or at your option any later version.
9
#
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
12
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
# for complete details.
14
#
15
#  Revision History:
16
# 2010-07-04   312   1.0.3  correct telnet_wrapper path
17
# 2010-04-26   284   1.0.2  add error check for GetOptions
18
# 2009-11-08   248   1.0.1  proper -h handling & text; add -t support;
19
# 2009-11-07   247   1.0    Initial version
20
#
21
 
22
use 5.005;                                  # require Perl 5.005 or higher
23
use strict;                                 # require strict checking
24
 
25
use Getopt::Long;
26
 
27
my %opts = ();
28
GetOptions(\%opts, "h", "t:s", "d:s", "s", "w", "l")
29
  or die "bad options";
30
 
31
if (exists $opts{h}) {
32
  print "usage: telnet_starter [-h] [-t type] [-d type] [-s] [-w] [-l]\n";
33
  print "  -h       help, print this text and quit\n";
34
  print "  -t term  set terminal type, vt100 or vt52 (def: vt100)\n";
35
  print "  -d dev   set device type, DLx or DZx for x'the line (def: DL0)\n";
36
  print "  -s       use simh ports, default is to use rri ports\n";
37
  print "  -w       use wide 132 column screen (default 80 columns)\n";
38
  print "  -l       use long 48 lines screen (default 24 lines)\n";
39
  exit 0;
40
}
41
 
42
my $emu    = "xterm";
43
my $telnet = $ENV{"RETROBASE"} . "/tools/bin/telnet_wrapper";
44
 
45
my @args;
46
my $term = "vt100";
47
my $dev  = "DL";
48
my $line = 0;
49
my $port;
50
my $title;
51
 
52
if (exists $opts{t}) {
53
  if ($opts{t} =~ m{^(vt100|vt52)$} ) {
54
    $term = $opts{t};
55
  } else {
56
    printf "unsupported terminal type: %s\n", $opts{t};
57
    exit 1;
58
  }
59
}
60
 
61
if (exists $opts{d}) {
62
  if ($opts{d} =~ m{^(DL|DZ)(\d*)$}i ) {
63
    $dev  = uc $1;
64
    $line = int $2;
65
  } else {
66
    printf "unsupported device type: %s\n", $opts{d};
67
    exit 1;
68
  }
69
}
70
 
71
if (exists $opts{s}) {                      # simh ports
72
  $port = 5670 if ($dev eq "DL");
73
  $port = 5671 if ($dev eq "DZ");
74
  $title = sprintf "\"%s %s\"", $dev, $term;
75
} else {                                    # rri ports
76
  $port = 8000+$line if ($dev eq "DL");
77
  $port = 8002+$line if ($dev eq "DZ");
78
  $title = sprintf "\"%s%d %s\"", $dev, $line, $term;
79
}
80
 
81
my $geo_w = 80;
82
my $geo_l = 24;
83
$geo_w = 132 if exists $opts{w};
84
$geo_l =  48 if exists $opts{l};
85
 
86
push @args, "-j", "-rightbar", "-sb", "-sl", "500";
87
push @args, "-bg", "gray90", "-fg", "black";
88
push @args, "-ti", $term;
89
push @args, "-geo", sprintf("%dx%d", $geo_w, $geo_l);
90
push @args, "-T", $title;
91
push @args, "-e", $telnet, "localhost", sprintf("%d",$port);
92
 
93
print $emu, " ", join " ",@args, "\n";
94
 
95
my $rc = system $emu, @args;
96
if ($rc != 0) {
97
  print STDERR "xterm failed with rc=$rc\n";
98
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.