OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 * - opt->option will hold the single-character option name that was parsed, | 115 * - opt->option will hold the single-character option name that was parsed, |
116 * or zero. | 116 * or zero. |
117 * When opt->option is zero, the token parsed was either a "long" (keyword) | 117 * When opt->option is zero, the token parsed was either a "long" (keyword) |
118 * option or a positional parameter. | 118 * option or a positional parameter. |
119 * For a positional parameter, | 119 * For a positional parameter, |
120 * - opt->longOptIndex will contain -1, and | 120 * - opt->longOptIndex will contain -1, and |
121 * - opt->value will point to the positional parameter string. | 121 * - opt->value will point to the positional parameter string. |
122 * For a long option name, | 122 * For a long option name, |
123 * - opt->longOptIndex will contain the non-negative index of the | 123 * - opt->longOptIndex will contain the non-negative index of the |
124 * PLLongOpt structure in the caller's array of PLLongOpt structures | 124 * PLLongOpt structure in the caller's array of PLLongOpt structures |
125 8 corresponding to the long option name, and | 125 * corresponding to the long option name, and |
126 * For a single-character or long option, | 126 * For a single-character or long option, |
127 * - opt->longOption will contain the value of the single-character option | 127 * - opt->longOption will contain the value of the single-character option |
128 * name, or the value of the longOption from the PLLongOpt structure | 128 * name, or the value of the longOption from the PLLongOpt structure |
129 * for that long option. See notes below. | 129 * for that long option. See notes below. |
130 * - opt->value will point to the argument option string, or will | 130 * - opt->value will point to the argument option string, or will |
131 * be NULL if no argument option string was given. | 131 * be NULL if option does not require argument. If option requires |
| 132 * argument but it is not provided, PL_OPT_BAD is returned. |
132 * When opt->option is non-zero, | 133 * When opt->option is non-zero, |
133 * - opt->longOptIndex will be -1 | 134 * - opt->longOptIndex will be -1 |
134 * When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of | 135 * When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of |
135 * opt are undefined. | 136 * opt are undefined. |
136 * | 137 * |
137 * Notes: It is possible to ignore opt->option, and always look at | 138 * Notes: It is possible to ignore opt->option, and always look at |
138 * opt->longOption instead. opt->longOption will contain the same value | 139 * opt->longOption instead. opt->longOption will contain the same value |
139 * as opt->option for single-character option names, and will contain the | 140 * as opt->option for single-character option names, and will contain the |
140 * value of longOption from the PLLongOpt structure for long option names. | 141 * value of longOption from the PLLongOpt structure for long option names. |
141 * This means that it is possible to equivalence long option names to | 142 * This means that it is possible to equivalence long option names to |
142 * single character names by giving the longOption in the PLLongOpt struct | 143 * single character names by giving the longOption in the PLLongOpt struct |
143 * the same value as the single-character option name. | 144 * the same value as the single-character option name. |
144 * For long options that are NOT intended to be equivalent to any single- | 145 * For long options that are NOT intended to be equivalent to any single- |
145 * character option, the longOption value should be chosen to not match | 146 * character option, the longOption value should be chosen to not match |
146 * any possible single character name. It might be advisable to choose | 147 * any possible single character name. It might be advisable to choose |
147 * longOption values greater than 0xff for such long options. | 148 * longOption values greater than 0xff for such long options. |
148 */ | 149 */ |
149 PR_EXTERN(PLOptStatus) PL_GetNextOpt(PLOptState *opt); | 150 PR_EXTERN(PLOptStatus) PL_GetNextOpt(PLOptState *opt); |
150 | 151 |
151 PR_END_EXTERN_C | 152 PR_END_EXTERN_C |
152 | 153 |
153 #endif /* defined(PLGETOPT_H_) */ | 154 #endif /* defined(PLGETOPT_H_) */ |
154 | 155 |
155 /* plgetopt.h */ | 156 /* plgetopt.h */ |
156 | 157 |
OLD | NEW |