MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cgiDoSearch

Function cgiDoSearch

cgi-bin/search.c:318–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316 */
317
318int /* O - Number of matches */
319cgiDoSearch(void *search, /* I - Search context */
320 const char *text) /* I - Text to search */
321{
322 int i; /* Looping var */
323 regmatch_t matches[100]; /* RE matches */
324
325
326 /*
327 * Range check...
328 */
329
330 if (!search || !text)
331 return (0);
332
333 /*
334 * Do a lookup...
335 */
336
337 if (!regexec((regex_t *)search, text, sizeof(matches) / sizeof(matches[0]),
338 matches, 0))
339 {
340 /*
341 * Figure out the number of matches in the string...
342 */
343
344 for (i = 0; i < (int)(sizeof(matches) / sizeof(matches[0])); i ++)
345 if (matches[i].rm_so < 0)
346 break;
347
348 return (i);
349 }
350 else
351 return (0);
352}
353
354
355/*

Callers 2

cgiGetIPPObjectsFunction · 0.85
helpSearchIndexFunction · 0.85

Calls 1

regexecFunction · 0.85

Tested by

no test coverage detected