7712 mandoc -Tlint does always exit with error code 0
[unleashed.git] / usr / src / cmd / lvm / metassist / controller / getopt_ext.h
blob6b36477ce041d5116fefaab7a787f48649ca7ee2
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _GETOPTEXT_H
28 #define _GETOPTEXT_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
37 * Returned chars for getopt_ext
40 /* A non-option argument was found */
41 #define GETOPT_NON_OPTION_ARG 1
43 /* All arguments have been parsed */
44 #define GETOPT_DONE_PARSING -1
46 /* An invalid option was found */
47 #define GETOPT_ERR_INVALID_OPT -2
49 /* An invalid non-option argument was found */
50 #define GETOPT_ERR_INVALID_ARG -3
52 /* No argument for valid option expecting an argument */
53 #define GETOPT_ERR_MISSING_ARG -4
56 * Function prototypes
60 * Identical to getopt(3), except that
62 * 1. If "-" is the first character of optstring, each non-option argv
63 * element is handled as if it were the argument of an option with
64 * character code GETOPT_NON_OPTION_ARG. The result is that
65 * GETOPT_DONE_PARSING will not be returned until the end of the
66 * argument list has been reached.
68 * This mirrors the functionality provided by GNU getopt.
70 * 2. GETOPT_ERR_INVALID_OPT or GETOPT_ERR_MISSING_ARG is returned
71 * instead of '?'. Subsequently "-?" can be used as a valid
72 * option.
74 * 3. GETOPT_DONE_PARSING, GETOPT_ERR_INVALID_ARG, or
75 * GETOPT_NON_OPTION_ARG is returned instead of -1.
77 * @param argc
78 * The number of arguments in the array
80 * @param argv
81 * The argument array
83 * @param optstring
84 * The option letters, with ':' following options with
85 * required arguments. See note about "-" as the first
86 * character.
88 * @return GETOPT_ERR_INVALID_OPT
89 * if the option is not found in optstring
91 * GETOPT_ERR_MISSING_ARG
92 * if the option requires an argument which is missing
94 * GETOPT_ERR_INVALID_ARG
95 * if "-" is not the first character in optstring and a
96 * non-option argument is encountered
98 * GETOPT_NON_OPTION_ARG
99 * if "-" is the first character in optstring and a
100 * non-option argument is encountered
102 * GETOPT_DONE_PARSING
103 * if the end of the argument list is reached
105 * <optopt>
106 * the option character itself, if none of the above
107 * scenarios applies.
109 extern int getopt_ext(int argc, char * const argv[], const char *optstring);
111 #ifdef __cplusplus
113 #endif
115 #endif /* _GETOPTEXT_H */