Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / staticroute
blob20e6ec60c062e4482780ee6238fa5edc4f842670
1 #!/bin/sh
3 # $NetBSD: staticroute,v 1.4 2009/10/07 07:51:28 tron Exp $
6 # PROVIDE: staticroute
7 # REQUIRE: network
8 # BEFORE: NETWORKING
10 # See the route.conf(5) manual page for details.
12 $_rc_subr_loaded . /etc/rc.subr
14 name="staticroute"
15 start_cmd="staticroute_doit Adding add"
16 stop_cmd="staticroute_doit Deleting delete"
18 staticroute_doit() {
19 retval=0
21 if [ -s /etc/route.conf ]; then
22 echo "$1 static routes."
23 while read args; do
24 [ -z "$args" ] && continue
25 case "$args" in
26 "#"*)
28 "+"*)
29 if [ $2 = "add" ]; then
30 eval ${args#*+} || retval=1
33 "-"*)
34 if [ $2 = "delete" ]; then
35 eval ${args#*-} || retval=1
39 route -q $2 -$args || retval=1
41 esac
42 done < /etc/route.conf
45 return $retval
48 load_rc_config $name
49 run_rc_command "$1"