File: | src/hest/usage.c |
Location: | line 114, column 7 |
Description: | Value stored to 'newed' is never read |
1 | /* |
2 | Teem: Tools to process and visualize scientific data and images . |
3 | Copyright (C) 2013, 2012, 2011, 2010, 2009 University of Chicago |
4 | Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann |
5 | Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah |
6 | |
7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Lesser General Public License |
9 | (LGPL) as published by the Free Software Foundation; either |
10 | version 2.1 of the License, or (at your option) any later version. |
11 | The terms of redistributing and/or modifying this software also |
12 | include exceptions to the LGPL that facilitate static linking. |
13 | |
14 | This library is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | Lesser General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Lesser General Public License |
20 | along with this library; if not, write to Free Software Foundation, Inc., |
21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | */ |
23 | |
24 | #include "hest.h" |
25 | #include "privateHest.h" |
26 | |
27 | /* |
28 | ** don't ask |
29 | */ |
30 | void |
31 | _hestSetBuff(char *B, const hestOpt *O, const hestParm *P, |
32 | int showshort, int showlong) { |
33 | char copy[AIR_STRLEN_HUGE(1024+1)], *sep; |
34 | int max; unsigned int len; |
35 | |
36 | max = _hestMax(O->max); |
37 | if (O->flag) { |
38 | strcpy(copy, O->flag)__builtin___strcpy_chk (copy, O->flag, __builtin_object_size (copy, 2 > 1 ? 1 : 0)); |
39 | if ((sep = strchr(copy, P->multiFlagSep))) { |
40 | *sep = 0; |
41 | if (showshort) { |
42 | strcat(B, "-")__builtin___strcat_chk (B, "-", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
43 | strcat(B, copy)__builtin___strcat_chk (B, copy, __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
44 | } |
45 | if (showlong) { |
46 | if (showshort) { |
47 | len = AIR_UINT(strlen(B))((unsigned int)(strlen(B))); |
48 | B[len] = P->multiFlagSep; |
49 | B[len+1] = '\0'; |
50 | } |
51 | strcat(B, "--")__builtin___strcat_chk (B, "--", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
52 | strcat(B, sep+1)__builtin___strcat_chk (B, sep+1, __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
53 | } |
54 | } else { |
55 | strcat(B, "-")__builtin___strcat_chk (B, "-", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
56 | strcat(B, O->flag)__builtin___strcat_chk (B, O->flag, __builtin_object_size ( B, 2 > 1 ? 1 : 0)); |
57 | } |
58 | if (O->min || max) { |
59 | strcat(B, "\t")__builtin___strcat_chk (B, "\t", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
60 | } |
61 | } |
62 | if (!O->min && max) { |
63 | strcat(B, "[")__builtin___strcat_chk (B, "[", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
64 | } |
65 | if (O->min || max) { |
66 | strcat(B, "<")__builtin___strcat_chk (B, "<", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
67 | strcat(B, O->name)__builtin___strcat_chk (B, O->name, __builtin_object_size ( B, 2 > 1 ? 1 : 0)); |
68 | if ((int)(O->min) < max && max > 1) { /* HEY scrutinize casts */ |
69 | strcat(B, "\t...")__builtin___strcat_chk (B, "\t...", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
70 | } |
71 | strcat(B, ">")__builtin___strcat_chk (B, ">", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
72 | } |
73 | if (!O->min && max) { |
74 | strcat(B, "]")__builtin___strcat_chk (B, "]", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
75 | } |
76 | } |
77 | |
78 | /* early version of _hestSetBuff() function */ |
79 | #define SETBUFF(B, O)__builtin___strcat_chk (B, O.flag ? "-" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, O.flag ? O .flag : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, O.flag && (O.min || _hestMax(O.max)) ? "\t" : "" , __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, !O.min && _hestMax(O.max) ? "[" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, O.min || _hestMax (O.max) ? "<" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, O.min || _hestMax(O.max) ? O.name : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, (O.min < _hestMax(O.max) && (_hestMax(O.max) > 1)) ? " ...": "", __builtin_object_size (B, 2 > 1 ? 1 : 0 )), __builtin___strcat_chk (B, O.min || _hestMax(O.max) ? ">" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), __builtin___strcat_chk (B, !O.min && _hestMax(O.max) ? "]" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)); \ |
80 | strcat(B, O.flag ? "-" : "")__builtin___strcat_chk (B, O.flag ? "-" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
81 | strcat(B, O.flag ? O.flag : "")__builtin___strcat_chk (B, O.flag ? O.flag : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
82 | strcat(B, O.flag && (O.min || _hestMax(O.max)) ? "\t" : "")__builtin___strcat_chk (B, O.flag && (O.min || _hestMax (O.max)) ? "\t" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
83 | strcat(B, !O.min && _hestMax(O.max) ? "[" : "")__builtin___strcat_chk (B, !O.min && _hestMax(O.max) ? "[" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
84 | strcat(B, O.min || _hestMax(O.max) ? "<" : "")__builtin___strcat_chk (B, O.min || _hestMax(O.max) ? "<" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
85 | strcat(B, O.min || _hestMax(O.max) ? O.name : "")__builtin___strcat_chk (B, O.min || _hestMax(O.max) ? O.name : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
86 | strcat(B, (O.min < _hestMax(O.max) && (_hestMax(O.max) > 1)) ? " ...": "")__builtin___strcat_chk (B, (O.min < _hestMax(O.max) && (_hestMax(O.max) > 1)) ? " ...": "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
87 | strcat(B, O.min || _hestMax(O.max) ? ">" : "")__builtin___strcat_chk (B, O.min || _hestMax(O.max) ? ">" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)), \ |
88 | strcat(B, !O.min && _hestMax(O.max) ? "]" : "")__builtin___strcat_chk (B, !O.min && _hestMax(O.max) ? "]" : "", __builtin_object_size (B, 2 > 1 ? 1 : 0)); |
89 | |
90 | /* |
91 | ** _hestPrintStr() |
92 | ** |
93 | ** not a useful function. Do not use. |
94 | */ |
95 | void |
96 | _hestPrintStr(FILE *f, unsigned int indent, unsigned int already, |
97 | unsigned int width, const char *_str, int bslash) { |
98 | char *str, *ws, *last; |
99 | int newed=AIR_FALSE0; unsigned int wrd, nwrd, ii, pos; |
100 | |
101 | str = airStrdup(_str); |
102 | nwrd = airStrntok(str, " "); |
103 | pos = already; |
104 | for (wrd=0; wrd<nwrd; wrd++) { |
105 | /* we used airStrtok() to delimit words on spaces ... */ |
106 | ws = airStrtok(!wrd ? str : NULL((void*)0), " ", &last); |
107 | /* ... but then convert tabs to spaces */ |
108 | airStrtrans(ws, '\t', ' '); |
109 | if (pos + 1 + AIR_UINT(strlen(ws))((unsigned int)(strlen(ws))) <= width - !!bslash) { |
110 | /* if this word would still fit on the current line */ |
111 | if (wrd && !newed) fprintf(f, " "); |
112 | fprintf(f, "%s", ws); |
113 | pos += 1 + AIR_UINT(strlen(ws))((unsigned int)(strlen(ws))); |
114 | newed = AIR_FALSE0; |
Value stored to 'newed' is never read | |
115 | } else { |
116 | /* else we start a new line and print the indent */ |
117 | if (bslash) { |
118 | fprintf(f, " \\"); |
119 | } |
120 | fprintf(f, "\n"); |
121 | for (ii=0; ii<indent; ii++) { |
122 | fprintf(f, " "); |
123 | } |
124 | fprintf(f, "%s", ws); |
125 | pos = indent + AIR_UINT(strlen(ws))((unsigned int)(strlen(ws))); |
126 | } |
127 | /* if the last character of the word was a newline, then indent */ |
128 | if ('\n' == ws[strlen(ws)-1]) { |
129 | for (ii=0; ii<indent; ii++) { |
130 | fprintf(f, " "); |
131 | } |
132 | pos = indent; |
133 | newed = AIR_TRUE1; |
134 | } else { |
135 | newed = AIR_FALSE0; |
136 | } |
137 | } |
138 | fprintf(f, "\n"); |
139 | free(str); |
140 | } |
141 | |
142 | /* |
143 | ******** hestMinNumArgs |
144 | ** |
145 | ** The idea is that this helps quickly determine if the options given |
146 | ** on the command line are insufficient, in order to produce general |
147 | ** usage information instead of some specific parse error. |
148 | ** |
149 | ** Because hest is strictly agnostic with respect to how many command-line |
150 | ** arguments actually constitute the command itself ("rmdir": one argument, |
151 | ** "cvs checkout": two arguments), it only concerns itself with the |
152 | ** command-line arguments following the command. |
153 | ** |
154 | ** Thus, hestMinMinArgs() returns the minimum number of command-line |
155 | ** arguments (following the command) that could be valid. If your |
156 | ** command is only one argument (like "rmdir"), then you might use |
157 | ** the true argc passed by the OS to main() as such: |
158 | ** |
159 | ** if (argc-1 < hestMinNumArgs(opt)) { |
160 | ** ... usage ... |
161 | ** } |
162 | ** |
163 | ** But if your command is two arguments (like "cvs checkout"): |
164 | ** |
165 | ** if (argc-2 < hestMinNumArgs(opt)) { |
166 | ** ... usage ... |
167 | ** } |
168 | ** |
169 | ** HOWEVER! don't forget the response files can complicate all this: |
170 | ** in one argument a response file can provide information for any |
171 | ** number of arguments, and the argc itself is kind of meaningless. |
172 | ** The code examples above only really apply when |
173 | ** hparm->respFileEnable is false. For example, in unrrdu (private.h) |
174 | ** we find: |
175 | ** |
176 | ** if ( (hparm->respFileEnable && !argc) || |
177 | ** (!hparm->respFileEnable && argc < hestMinNumArgs(opt)) ) { |
178 | ** ... usage ... |
179 | ** } |
180 | ** |
181 | */ |
182 | int |
183 | hestMinNumArgs(hestOpt *opt) { |
184 | hestParm *parm; |
185 | int i, count, numOpts; |
186 | |
187 | parm = hestParmNew(); |
188 | if (_hestPanic(opt, NULL((void*)0), parm)) { |
189 | hestParmFree(parm); |
190 | return _hestMax(-1); |
191 | } |
192 | count = 0; |
193 | numOpts = _hestNumOpts(opt); |
194 | for (i=0; i<numOpts; i++) { |
195 | if (!opt[i].dflt) { |
196 | count += opt[i].min; |
197 | if (!(0 == opt[i].min && 0 == opt[i].max)) { |
198 | count += !!opt[i].flag; |
199 | } |
200 | } |
201 | } |
202 | hestParmFree(parm); |
203 | return count; |
204 | } |
205 | |
206 | void |
207 | hestInfo(FILE *file, const char *argv0, const char *info, |
208 | const hestParm *_parm) { |
209 | hestParm *parm; |
210 | |
211 | parm = _parm ? NULL((void*)0) : hestParmNew(); |
212 | /* how to const-correctly use parm or _parm in an expression */ |
213 | #define PARM (_parm ? _parm : parm) |
214 | |
215 | if (info) { |
216 | if (argv0) { |
217 | fprintf(file, "\n%s: ", argv0); |
218 | _hestPrintStr(file, 0, AIR_UINT(strlen(argv0))((unsigned int)(strlen(argv0))) + 2, |
219 | PARM->columns, info, AIR_FALSE0); |
220 | } else { |
221 | fprintf(file, "ERROR: hestInfo got NULL argv0\n"); |
222 | } |
223 | } |
224 | if (parm) { |
225 | hestParmFree(parm); |
226 | } |
227 | } |
228 | |
229 | void |
230 | hestUsage(FILE *f, hestOpt *opt, const char *argv0, |
231 | const hestParm *_parm) { |
232 | int i, numOpts; |
233 | char buff[2*AIR_STRLEN_HUGE(1024+1)], tmpS[AIR_STRLEN_HUGE(1024+1)]; |
234 | hestParm *parm; |
235 | |
236 | parm = _parm ? NULL((void*)0) : hestParmNew(); |
237 | |
238 | if (_hestPanic(opt, NULL((void*)0), PARM)) { |
239 | /* we can't continue; the opt array is botched */ |
240 | if (parm) { |
241 | hestParmFree(parm); |
242 | } |
243 | return; |
244 | } |
245 | |
246 | numOpts = _hestNumOpts(opt); |
247 | fprintf(f, "\n"); |
248 | strcpy(buff, "Usage: ")__builtin___strcpy_chk (buff, "Usage: ", __builtin_object_size (buff, 2 > 1 ? 1 : 0)); |
249 | strcat(buff, argv0 ? argv0 : "")__builtin___strcat_chk (buff, argv0 ? argv0 : "", __builtin_object_size (buff, 2 > 1 ? 1 : 0)); |
250 | if (PARM->respFileEnable) { |
251 | sprintf(tmpS, " [%cfile\t...]", PARM->respFileFlag)__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), " [%cfile\t...]", PARM->respFileFlag); |
252 | strcat(buff, tmpS)__builtin___strcat_chk (buff, tmpS, __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
253 | } |
254 | for (i=0; i<numOpts; i++) { |
255 | strcat(buff, " ")__builtin___strcat_chk (buff, " ", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
256 | if (1 == opt[i].kind || (opt[i].flag && opt[i].dflt)) |
257 | strcat(buff, "[")__builtin___strcat_chk (buff, "[", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
258 | _hestSetBuff(buff, opt + i, PARM, AIR_TRUE1, AIR_TRUE1); |
259 | if (1 == opt[i].kind || (opt[i].flag && opt[i].dflt)) |
260 | strcat(buff, "]")__builtin___strcat_chk (buff, "]", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
261 | } |
262 | |
263 | _hestPrintStr(f, AIR_UINT(strlen("Usage: "))((unsigned int)(strlen("Usage: "))), 0, |
264 | PARM->columns, buff, AIR_TRUE1); |
265 | if (parm) { |
266 | hestParmFree(parm); |
267 | } |
268 | return; |
269 | } |
270 | |
271 | void |
272 | hestGlossary(FILE *f, hestOpt *opt, const hestParm *_parm) { |
273 | int i, j, maxlen, numOpts; unsigned int len; |
274 | char buff[2*AIR_STRLEN_HUGE(1024+1)], tmpS[AIR_STRLEN_HUGE(1024+1)]; |
275 | hestParm *parm; |
276 | |
277 | parm = _parm ? NULL((void*)0) : hestParmNew(); |
278 | |
279 | if (_hestPanic(opt, NULL((void*)0), PARM)) { |
280 | /* we can't continue; the opt array is botched */ |
281 | if (parm) { |
282 | hestParmFree(parm); |
283 | } |
284 | return; |
285 | } |
286 | |
287 | numOpts = _hestNumOpts(opt); |
288 | |
289 | maxlen = 0; |
290 | if (numOpts) { |
291 | fprintf(f, "\n"); |
292 | } |
293 | for (i=0; i<numOpts; i++) { |
294 | strcpy(buff, "")__builtin___strcpy_chk (buff, "", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
295 | _hestSetBuff(buff, opt + i, PARM, AIR_TRUE1, AIR_FALSE0); |
296 | maxlen = AIR_MAX((int)strlen(buff), maxlen)(((int)strlen(buff)) > (maxlen) ? ((int)strlen(buff)) : (maxlen )); |
297 | } |
298 | if (PARM->respFileEnable) { |
299 | sprintf(buff, "%cfile ...", PARM->respFileFlag)__builtin___sprintf_chk (buff, 0, __builtin_object_size (buff , 2 > 1 ? 1 : 0), "%cfile ...", PARM->respFileFlag); |
300 | len = AIR_UINT(strlen(buff))((unsigned int)(strlen(buff))); |
301 | for (j=len; j<maxlen; j++) { |
302 | fprintf(f, " "); |
303 | } |
304 | fprintf(f, "%s = ", buff); |
305 | strcpy(buff, "response file(s) containing command-line arguments")__builtin___strcpy_chk (buff, "response file(s) containing command-line arguments" , __builtin_object_size (buff, 2 > 1 ? 1 : 0)); |
306 | _hestPrintStr(f, maxlen + 3, maxlen + 3, PARM->columns, buff, AIR_FALSE0); |
307 | } |
308 | for (i=0; i<numOpts; i++) { |
309 | strcpy(buff, "")__builtin___strcpy_chk (buff, "", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
310 | _hestSetBuff(buff, opt + i, PARM, AIR_TRUE1, AIR_FALSE0); |
311 | airOneLinify(buff); |
312 | len = AIR_UINT(strlen(buff))((unsigned int)(strlen(buff))); |
313 | for (j=len; j<maxlen; j++) { |
314 | fprintf(f, " "); |
315 | } |
316 | fprintf(f, "%s", buff); |
317 | strcpy(buff, "")__builtin___strcpy_chk (buff, "", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
318 | #if 1 |
319 | if (opt[i].flag && strchr(opt[i].flag, PARM->multiFlagSep)) { |
320 | /* there is a long-form flag as well as short */ |
321 | _hestSetBuff(buff, opt + i, PARM, AIR_FALSE0, AIR_TRUE1); |
322 | strcat(buff, " = ")__builtin___strcat_chk (buff, " = ", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
323 | fprintf(f, " , "); |
324 | } else { |
325 | /* there is only a short-form flag */ |
326 | fprintf(f, " = "); |
327 | } |
328 | #else |
329 | fprintf(f, " = "); |
330 | #endif |
331 | if (opt[i].info) { |
332 | strcat(buff, opt[i].info)__builtin___strcat_chk (buff, opt[i].info, __builtin_object_size (buff, 2 > 1 ? 1 : 0)); |
333 | } |
334 | if ((opt[i].min || _hestMax(opt[i].max)) |
335 | && (!( 2 == opt[i].kind |
336 | && airTypeEnum == opt[i].type |
337 | && PARM->elideSingleEnumType )) |
338 | && (!( 2 == opt[i].kind |
339 | && airTypeOther == opt[i].type |
340 | && PARM->elideSingleOtherType )) |
341 | ) { |
342 | /* if there are newlines in the info, then we want to clarify the |
343 | type by printing it on its own line */ |
344 | if (opt[i].info && strchr(opt[i].info, '\n')) { |
345 | strcat(buff, "\n ")__builtin___strcat_chk (buff, "\n ", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
346 | } |
347 | else { |
348 | strcat(buff, " ")__builtin___strcat_chk (buff, " ", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
349 | } |
350 | strcat(buff, "(")__builtin___strcat_chk (buff, "(", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
351 | if (opt[i].min == 0 && _hestMax(opt[i].max) == 1) { |
352 | strcat(buff, "optional\t")__builtin___strcat_chk (buff, "optional\t", __builtin_object_size (buff, 2 > 1 ? 1 : 0)); |
353 | } |
354 | else { |
355 | if ((int)opt[i].min == _hestMax(opt[i].max) && _hestMax(opt[i].max) > 1) { /* HEY scrutinize casts */ |
356 | sprintf(tmpS, "%d\t", _hestMax(opt[i].max))__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%d\t", _hestMax(opt[i].max)); |
357 | strcat(buff, tmpS)__builtin___strcat_chk (buff, tmpS, __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
358 | } |
359 | else if ((int)opt[i].min < _hestMax(opt[i].max)) { /* HEY scrutinize casts */ |
360 | if (-1 == opt[i].max) { |
361 | sprintf(tmpS, "%d\tor\tmore\t", opt[i].min)__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%d\tor\tmore\t", opt[i].min); |
362 | } |
363 | else { |
364 | sprintf(tmpS, "%d..%d\t", opt[i].min, _hestMax(opt[i].max))__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%d..%d\t", opt[i].min, _hestMax(opt[i]. max)); |
365 | } |
366 | strcat(buff, tmpS)__builtin___strcat_chk (buff, tmpS, __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
367 | } |
368 | } |
369 | sprintf(tmpS, "%s%s",__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
370 | (airTypeEnum == opt[i].type__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
371 | ? opt[i].enm->name__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
372 | : (airTypeOther == opt[i].type__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
373 | ? opt[i].CB->type__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
374 | : airTypeStr[opt[i].type])),__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
375 | (_hestMax(opt[i].max) > 1__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
376 | ? (airTypeOther == opt[i].type__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
377 | && 'y' == opt[i].CB->type[airStrlen(opt[i].CB->type)-1]__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
378 | && PARM->cleverPluralizeOtherY__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
379 | ? "\bies"__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
380 | : "s")__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")) |
381 | : ""))__builtin___sprintf_chk (tmpS, 0, __builtin_object_size (tmpS , 2 > 1 ? 1 : 0), "%s%s", (airTypeEnum == opt[i].type ? opt [i].enm->name : (airTypeOther == opt[i].type ? opt[i].CB-> type : airTypeStr[opt[i].type])), (_hestMax(opt[i].max) > 1 ? (airTypeOther == opt[i].type && 'y' == opt[i].CB-> type[airStrlen(opt[i].CB->type)-1] && PARM->cleverPluralizeOtherY ? "\bies" : "s") : "")); |
382 | strcat(buff, tmpS)__builtin___strcat_chk (buff, tmpS, __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
383 | strcat(buff, ")")__builtin___strcat_chk (buff, ")", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
384 | } |
385 | /* |
386 | fprintf(stderr, "!%s: PARM->elideSingleOtherDefault = %d\n", |
387 | "hestGlossary", PARM->elideSingleOtherDefault); |
388 | */ |
389 | if (opt[i].dflt |
390 | && (opt[i].min || _hestMax(opt[i].max)) |
391 | && (!( 2 == opt[i].kind |
392 | && (airTypeFloat == opt[i].type || airTypeDouble == opt[i].type) |
393 | && !AIR_EXISTS(airAtod(opt[i].dflt))(((int)(!((airAtod(opt[i].dflt)) - (airAtod(opt[i].dflt)))))) |
394 | && PARM->elideSingleNonExistFloatDefault )) |
395 | && (!( (3 == opt[i].kind || 5 == opt[i].kind) |
396 | && (airTypeFloat == opt[i].type || airTypeDouble == opt[i].type) |
397 | && !AIR_EXISTS(airAtod(opt[i].dflt))(((int)(!((airAtod(opt[i].dflt)) - (airAtod(opt[i].dflt)))))) |
398 | && PARM->elideMultipleNonExistFloatDefault )) |
399 | && (!( 2 == opt[i].kind |
400 | && airTypeOther == opt[i].type |
401 | && PARM->elideSingleOtherDefault )) |
402 | && (!( 2 == opt[i].kind |
403 | && airTypeString == opt[i].type |
404 | && PARM->elideSingleEmptyStringDefault |
405 | && 0 == airStrlen(opt[i].dflt) )) |
406 | && (!( (3 == opt[i].kind || 5 == opt[i].kind) |
407 | && airTypeString == opt[i].type |
408 | && PARM->elideMultipleEmptyStringDefault |
409 | && 0 == airStrlen(opt[i].dflt) )) |
410 | ) { |
411 | /* if there are newlines in the info, then we want to clarify the |
412 | default by printing it on its own line */ |
413 | if (opt[i].info && strchr(opt[i].info, '\n')) { |
414 | strcat(buff, "\n ")__builtin___strcat_chk (buff, "\n ", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
415 | } |
416 | else { |
417 | strcat(buff, "; ")__builtin___strcat_chk (buff, "; ", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
418 | } |
419 | strcat(buff, "default:\t")__builtin___strcat_chk (buff, "default:\t", __builtin_object_size (buff, 2 > 1 ? 1 : 0)); |
420 | strcpy(tmpS, opt[i].dflt)__builtin___strcpy_chk (tmpS, opt[i].dflt, __builtin_object_size (tmpS, 2 > 1 ? 1 : 0)); |
421 | airStrtrans(tmpS, ' ', '\t'); |
422 | strcat(buff, "\"")__builtin___strcat_chk (buff, "\"", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
423 | strcat(buff, tmpS)__builtin___strcat_chk (buff, tmpS, __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
424 | strcat(buff, "\"")__builtin___strcat_chk (buff, "\"", __builtin_object_size (buff , 2 > 1 ? 1 : 0)); |
425 | } |
426 | _hestPrintStr(f, maxlen + 3, maxlen + 3, PARM->columns, buff, AIR_FALSE0); |
427 | } |
428 | if (parm) { |
429 | hestParmFree(parm); |
430 | } |
431 | |
432 | return; |
433 | } |
434 | |
435 | #undef PARM |
436 |