xref: /titanic_51/usr/src/cmd/acct/acctcon2.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 1992 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.9   */
31 /*
32  *	acctcon2 <ctmp >ctacct
33  *	reads std. input (ctmp.h/ascii format)
34  *	converts to tacct.h form, writes to std. output
35  */
36 
37 #include <sys/types.h>
38 #include "acctdef.h"
39 #include <stdio.h>
40 
41 struct	ctmp	cb;
42 struct	tacct	tb;
43 
44 main(argc, argv)
45 char **argv;
46 {
47 	tb.ta_sc = 1;
48 	while (scanf("%lu\t%ld\t%s\t%lu\t%lu\t%lu\t%*[^\n]",
49 		&cb.ct_tty,
50 		&cb.ct_uid,
51 		cb.ct_name,
52 		&cb.ct_con[0],
53 		&cb.ct_con[1],
54 		&cb.ct_start) != EOF) {
55 
56 		tb.ta_uid = cb.ct_uid;
57 		CPYN(tb.ta_name, cb.ct_name);
58 		tb.ta_con[0] = MINS(cb.ct_con[0]);
59 		tb.ta_con[1] = MINS(cb.ct_con[1]);
60 		fwrite(&tb, sizeof (tb), 1, stdout);
61 	}
62 	exit(0);
63 }
64