File: ping

package info (click to toggle)
cfingerd 1.3.2-11.0
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 600 kB
  • ctags: 396
  • sloc: ansic: 3,220; perl: 572; makefile: 155; sh: 52
file content (34 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/perl
#
# Nice little script to do a ping to someone else's site...
# Version 1.0 by Martin Schulze (joey@infodrom.north.de)
# based on trace 1.0.1 by Ken Hollis (khollis@bitgate.com)

$ENV{'PATH'} = '/bin:/usr/bin';
$path = $ENV{'PATH'};

# Turn non-buffered input/output on
$| = 1;

# Get our site that we want a traceroute to be performed for
$pingsite = $ARGV[0];
$pingsite =~ tr/,/./;

# Set maximum packets to send
$max_packets = "-k 5";

# And check to make sure they entered a site
if ($pingsite) {
    print "Performing a ping to $pingsite... \n\n";
    system("ping $max_packets $pingsite");
    print "\nDone.\n";
} else {
    print <<"EOT";
  Ping script 1.0
  by Ken Hollis and Martin Schulze

  Please finger \"site.whatever\" with your \".\" marks converted to \",\" 
  marks instead.  This is because the finger daemon separates all options 
  by a \".\".
EOT
}