File: query.sh

package info (click to toggle)
smail 3.2.0.102-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,228 kB
  • ctags: 3,924
  • sloc: ansic: 41,366; sh: 3,434; makefile: 2,349; awk: 689; perl: 598; yacc: 427; sed: 2
file content (33 lines) | stat: -rw-r--r-- 963 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
# @(#) query.sh,v 1.2 1990/10/24 05:21:26 tron Exp
#
# match hosts in a shell case statement.  It is generally more
# efficient to use a paths file and a method file to perform this kind
# of routing.
#
# See the source file samples/queryprog/routers for more information
# on how this shell script is to be used as part of a complete router
# file entry.

# The hostname is passed as the first argument, write a path and
# transport for each host that we match.  Alternately, no transport is
# output if the default is sufficient.
case "$1" in

\[*)	# look for internet addresses in square brackets
	inet=`echo "$1" | sed -n 's/^\[\([0-9.]*\)\]$/[\1]/p'`
	if [ "$inet" ]; then
		echo $inet smtp
	else
		exit 1
	fi;;
foo)	echo foo uusmtp;;
bar)	echo foo!bar uusmtp;;
curds)	echo curds;;
whey)	echo curds!whey;;
*' '*|*'	'*) exit 1;;	# watch out for hostnames with whitespace
*)	echo foo!$1 uusmtp;;	# forward mail for unknown hosts to foo

esac

exit 0