change accton to work w/NWO

This commit is contained in:
cgd 1993-05-03 01:53:21 +00:00
parent fb57066e93
commit 7851679e8b
3 changed files with 85 additions and 5 deletions

View File

@ -1,6 +1,8 @@
# @(#)Makefile 5.3 (Berkeley) 5/11/90
PROG= accton
NOMAN= noman
MAN8= accton.0
LINKS= ${BINDIR}/accton ${BINDIR}/acctoff
MLINKS= accton.8 acctoff.8
.include <bsd.prog.mk>

59
usr.sbin/accton/accton.8 Normal file
View File

@ -0,0 +1,59 @@
.\" Copyright (c) 1993 Christopher G. Demetriou
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: accton.8,v 1.1 1993/05/03 01:53:22 cgd Exp $
.\"
.Dd May 2, 1993
.Dt ACCTON 8
.Os NetBSD 0.8a
.Sh NAME
.Nm accton ,
.Nm acctoff
.Nd enable/disable system accounting
.Sh SYNOPSIS
.Nm accton
.Nm acctoff
.Sh DESCRIPTION
.Nm Accton
enables generation of kernel accounting records, and
.Nm acctoff
disables their generation.
The actual logging of accounting records is done
by the
.Xr accoutant 8
program.
.Sh SEE ALSO
.Xr accountant 8 ,
.Xr lastcomm 1 ,
.Xr acct 5
.Sh HISTORY
The
.Nm accton
program probably appeared in Version 6 AT&T UNIX,
or thereabouts, but was substantially modified for
the new device-based accounting procedures in NetBSD 0.8a.
.Nm Acctoff
first appeard in NetBSD 0.8a.

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 1993 Christopher G. Demetriou
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
*
@ -38,20 +39,38 @@ char copyright[] =
#endif /* not lint */
#ifndef lint
static char sccsid[] = "@(#)accton.c 4.3 (Berkeley) 6/1/90";
/* from static char sccsid[] = "@(#)accton.c 4.3 (Berkeley) 6/1/90"; */
static char rcsid[] = "$Id: accton.c,v 1.2 1993/05/03 01:53:23 cgd Exp $";
#endif /* not lint */
#include <stdio.h>
#include <string.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc > 2) {
fputs("usage: accton [file]\n", stderr);
int turnon;
char *tail;
if ((tail = strrchr(argv[0], '/')) == NULL) {
tail = argv[0];
} else {
tail++;
}
if (!strcmp(tail, "accton")) {
turnon = 1;
} else if (!strcmp(tail, "acctoff")) {
turnon = 0;
} else {
turnon = -1;
}
if (argc != 1 || turnon == -1) {
fputs("usage: accton\n", stderr);
fputs("or: acctoff\n", stderr);
exit(1);
}
if (acct(argc == 2 ? argv[1] : (char *)NULL)) {
if (acct(turnon) < 0) {
perror("accton");
exit(1);
}