Change g flag to i as in the PR.

Don't allow interval to be set to > 11 minutes.
Rephrase option blurb.
This commit is contained in:
christos 2005-07-01 15:31:18 +00:00
parent e02a83a82d
commit 6b7013d1ad
2 changed files with 28 additions and 20 deletions

View File

@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)rwhod.8 8.2 (Berkeley) 12/11/93
.\" $NetBSD: rwhod.8,v 1.14 2005/07/01 13:07:21 christos Exp $
.\" $NetBSD: rwhod.8,v 1.15 2005/07/01 15:31:18 christos Exp $
.\"
.Dd July 1, 2005
.Dt RWHOD 8
@ -36,7 +36,7 @@
.Nd system status server
.Sh SYNOPSIS
.Nm
.Op Fl g Ar time
.Op Fl i Ar interval
.Sh DESCRIPTION
.Nm
is the server which maintains the database used by the
@ -47,14 +47,20 @@ programs. Its operation is predicated on the ability to
.Em broadcast
messages on a network.
.Pp
.Bl -tag -width flag
.It Fl g Op Ar time
Allows for the broadcast time to be reduced from 3 minutes.
To reduce the broadcast time, the
The following option is available:
.Bl -tag -width XXXXXXXXXXX
.It Fl i Ar interval
Allows for the broadcast interval to be changed from the default 3 minutes.
The
.Ar time
operand can be given as 30 (30 seconds) or
1m (1 minute), for example.
This allows for more real time information about the host.
argument is the number of seconds to change the interval to, or if the
value is suffixed by
.Dq m
then it is interpreted as minutes.
The maximum allowed value for the broadcast interval is 11 minutes
because higher values will cause
.Xr ruptime
to mark the host as being down.
.Pp
.El
.Nm

View File

@ -1,4 +1,4 @@
/* $NetBSD: rwhod.c,v 1.28 2005/07/01 13:07:21 christos Exp $ */
/* $NetBSD: rwhod.c,v 1.29 2005/07/01 15:31:18 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: rwhod.c,v 1.28 2005/07/01 13:07:21 christos Exp $");
__RCSID("$NetBSD: rwhod.c,v 1.29 2005/07/01 15:31:18 christos Exp $");
#endif
#endif /* not lint */
@ -72,12 +72,13 @@ __RCSID("$NetBSD: rwhod.c,v 1.28 2005/07/01 13:07:21 christos Exp $");
#include <util.h>
#include "utmpentry.h"
/*
* Check interval. Don't forget to change the down time check in ruptime
* if this is changed.
*/
#define CHECK_INTERVAL (3 * 60)
/* Time interval limit; ruptime will think that we are down > than this */
#define MAX_INTERVAL (11 * 60)
static char myname[MAXHOSTNAMELEN + 1];
/*
@ -132,9 +133,9 @@ main(int argc, char *argv[])
if (getuid())
errx(EXIT_FAILURE, "not super user");
while ((ch = getopt(argc, argv, "g:")) != -1) {
while ((ch = getopt(argc, argv, "i:")) != -1) {
switch (ch) {
case 'g':
case 'i':
time_interval = (int)strtol(optarg, &ep, 10);
switch (*ep) {
@ -152,10 +153,11 @@ main(int argc, char *argv[])
}
if (time_interval <= 0)
errx(1, "Time must be greater than 0");
errx(1, "Interval must be greater than 0");
if (time_interval > 180)
errx(1, "Cannot be greater than 180 seconds");
if (time_interval > MAX_INTERVAL)
errx(1, "Interval cannot be greater than"
" %d minutes", MAX_INTERVAL / 60);
break;
default:
usage();