xref: /titanic_51/usr/src/cmd/tnf/prex/spec.h (revision 4a6ec905b96eb96a398c346f59e034a90ce8ad37)
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 /*
23  * Copyright (c) 1994, by Sun Microsytems, Inc.
24  */
25 
26 #ifndef _SPEC_H
27 #define	_SPEC_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Includes
33  */
34 
35 #include <stdio.h>
36 #include <libgen.h>
37 #include <sys/types.h>
38 
39 #include "queue.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * Typedefs
47  */
48 
49 typedef enum spec_type {
50 	SPEC_EXACT,
51 	SPEC_REGEXP
52 
53 
54 }			   spec_type_t;
55 
56 
57 typedef struct spec {
58 	queue_node_t	qn;
59 	char		   *str;
60 	spec_type_t	 type;
61 	char		   *regexp_p;
62 
63 }			   spec_t;
64 
65 typedef void
66 (*spec_attr_fun_t) (spec_t * spec, char *attr, char *value, void *calldatap);
67 typedef void
68 (*spec_val_fun_t) (spec_t * spec, char *value, void *calldatap);
69 
70 
71 /*
72  * Globals
73  */
74 
75 
76 /*
77  * Declarations
78  */
79 
80 spec_t * spec(char *str_p, spec_type_t type);
81 void spec_destroy(spec_t * list_p);
82 void spec_print(FILE * stream, spec_t * list_p);
83 spec_t * spec_list(spec_t * list_p, spec_t * item_p);
84 void spec_attrtrav(spec_t * spec_p, char *attrs,
85 	spec_attr_fun_t fun, void *calldata_p);
86 void spec_valtrav(spec_t * spec_p, char *valstr,
87 	spec_val_fun_t fun, void *calldata_p);
88 spec_t *spec_dup(spec_t * spec_p);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* _SPEC_H */
95