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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [tools/] [bin/] [telnet_wrapper] - Blame information for rev 2

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_wrapper 314 2010-07-09 17:38:41Z mueller $
3
#
4
# Copyright 2009- 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
# 2009-11-07   246   1.0    Initial version
17
#
18
 
19
use 5.005;                                  # require Perl 5.005 or higher
20
use strict;                                 # require strict checking
21
 
22
if (scalar(@ARGV) != 2) {
23
  print STDERR "usage: telnet_wrapper host port\n";
24
  exit 1;
25
}
26
 
27
my $host = $ARGV[0];
28
my $port = $ARGV[1];
29
 
30
print "$host $port\n";
31
 
32
my $telnet = `which telnet`;
33
chomp $telnet;
34
 
35
while(1) {
36
  my $rc = system $telnet, $host, $port;
37
  if ($rc != 0) {
38
    print STDERR "telnet failed with rc=$rc\n";
39
  }
40
  print "enter q or <^D> to quit, otherwise reconnect: ";
41
  my $buf;
42
  my $nc = read STDIN, $buf, 1;
43
  if (not defined $nc) {
44
    print "\n";
45
    exit 1;
46
  }
47
  if ($nc == 0) {
48
    print "\n";
49
    exit 0;
50
  }
51
  if ($buf eq "q") {
52
    exit 0;
53
  }
54
}

powered by: WebSVN 2.1.0

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