MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / SzInList

Function SzInList

general.cpp:167–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165// characters. Return offset into string, and optionally the index into list.
166
167CONST char *SzInList(CONST char *sz1, CONST char *sz2, int *pisz)
168{
169 CONST char *szStart = sz1;
170 int isz = 0;
171
172 loop {
173 // Compate string to current string in string list.
174 for (sz1 = szStart; *sz1 && *sz1 == *sz2; sz1++, sz2++)
175 ;
176 if (*sz2 == chNull || (*sz2 == chSep || *sz2 == chSep2)) {
177 if (*sz1 == chNull) {
178 // Match if reached end of string and of current string in list.
179 if (pisz != NULL)
180 *pisz = isz;
181 return sz2 + (*sz2 == chSep || *sz2 == chSep2);
182 }
183 } else {
184 // Skip ahead to start of next string in string list.
185 while (*sz2 && !(*sz2 == chSep || *sz2 == chSep2))
186 sz2++;
187 }
188 if (*sz2 == chSep || *sz2 == chSep2)
189 sz2++;
190 else
191 break; // If no separator, then end of string list reached.
192 isz++;
193 }
194 if (pisz != NULL)
195 *pisz = -1;
196 return NULL;

Callers 3

ChartExoplanetFunction · 0.85
SwissComputeStarFunction · 0.85
SwissComputeAsteroidFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected