/*
* 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
*/
/*
*/
#include <dirent.h>
#include <locale.h>
#include <libintl.h>
#include <stdlib.h>
#include <strings.h>
#include <stdio.h>
#include <unistd.h>
#include <bsm/audit_record.h>
#include "praudit.h"
#include "toktable.h"
/*
* ----------------------------------------------------------------------
* praudit - display contents of audit trail file
*
* main() - main control
* input: - command line input: praudit -r|s -l -x -ddelim. -c filename(s)
* ----------------------------------------------------------------------
*/
int
{
int i = 0, retstat;
/* Internationalization */
(void) textdomain(TEXT_DOMAIN);
/*
* get audit file names
*/
do {
retstat = 0;
/*
* process each audit file
*/
if (input_mode == FILEMODE) {
gettext("praudit: Cannot associate "
"stdin with %s: %s\n"),
exit(1);
}
}
/*
* Call the library routine to format the
* audit data from stdin and print to stdout
*/
}
if (retstat == -2) {
"[-ddel] [-c] filename...\n"));
exit(1);
} else if (retstat < 0) {
exit(1);
}
return (0);
}
/*
* -------------------------------------------------------------------
* process_options() - get command line flags and file names
* input: - praudit [-r]/[-s] [-l] [-x] [-ddel] [-c] {audit file names}
* output: - {audit file names}
* globals set: format: RAWM / SHORTM / XML / ONELINE or DEFAULTM
* SEPARATOR: default, ",", set here if
* user specified
* NOTE: no changes required here for new audit record format
* -------------------------------------------------------------------
*/
int
{
int c, returnstat = 0;
/*
* check for flags
*/
switch (c) {
case 'c':
break;
case 'r':
if (format & PRF_SHORTM)
returnstat = -2;
else
break;
case 's':
returnstat = -2;
else
format |= PRF_SHORTM;
break;
case 'l':
format |= PRF_ONELINE;
break;
case 'x':
break;
case 'd':
sizeof (SEPARATOR));
else {
gettext("praudit: Delimiter too "
"long. Using default.\n"));
}
break;
default:
returnstat = -2;
break;
}
}
if (*argc > MAXFILENAMES) {
"names.\n"));
return (-1);
}
if (*argc > 0) {
/*
* copy file names from command line
*/
do {
} while (--count > 0);
} else
return (returnstat);
}