From 3c8a1444d9a85ddcdc7a981606f30ca6dc22dfd6 Mon Sep 17 00:00:00 2001 From: jmmv Date: Fri, 2 Apr 2004 13:13:47 +0000 Subject: [PATCH] Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts. This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set. Closes PR misc/23908. --- etc/daily | 3 ++- etc/monthly | 3 ++- etc/rc.subr | 6 ++++-- etc/security | 4 +++- etc/weekly | 3 ++- share/man/man8/rc.subr.8 | 19 +++++++++++++++++-- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/etc/daily b/etc/daily index 65e5c0fe625b..cc20848d1aeb 100644 --- a/etc/daily +++ b/etc/daily @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: daily,v 1.58 2004/03/29 02:17:26 mrg Exp $ +# $NetBSD: daily,v 1.59 2004/04/02 13:13:47 jmmv Exp $ # @(#)daily 8.2 (Berkeley) 1/25/94 # @@ -13,6 +13,7 @@ fi host=`hostname` date=`date` +rcvar_manpage='daily.conf(5)' echo "To: ${MAILTO:-root}" echo "Subject: $host daily output for $date" diff --git a/etc/monthly b/etc/monthly index 558618ad74c6..fdad2af04409 100644 --- a/etc/monthly +++ b/etc/monthly @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: monthly,v 1.8 2000/01/10 17:03:49 ad Exp $ +# $NetBSD: monthly,v 1.9 2004/04/02 13:13:47 jmmv Exp $ # from: @(#)monthly 8.1 (Berkeley) 6/9/93 # @@ -13,6 +13,7 @@ fi host=`hostname` date=`date` +rcvar_manpage='monthly.conf(5)' echo "To: ${MAILTO:-root}" echo "Subject: $host monthly output for $date" diff --git a/etc/rc.subr b/etc/rc.subr index e9872d6c7a77..67d7fc1ed223 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -1,4 +1,4 @@ -# $NetBSD: rc.subr,v 1.61 2004/01/06 00:52:24 lukem Exp $ +# $NetBSD: rc.subr,v 1.62 2004/04/02 13:13:47 jmmv Exp $ # # Copyright (c) 1997-2002 The NetBSD Foundation, Inc. # All rights reserved. @@ -38,6 +38,8 @@ # functions used by various rc scripts # +: ${rcvar_manpage:='rc.conf(5)'} + # # functions # --------- @@ -62,7 +64,7 @@ checkyesno() return 1 ;; *) - warn "\$${1} is not set properly - see rc.conf(5)." + warn "\$${1} is not set properly - see ${rcvar_manpage}." return 1 ;; esac diff --git a/etc/security b/etc/security index 3b2853c486d2..b218953e06b0 100644 --- a/etc/security +++ b/etc/security @@ -1,11 +1,13 @@ #!/bin/sh - # -# $NetBSD: security,v 1.88 2004/02/09 09:04:13 jdolecek Exp $ +# $NetBSD: security,v 1.89 2004/04/02 13:13:47 jmmv Exp $ # from: @(#)security 8.1 (Berkeley) 6/9/93 # PATH=/sbin:/usr/sbin:/bin:/usr/bin +rcvar_manpage='security.conf(5)' + if [ -f /etc/rc.subr ]; then . /etc/rc.subr else diff --git a/etc/weekly b/etc/weekly index 7a22217015cf..2cc622f144d4 100644 --- a/etc/weekly +++ b/etc/weekly @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: weekly,v 1.17 2001/06/18 10:54:02 lukem Exp $ +# $NetBSD: weekly,v 1.18 2004/04/02 13:13:47 jmmv Exp $ # from: @(#)weekly 8.2 (Berkeley) 1/2/94 # @@ -13,6 +13,7 @@ fi host=`hostname` date=`date` +rcvar_manpage='weekly.conf(5)' echo "To: ${MAILTO:-root}" echo "Subject: $host weekly output for $date" diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8 index 96b8331d2c53..46064ca3c217 100644 --- a/share/man/man8/rc.subr.8 +++ b/share/man/man8/rc.subr.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: rc.subr.8,v 1.12 2004/01/06 00:52:24 lukem Exp $ +.\" $NetBSD: rc.subr.8,v 1.13 2004/04/02 13:13:48 jmmv Exp $ .\" .\" Copyright (c) 2002-2004 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 6, 2004 +.Dd April 2, 2004 .Dt RC.SUBR 8 .Os .Sh NAME @@ -171,6 +171,13 @@ Otherwise, warn that .Ar var is not set correctly. The values are case insensitive. +.Pp +Note that the warning message shown by this function when +.Ar var +is not set references a manual page where the user can find more information. +Its name is picked up from the +.Sy rcvar_manpage +variable. .It Xo .Ic check_pidfile .Ar pidfile @@ -347,6 +354,14 @@ The value of is checked with .Ic checkyesno to determine if this method should be run. +.It Sy rcvar_manpage +The manual page where the user can look at for information about +.Sy rcvar . +It will be part of the warning message shown when +.Sy rcvar +is undefined. +Defaults to +.Xr rc.conf 5 . .It Sy command Full path to the command. Not required if