Deleted Added
full compact
rc.subr (103262) rc.subr (106643)
1# $NetBSD: rc.subr,v 1.49 2002/05/21 12:31:01 lukem Exp $
1# $NetBSD: rc.subr,v 1.49 2002/05/21 12:31:01 lukem Exp $
2# $FreeBSD: head/etc/rc.subr 103262 2002-09-12 17:27:36Z gordon $
2# $FreeBSD: head/etc/rc.subr 106643 2002-11-08 17:06:15Z gordon $
3#
4# Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 116 unchanged lines hidden (view full) ---

127 return 0
128 ;;
129
130 # "no", "false", "off", or "0"
131 [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
132 return 1
133 ;;
134 *)
3#
4# Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 116 unchanged lines hidden (view full) ---

127 return 0
128 ;;
129
130 # "no", "false", "off", or "0"
131 [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
132 return 1
133 ;;
134 *)
135 warn "\$${1} is not set properly."
135 warn "\$${1} is not set properly - see rc.conf(5)."
136 return 1
137 ;;
138 esac
139}
140
141# reverse_list list
142# print the list in reverse order
143#

--- 690 unchanged lines hidden (view full) ---

834
835#
836# rc_usage commands
837# Print a usage string for $0, with `commands' being a list of
838# valid commands.
839#
840rc_usage()
841{
136 return 1
137 ;;
138 esac
139}
140
141# reverse_list list
142# print the list in reverse order
143#

--- 690 unchanged lines hidden (view full) ---

834
835#
836# rc_usage commands
837# Print a usage string for $0, with `commands' being a list of
838# valid commands.
839#
840rc_usage()
841{
842 echo -n 1>&2 "usage: $0 [fast|force]("
842 echo -n 1>&2 "Usage: $0 [fast|force]("
843
844 _sep=
845 for _elem in $*; do
846 echo -n 1>&2 "$_sep$_elem"
847 _sep="|"
848 done
849 echo 1>&2 ")"
850 exit 1
851}
852
853#
843
844 _sep=
845 for _elem in $*; do
846 echo -n 1>&2 "$_sep$_elem"
847 _sep="|"
848 done
849 echo 1>&2 ")"
850 exit 1
851}
852
853#
854# _echo prefix message
855# Display message preceded by "$prefix:". Log to syslog as well.
856# XXX - syslogd may not be listening (especially if this subroutine
857# is called at boot before syslogd has had a chance to startup).
858#
859_echo()
860{
861 [ -x /usr/bin/logger ] && /usr/bin/logger "$0: $1: $2"
862 echo "$0: $1: $2"
863}
864
865#
866# err exitval message
867# Display message to stderr and log to the syslog, and exit with exitval.
868#
869err()
870{
871 exitval=$1
872 shift
873
854# err exitval message
855# Display message to stderr and log to the syslog, and exit with exitval.
856#
857err()
858{
859 exitval=$1
860 shift
861
874 _echo 1>&2 "ERROR" "$*"
862 if [ -x /usr/bin/logger ]; then
863 logger "$0: ERROR: $*"
864 fi
865 echo 1>&2 "$0: ERROR: $*"
875 exit $exitval
876}
877
878#
879# warn message
880# Display message to stderr and log to the syslog.
881#
882warn()
883{
866 exit $exitval
867}
868
869#
870# warn message
871# Display message to stderr and log to the syslog.
872#
873warn()
874{
884 _echo 1>&2 "WARNING" "$*"
875 if [ -x /usr/bin/logger ]; then
876 logger "$0: WARNING: $*"
877 fi
878 echo 1>&2 "$0: WARNING: $*"
885}
886
887#
888# info message
889# Display informational message to stdout and log to syslog.
890#
891info()
892{
879}
880
881#
882# info message
883# Display informational message to stdout and log to syslog.
884#
885info()
886{
893 _echo "INFO" "$*"
887 if [ -x /usr/bin/logger ]; then
888 logger "$0: INFO: $*"
889 fi
890 echo "$0: INFO: $*"
894}
895
896#
897# debug message
891}
892
893#
894# debug message
898# If debugging is enabled in rc.conf output message to stderr and syslog.
895# If debugging is enabled in rc.conf output message to stderr.
899# BEWARE that you don't call any subroutine that itself calls this
900# function.
901#
902debug()
903{
904 case ${rc_debug} in
905 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
896# BEWARE that you don't call any subroutine that itself calls this
897# function.
898#
899debug()
900{
901 case ${rc_debug} in
902 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
906 _echo 1>&2 "DEBUG" "$*"
903 echo 1>&2 "$0: DEBUG: $*"
907 return
908 ;;
909 esac
910}
911
912#
913# backup_file action file cur backup
914# Make a backup copy of `file' into `cur', and save the previous

--- 82 unchanged lines hidden ---
904 return
905 ;;
906 esac
907}
908
909#
910# backup_file action file cur backup
911# Make a backup copy of `file' into `cur', and save the previous

--- 82 unchanged lines hidden ---