Add usage().

This commit is contained in:
Philippe Charnier 1997-10-15 06:41:19 +00:00
parent 382ac44b63
commit 19112792f5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30425
4 changed files with 35 additions and 24 deletions

View File

@ -28,14 +28,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char copright[] =
#ifndef lint
static const char copyright[] =
"@(#) Copyright (c) 1994 Christopher G. Demetriou\n\
All rights reserved.\n";
static char rcsid[] = "$Id$";
#endif
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
* sa: system accounting
*/
@ -63,6 +66,7 @@ static int cmp_avgdkio __P((const DBT *, const DBT *));
static int cmp_cpumem __P((const DBT *, const DBT *));
static int cmp_avgcpumem __P((const DBT *, const DBT *));
static int cmp_calls __P((const DBT *, const DBT *));
static void usage __P((void));
int aflag, bflag, cflag, dflag, Dflag, fflag, iflag, jflag, kflag;
int Kflag, lflag, mflag, qflag, rflag, sflag, tflag, uflag, vflag;
@ -168,9 +172,7 @@ main(argc, argv)
break;
case '?':
default:
(void)fprintf(stderr,
"usage: sa [-abcdDfijkKlmnqrstu] [-v cutoff] [file ...]\n");
exit(1);
usage();
}
argc -= optind;
@ -224,7 +226,7 @@ main(argc, argv)
}
if (unmask &&
(sigprocmask(SIG_BLOCK, &nmask, &omask) == -1)) {
warn("couldn't set signal mask ");
warn("couldn't set signal mask");
unmask = 0;
error = 1;
}
@ -288,6 +290,14 @@ main(argc, argv)
exit(error);
}
static void
usage()
{
(void)fprintf(stderr,
"usage: sa [-abcdDfijkKlmnqrstu] [-v cutoff] [file ...]\n");
exit(1);
}
static int
acct_load(pn, wr)
char *pn;

View File

@ -28,9 +28,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$Id$";
#endif
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <sys/acct.h>

View File

@ -27,7 +27,7 @@
.\" (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$
.\" $Id: sa.8,v 1.7 1997/02/22 16:13:12 peter Exp $
.\"
.Dd February 25, 1994
.Dt SA 8
@ -42,7 +42,7 @@
.Op Ar
.Sh DESCRIPTION
The
.Nm sa
.Nm
utility reports on, cleans up,
and generally maintains system
accounting files.
@ -96,13 +96,13 @@ User time, in minutes
.El
.Pp
The options to
.Nm sa
.Nm
are:
.Bl -tag -width Ds
.It Fl a
List all command names, including those containing unprintable
characters and those used only once. By default,
.Nm sa
.Nm
places all names containing unprintable characters and
those used only once under the name ``***other''.
.It Fl b
@ -195,7 +195,7 @@ and
flags are honored.
.Pp
The
.Nm sa
.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh FILES
.Bl -tag -width /var/account/usracct -compact
@ -220,7 +220,7 @@ The field labels should be more consistent.
The VM system does not record the CPU storage integral.
.Sh CAVEATS
While the behavior of the options in this version of
.Nm sa
.Nm
was modeled after the original version, there are some intentional
differences and undoubtedly some unintentional ones as well. In
particular, the
@ -230,11 +230,9 @@ option has been added, and the
option now understands more options than it used to.
.Pp
The formats of the summary files created by this version of
.Nm sa
.Nm
are very different than the those used by the original version.
This is not considered a problem, however, because the accounting record
format has changed as well (since user ids are now 32 bits).
.Sh AUTHOR
.Bl -tag
Chris G. Demetriou, cgd@postgres.berkeley.edu
.El
.An Chris G. Demetriou Aq cgd@postgres.berkeley.edu

View File

@ -28,9 +28,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$Id$";
#endif
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <sys/acct.h>
@ -38,6 +39,7 @@ static char rcsid[] = "$Id$";
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "extern.h"
#include "pathnames.h"