comparison th_args.c @ 141:3d555015ada4

Rename a variable.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Oct 2014 06:36:15 +0300
parents 4ca0af6dbcf8
children 0a4fd9cfb929
comparison
equal deleted inserted replaced
140:f81c6dc7bd0f 141:3d555015ada4
145 optarg_t optList[], int optListN, 145 optarg_t optList[], int optListN,
146 BOOL (*handleOpt)(int, char *, char *), BOOL process) 146 BOOL (*handleOpt)(int, char *, char *), BOOL process)
147 { 147 {
148 char *tmpArg = currArg, *optArg; 148 char *tmpArg = currArg, *optArg;
149 int optN; 149 int optN;
150 BOOL isFound; 150 BOOL found;
151 151
152 // Short options can be combined: -a -b -c == -abc 152 // Short options can be combined: -a -b -c == -abc
153 while (*tmpArg) 153 while (*tmpArg)
154 { 154 {
155 for (optN = 0, isFound = FALSE; (optN < optListN) && !isFound; optN++) 155 for (optN = 0, found = FALSE; optN < optListN && !found; optN++)
156 if (*tmpArg == optList[optN].optShort) 156 if (*tmpArg == optList[optN].optShort)
157 { 157 {
158 // Get possible option argument, if needed 158 // Get possible option argument, if needed
159 if ((optList[optN].flags & OPT_ARGMASK) != 0 159 if ((optList[optN].flags & OPT_ARGMASK) != 0 &&
160 && (++(*newArgIndex) < argc)) 160 (++(*newArgIndex) < argc))
161 optArg = argv[*newArgIndex]; 161 optArg = argv[*newArgIndex];
162 else 162 else
163 optArg = NULL; 163 optArg = NULL;
164 164
165 // Check if option argument is required 165 // Check if option argument is required
175 175
176 if (!handleOpt(optList[optN].id, optArg, tmpStr)) 176 if (!handleOpt(optList[optN].id, optArg, tmpStr))
177 return FALSE; 177 return FALSE;
178 } 178 }
179 179
180 isFound = TRUE; 180 found = TRUE;
181 } 181 }
182 182
183 if (!isFound) 183 if (!found)
184 { 184 {
185 THERR("Unknown short option '%c' in argument '-%s'\n", 185 THERR("Unknown short option '%c' in argument '-%s'\n",
186 *tmpArg, currArg); 186 *tmpArg, currArg);
187 return FALSE; 187 return FALSE;
188 } 188 }