xref: /illumos-gate/usr/src/cmd/logadm/fn.h (revision 2a8bcb4e)
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 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /* functions that deal with single strings */
36 struct fn *fn_new(const char *s);
37 struct fn *fn_dup(struct fn *fnp);
38 struct fn *fn_dirname(struct fn *fnp);
39 void fn_setn(struct fn *fnp, int n);
40 int fn_getn(struct fn *fnp);
41 void fn_setstat(struct fn *fnp, struct stat *stp);
42 struct stat *fn_getstat(struct fn *fnp);
43 void fn_free(struct fn *fnp);
44 void fn_renew(struct fn *fnp, const char *s);
45 void fn_putc(struct fn *fnp, int c);
46 void fn_puts(struct fn *fnp, const char *s);
47 void fn_putfn(struct fn *fnp, struct fn *srcfnp);
48 void fn_rewind(struct fn *fnp);
49 int fn_getc(struct fn *fnp);
50 int fn_peekc(struct fn *fnp);
51 char *fn_s(struct fn *fnp);
52 boolean_t fn_isgz(struct fn *fnp);
53 
54 /* functions that deal with lists of strings */
55 struct fn_list *fn_list_new(const char * const *slist);
56 struct fn_list *fn_list_dup(struct fn_list *fnlp);
57 void fn_list_free(struct fn_list *fnlp);
58 void fn_list_adds(struct fn_list *fnlp, const char *s);
59 void fn_list_addfn(struct fn_list *fnlp, struct fn *fnp);
60 void fn_list_rewind(struct fn_list *fnlp);
61 struct fn *fn_list_next(struct fn_list *fnlp);
62 void fn_list_addfn_list(struct fn_list *fnlp, struct fn_list *fnlp2);
63 void fn_list_appendrange(struct fn_list *fnlp,
64     const char *s, const char *limit);
65 void fn_list_print(struct fn_list *fnlp, FILE *stream);
66 off_t fn_list_totalsize(struct fn_list *fnlp);
67 struct fn *fn_list_popoldest(struct fn_list *fnlp);
68 boolean_t fn_list_empty(struct fn_list *fnlp);
69 int fn_list_count(struct fn_list *fnlp);
70 
71 #ifdef	__cplusplus
72 }
73 #endif
74 
75 #endif	/* _LOGADM_FN_H */
76