/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* acctmerg [-a] [-i] [-p] [-t] [-u] [-v] [file...]
* -p print input files with no processing
* -t output single record that totals all input
* reads std input and 0-NFILE files, all in tacct.h format,
* or all records if -t], writes to std. output
* (still in tacct.h format)
* note that this can be used to summarize the std input
*/
#include <stdio.h>
#include "acctdef.h"
#include <stdlib.h>
0,
"TOTAL"
};
int asciiout;
int asciiinp;
int printonly;
int totalonly;
int uidsum;
int verbose;
int exitcode = 0;
int
{
int i;
while (--argc > 0) {
if (**++argv == '-')
switch (*++*argv) {
case 'a':
asciiout++;
continue;
case 'i':
asciiinp++;
continue;
case 'p':
printonly++;
continue;
case 't':
totalonly++;
continue;
case 'u':
uidsum++;
continue;
case 'v':
verbose++;
asciiout++;
continue;
}
else {
exit(1);
}
exitcode = 1;
/* exit(1); */
}
}
}
if (printonly) {
for (i = 0; i <= nfile; i++)
while (getnext(i))
}
for (i = 0; i <= nfile; i++)
if(getnext(i) == 0) {
exitcode = 2;
}
if (totalonly) /* and write the 'summed' record */
}
/*
* getleast returns ptr to least (lowest uid) element of current
* avail, NULL if none left; always returns 1st of equals
*/
struct tacct *
getleast(void)
{
continue;
!uidsum &&
}
return(least);
}
/*
* writes it out, gets new entry
*/
void
{
char *memcpy();
} else
tp++; /* look at next file */
if (!totalonly)
}
void
{
}
void
{
if (asciiout)
else
}
/*
* getnext reads next record from stream i, returns 1 if one existed
*/
int
getnext(int i)
{
return(0);
if (asciiinp) {
"%ld\t%s\t%e %e %e %e %e %e %e %lu\t%hu\t%hu\t%hu",
return(1);
} else {
return(1);
}
return(0);
}
void
{
}