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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [bin/] [telnet_starter] - Blame information for rev 36

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

Line No. Rev Author Line
1 2 wfjm
#!/usr/bin/perl -w
2 22 wfjm
# $Id: telnet_starter 547 2013-12-29 13:10:07Z mueller $
3 2 wfjm
#
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 22 wfjm
# Date         Rev  Vers    Comment
17 2 wfjm
# 2010-07-04   312   1.0.3  correct telnet_wrapper path
18
# 2010-04-26   284   1.0.2  add error check for GetOptions
19
# 2009-11-08   248   1.0.1  proper -h handling & text; add -t support;
20
# 2009-11-07   247   1.0    Initial version
21
#
22
 
23
use 5.005;                                  # require Perl 5.005 or higher
24
use strict;                                 # require strict checking
25
 
26
use Getopt::Long;
27
 
28
my %opts = ();
29
GetOptions(\%opts, "h", "t:s", "d:s", "s", "w", "l")
30
  or die "bad options";
31
 
32
if (exists $opts{h}) {
33
  print "usage: telnet_starter [-h] [-t type] [-d type] [-s] [-w] [-l]\n";
34
  print "  -h       help, print this text and quit\n";
35
  print "  -t term  set terminal type, vt100 or vt52 (def: vt100)\n";
36
  print "  -d dev   set device type, DLx or DZx for x'the line (def: DL0)\n";
37
  print "  -s       use simh ports, default is to use rri ports\n";
38
  print "  -w       use wide 132 column screen (default 80 columns)\n";
39
  print "  -l       use long 48 lines screen (default 24 lines)\n";
40
  exit 0;
41
}
42
 
43
my $emu    = "xterm";
44
my $telnet = $ENV{"RETROBASE"} . "/tools/bin/telnet_wrapper";
45
 
46
my @args;
47
my $term = "vt100";
48
my $dev  = "DL";
49
my $line = 0;
50
my $port;
51
my $title;
52
 
53
if (exists $opts{t}) {
54
  if ($opts{t} =~ m{^(vt100|vt52)$} ) {
55
    $term = $opts{t};
56
  } else {
57
    printf "unsupported terminal type: %s\n", $opts{t};
58
    exit 1;
59
  }
60
}
61
 
62
if (exists $opts{d}) {
63
  if ($opts{d} =~ m{^(DL|DZ)(\d*)$}i ) {
64
    $dev  = uc $1;
65
    $line = int $2;
66
  } else {
67
    printf "unsupported device type: %s\n", $opts{d};
68
    exit 1;
69
  }
70
}
71
 
72
if (exists $opts{s}) {                      # simh ports
73
  $port = 5670 if ($dev eq "DL");
74
  $port = 5671 if ($dev eq "DZ");
75
  $title = sprintf "\"%s %s\"", $dev, $term;
76
} else {                                    # rri ports
77
  $port = 8000+$line if ($dev eq "DL");
78
  $port = 8002+$line if ($dev eq "DZ");
79
  $title = sprintf "\"%s%d %s\"", $dev, $line, $term;
80
}
81
 
82
my $geo_w = 80;
83
my $geo_l = 24;
84
$geo_w = 132 if exists $opts{w};
85
$geo_l =  48 if exists $opts{l};
86
 
87
push @args, "-j", "-rightbar", "-sb", "-sl", "500";
88
push @args, "-bg", "gray90", "-fg", "black";
89
push @args, "-ti", $term;
90
push @args, "-geo", sprintf("%dx%d", $geo_w, $geo_l);
91
push @args, "-T", $title;
92
push @args, "-e", $telnet, "localhost", sprintf("%d",$port);
93
 
94
print $emu, " ", join " ",@args, "\n";
95
 
96
my $rc = system $emu, @args;
97
if ($rc != 0) {
98
  print STDERR "xterm failed with rc=$rc\n";
99
}

powered by: WebSVN 2.1.0

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