/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "statcommon.h"
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <unistd.h>
#include <locale.h>
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
/*
* Display header every HEADER_MOD lines printed
*/
extern char *optarg;
static int count;
static int flags;
static int interval;
static void display_stats();
static void eauditon();
static void parse_args();
static void usage_exit();
static int strisdigit();
int
int argc;
char **argv;
{
register int i;
au_stat_t s;
(void) textdomain(TEXT_DOMAIN);
if (!flags) {
if (timestamp_fmt != NODATE)
display_stats(&s, 0);
exit(0);
}
exit(0);
/* CSTYLED */
for (i = 0;; i++) {
if (timestamp_fmt != NODATE)
display_stats(&s, i);
if (i == count - 1)
break;
}
return (0);
}
static void
au_stat_t *s;
{
"%4u %n%4u %n%4u %n%4u %n%4u %n%4u %n%4u %n%4u %n%4u %n%4u %n%4u %n%4u%n",
s->as_generated, &(offset[0]),
/* print a properly aligned header every HEADER_MOD lines */
(void) printf(
"%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s\n",
}
}
static void
int cmd;
int length;
{
perror("auditstat: auditon");
exit(1);
}
}
static void
int argc;
char **argv;
{
int c;
switch (c) {
case 'c':
usage_exit();
if (strisdigit(optarg)) {
"auditstat: invalid count specified.\n");
exit(1);
}
break;
case 'h':
usage_exit();
if (strisdigit(optarg)) {
"auditstat: invalid header arg specified.\n");
exit(1);
}
break;
case 'i':
usage_exit();
if (strisdigit(optarg)) {
"auditstat: invalid interval specified.\n");
exit(1);
}
break;
case 'n':
usage_exit();
break;
case 'v':
usage_exit();
break;
case 'T':
if (optarg) {
if (*optarg == 'u')
else if (*optarg == 'd')
else
usage_exit();
} else {
usage_exit();
}
break;
case '?':
default:
usage_exit();
break;
}
}
}
static void
{
"auditstat: usage: auditstat [-c count] [-h lines] "
"[-T d|u] [-i interval] [-n] [-v]\n");
exit(1);
}
static int
strisdigit(s)
char *s;
{
for (; *s; s++)
if (!isdigit(*s))
return (1);
return (0);
}