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.
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.
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]
22 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
24 * logadm/opts.h -- public definitions for opts module
27 #ifndef _LOGADM_OPTS_H
28 #define _LOGADM_OPTS_H
34 /* various types of options we allow */
36 OPTTYPE_BOOLEAN
, /* simple boolean flag */
37 OPTTYPE_INT
, /* simple number */
38 OPTTYPE_STRING
/* string (like a pathname) */
43 /* info that drives option parsing (table of these is passed to opts_init()) */
45 char *oi_o
; /* the option */
46 enum opttype oi_t
; /* the type of this option */
47 /* parser, if set, is called to parse optarg */
48 off_t (*oi_parser
)(const char *o
, const char *optarg
);
52 /* flags for struct optinfo */
56 void opts_init(struct optinfo
*table
, int numentries
);
57 struct opts
*opts_parse(struct opts
*, char **args
, int flags
);
58 void opts_free(struct opts
*opts
);
59 void opts_set(struct opts
*opts
, const char *o
, const char *optarg
);
60 int opts_count(struct opts
*opts
, const char *options
);
61 const char *opts_optarg(struct opts
*opts
, const char *o
);
62 off_t
opts_optarg_int(struct opts
*opts
, const char *o
);
63 struct fn_list
*opts_cmdargs(struct opts
*opts
);
64 struct opts
*opts_merge(struct opts
*back
, struct opts
*front
);
67 #define OPTP_NEVER (-2)
69 void opts_print(struct opts
*opts
, FILE *stream
, char *exclude
);
70 void opts_printword(const char *word
, FILE *stream
);
72 extern struct optinfo Opttable
[];
73 extern int Opttable_cnt
;
79 #endif /* _LOGADM_OPTS_H */