summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
diff options
context:
space:
mode:
authorgordon <gordon@FreeBSD.org>2002-11-08 17:06:15 +0000
committergordon <gordon@FreeBSD.org>2002-11-08 17:06:15 +0000
commit67cb5b60d20b553f24739f595d753d3593883c70 (patch)
treed36e38ae5a611e64f2ba945d936c8f171439dffe /etc/rc.subr
parent5c2d1427fb6a9333bffb46166548a54dbb86013d (diff)
downloadFreeBSD-src-67cb5b60d20b553f24739f595d753d3593883c70.zip
FreeBSD-src-67cb5b60d20b553f24739f595d753d3593883c70.tar.gz
Diff reduction to NetBSD:
Fix a minor grammer nit. Get rid of _echo that uses logger and just call logger in the 3 routines that need it. Add a comment referencing rc.conf(5) in the case of an incorrectly set variable. This pulls rc.subr up to 1.51 of rc.subr. I skipped 1.49 (systrace support) since I don't have systrace. Obtained from: NetBSD
Diffstat (limited to 'etc/rc.subr')
-rw-r--r--etc/rc.subr35
1 files changed, 16 insertions, 19 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index 3f11e08..ed69e4e 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -132,7 +132,7 @@ checkyesno()
return 1
;;
*)
- warn "\$${1} is not set properly."
+ warn "\$${1} is not set properly - see rc.conf(5)."
return 1
;;
esac
@@ -839,7 +839,7 @@ load_rc_config()
#
rc_usage()
{
- echo -n 1>&2 "usage: $0 [fast|force]("
+ echo -n 1>&2 "Usage: $0 [fast|force]("
_sep=
for _elem in $*; do
@@ -851,18 +851,6 @@ rc_usage()
}
#
-# _echo prefix message
-# Display message preceded by "$prefix:". Log to syslog as well.
-# XXX - syslogd may not be listening (especially if this subroutine
-# is called at boot before syslogd has had a chance to startup).
-#
-_echo()
-{
- [ -x /usr/bin/logger ] && /usr/bin/logger "$0: $1: $2"
- echo "$0: $1: $2"
-}
-
-#
# err exitval message
# Display message to stderr and log to the syslog, and exit with exitval.
#
@@ -871,7 +859,10 @@ err()
exitval=$1
shift
- _echo 1>&2 "ERROR" "$*"
+ if [ -x /usr/bin/logger ]; then
+ logger "$0: ERROR: $*"
+ fi
+ echo 1>&2 "$0: ERROR: $*"
exit $exitval
}
@@ -881,7 +872,10 @@ err()
#
warn()
{
- _echo 1>&2 "WARNING" "$*"
+ if [ -x /usr/bin/logger ]; then
+ logger "$0: WARNING: $*"
+ fi
+ echo 1>&2 "$0: WARNING: $*"
}
#
@@ -890,12 +884,15 @@ warn()
#
info()
{
- _echo "INFO" "$*"
+ if [ -x /usr/bin/logger ]; then
+ logger "$0: INFO: $*"
+ fi
+ echo "$0: INFO: $*"
}
#
# debug message
-# If debugging is enabled in rc.conf output message to stderr and syslog.
+# If debugging is enabled in rc.conf output message to stderr.
# BEWARE that you don't call any subroutine that itself calls this
# function.
#
@@ -903,7 +900,7 @@ debug()
{
case ${rc_debug} in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- _echo 1>&2 "DEBUG" "$*"
+ echo 1>&2 "$0: DEBUG: $*"
return
;;
esac
OpenPOWER on IntegriCloud