File: dig

package info (click to toggle)
epic4 1%3A3.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,780 kB
  • sloc: ansic: 56,285; makefile: 630; sh: 161; perl: 30
file content (33 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download | duplicates (11)
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
# Contributed to the epic project by Steve Horan on April 21, 1999.
#
# Here's a few useful functions I thought others might find useful

# Find the minimum/maximum number. $min(<list>) $max(<list>)
alias max {@ function_return = pop($numsort($*))}
alias min {@ function_return = shift($numsort($*))}

# $commasep(one,two,three) returns "one two three"
# $commamake(one two three) returns "one,two,three"
# Useful in opnotice scripts + other aliases.
alias commasep {@ function_return = split(, $*)}
alias commamake {@ function_return = tr(/ /,/$*)}

# Somewhat kludge function here. This function finds the parent domain
# to given host, rather than using a assumed approach
# e.g. Many would view www.syd.lucid.net.au as being from the domain
# lucid.net.au - when it's parent domain is in fact syd.lucid.net.au
# This function has it's uses, to some more than others.
# requires hop's pipe function, as well as the "dig" program.
# $digdomain(squishycow.syd.lucid.net.au) returns "syd.lucid.net.au"
alias digdomain {
    if (isalpha($right(1 $*)))
        {@ function_return = pipe(dig SOA $* | perl -lane 'print \$1 if /^([^;].
*?)\\.\\s+.*SOA/')}
        {@ function_return = [$*]}
    }

load pipe

# - Wuhphy '99
#   sjhoran@syd.lucid.net.au