xref: /illumos-gate/usr/src/cmd/logadm/fn.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  *
25  * logadm/fn.h -- public definitions for fn module
26  */
27 
28 #ifndef	_LOGADM_FN_H
29 #define	_LOGADM_FN_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /* functions that deal with single strings */
38 struct fn *fn_new(const char *s);
39 struct fn *fn_dup(struct fn *fnp);
40 struct fn *fn_dirname(struct fn *fnp);
41 void fn_setn(struct fn *fnp, int n);
42 int fn_getn(struct fn *fnp);
43 void fn_setstat(struct fn *fnp, struct stat *stp);
44 struct stat *fn_getstat(struct fn *fnp);
45 void fn_free(struct fn *fnp);
46 void fn_renew(struct fn *fnp, const char *s);
47 void fn_putc(struct fn *fnp, int c);
48 void fn_puts(struct fn *fnp, const char *s);
49 void fn_putfn(struct fn *fnp, struct fn *srcfnp);
50 void fn_rewind(struct fn *fnp);
51 int fn_getc(struct fn *fnp);
52 int fn_peekc(struct fn *fnp);
53 char *fn_s(struct fn *fnp);
54 boolean_t fn_isgz(struct fn *fnp);
55 
56 /* functions that deal with lists of strings */
57 struct fn_list *fn_list_new(const char * const *slist);
58 struct fn_list *fn_list_dup(struct fn_list *fnlp);
59 void fn_list_free(struct fn_list *fnlp);
60 void fn_list_adds(struct fn_list *fnlp, const char *s);
61 void fn_list_addfn(struct fn_list *fnlp, struct fn *fnp);
62 void fn_list_rewind(struct fn_list *fnlp);
63 struct fn *fn_list_next(struct fn_list *fnlp);
64 void fn_list_addfn_list(struct fn_list *fnlp, struct fn_list *fnlp2);
65 void fn_list_appendrange(struct fn_list *fnlp,
66     const char *s, const char *limit);
67 void fn_list_print(struct fn_list *fnlp, FILE *stream);
68 off_t fn_list_totalsize(struct fn_list *fnlp);
69 struct fn *fn_list_popoldest(struct fn_list *fnlp);
70 boolean_t fn_list_empty(struct fn_list *fnlp);
71 int fn_list_count(struct fn_list *fnlp);
72 
73 #ifdef	__cplusplus
74 }
75 #endif
76 
77 #endif	/* _LOGADM_FN_H */
78