File: urlize.pl

package info (click to toggle)
nagios-plugins 1.4.5-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 6,520 kB
  • ctags: 3,564
  • sloc: ansic: 34,372; perl: 12,573; sh: 10,669; python: 444; makefile: 440; awk: 45
file content (29 lines) | stat: -rw-r--r-- 755 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/perl
#
# urlize.pl
#   jcw, 5/12/00
#
# A wrapper around Nagios plugins that provides a URL link in the output
#
#
# Pay close attention to quoting to ensure that the shell passes the
# expected data to the plugin. For example, in:
#
#    urlize http://example.com/ check_http -H example.com -r 'two words'
#
# the shell will remove the single quotes and urlize will see:
#
#    urlize http://example.com/ check_http -H example.com -r two words
#
# You probably want:
#
#    urlize http://example.com/ \"check_http -H example.com -r 'two words'\"
#
($#ARGV < 1) && die "Incorrect arguments";
my $url = shift;

chomp ($result = `@ARGV`);
print "<A HREF=\"$url\">$result</A>\n";

# exit with same exit value as the child produced
exit ($? >> 8);