rpm  5.4.15
mire.c
Go to the documentation of this file.
1 
4 #include "system.h"
5 
6 #include <rpmiotypes.h>
7 #include <rpmio.h>
8 #include <rpmlog.h>
9 
10 #define _MIRE_INTERNAL
11 #include <mire.h>
12 
13 #include "debug.h"
14 
15 /*@access regex_t @*/
16 
17 /*@unchecked@*/
18 int _mire_debug = 0;
19 
20 /*@unchecked@*/
21 const unsigned char * _mirePCREtables = NULL;
22 
23 /*@unchecked@*/
25 
26 /*@unchecked@*/
28 
29 /*@unchecked@*/
31 
32 /*@unchecked@*/
33 int _mireREGEXoptions = REG_EXTENDED | REG_NEWLINE;
34 
35 /*@unchecked@*/
37 
38 int mireClean(miRE mire)
39 {
40  if (mire == NULL) return 0;
41  mire->pattern = _free(mire->pattern);
42  if (mire->mode == RPMMIRE_REGEX) {
43  if (mire->preg != NULL) {
44  regfree(mire->preg);
45  /*@+voidabstract -usereleased @*/ /* LCL: regfree has bogus only */
46  if (mire->preg) free(mire->preg);
47  mire->preg = NULL;
48  /*@=voidabstract =usereleased @*/
49  }
50  }
51  if (mire->mode == RPMMIRE_PCRE) { /* TODO: (*pcre_free)(_p) override */
52  mire->pcre = _free(mire->pcre);
53  mire->hints = _free(mire->hints);
54  }
55  mire->errmsg = NULL;
56  mire->erroff = 0;
57  mire->errcode = 0;
58  mire->fnflags = 0;
59  mire->cflags = 0;
60  mire->eflags = 0;
61  mire->coptions = 0;
62  mire->eoptions = 0;
63  mire->notmatch = 0;
64 /*@-modfilesys@*/
65 if (_mire_debug)
66 fprintf(stderr, "<-- mireClean(%p)\n", mire);
67 /*@=modfilesys@*/
68  return 0;
69 }
70 
71 static void mireFini(void * _mire)
72  /*@modifies _mire @*/
73 {
74  miRE mire = (miRE) _mire;
75  (void) mireClean(mire);
76 }
77 
78 /*@unchecked@*/ /*@only@*/ /*@null@*/
80 
82 {
83  miRE mire;
84 
85  if (_mirePool == NULL) {
86  _mirePool = rpmioNewPool("mire", sizeof(*mire), -1, _mire_debug,
87  NULL, NULL, mireFini);
88  pool = _mirePool;
89  }
90  mire = (miRE) rpmioGetPool(pool, sizeof(*mire));
91  memset(((char *)mire)+sizeof(mire->_item), 0, sizeof(*mire)-sizeof(mire->_item));
92  return mire;
93 }
94 
95 /*@-onlytrans@*/ /* XXX miRE array, not refcounted. */
96 void * mireFreeAll(miRE mire, int nmire)
97 {
98  if (mire != NULL) {
99  while (--nmire > 0)
100  (void) mireClean(mire + nmire);
101  /* XXX rpmgrep doesn't use mire pools yet. retrofit a fix. */
102  if (mire->_item.use != NULL && mire->_item.pool != NULL)
103  mire = (miRE)rpmioFreePoolItem((rpmioItem)mire, __FUNCTION__, __FILE__, __LINE__);
104  else {
105  if (mire) free(mire);
106  mire = NULL;
107  }
108  }
109  return NULL;
110 }
111 /*@=onlytrans@*/
112 
114 {
115  miRE mire = mireGetPool(_mirePool);
116  mire->mode = mode;
117  mire->tag = tag;
118  return mireLink(mire);
119 }
120 
121 int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options,
122  const unsigned char * table)
123 {
124  int rc = 0;
125  mire->mode = mode;
126  mire->tag = tag;
127  switch (mire->mode) {
128  case RPMMIRE_DEFAULT:
129  break;
130  case RPMMIRE_STRCMP:
131  /* XXX strcasecmp? */
132  break;
133  case RPMMIRE_GLOB:
134  if (options == 0)
135  options = _mireGLOBoptions;
136  mire->fnflags = options;
137  break;
138  case RPMMIRE_REGEX:
139  if (options == 0)
140  options = _mireREGEXoptions;
141  mire->cflags = options;
142  break;
143  case RPMMIRE_PCRE:
144  if (options == 0)
145  options = _mirePCREoptions;
146  /* XXX check default compile options? */
147  mire->coptions = options;
148 /*@-assignexpose -temptrans @*/
149  mire->table = table;
150 /*@=assignexpose =temptrans @*/
151  break;
152  }
153  return rc;
154 }
155 
156 int mireSetEOptions(miRE mire, int * offsets, int noffsets)
157 {
158  int rc = 0;
159  if (mire->mode == RPMMIRE_PCRE) {
160  mire->startoff = 0;
161  mire->eoptions = 0;
162 /*@-assignexpose@*/
163  mire->offsets = offsets;
164 /*@=assignexpose@*/
165  mire->noffsets = noffsets;
166  } else
167  if (mire->mode == RPMMIRE_REGEX) {
168  mire->startoff = 0;
169  mire->eoptions = 0;
170 /*@-assignexpose@*/
171  mire->offsets = offsets;
172 /*@=assignexpose@*/
173  mire->noffsets = noffsets;
174  } else
175  rc = -1;
176 
177  return rc;
178 }
179 
180 int mireSetGOptions(const char * newline, int caseless, int multiline, int utf8)
181 {
182  int rc = 0;
183 
184  if (caseless) {
185 #if defined(PCRE_CASELESS)
186  _mirePCREoptions |= PCRE_CASELESS;
187 #endif
188  _mireREGEXoptions |= REG_ICASE;
189 #if defined(FNM_CASEFOLD)
191 #endif
192  } else {
193 #if defined(PCRE_CASELESS)
194  _mirePCREoptions &= ~PCRE_CASELESS;
195 #endif
196  _mireREGEXoptions &= ~REG_ICASE;
197 #if defined(FNM_CASEFOLD)
199 #endif
200  }
201 
202  if (multiline) {
203 #if defined(PCRE_MULTILINE)
204  _mirePCREoptions |= PCRE_MULTILINE|PCRE_FIRSTLINE;
205 #endif
206  } else {
207 #if defined(PCRE_MULTILINE)
208  _mirePCREoptions &= ~(PCRE_MULTILINE|PCRE_FIRSTLINE);
209 #endif
210  }
211 
212  if (utf8) {
213 #if defined(PCRE_UTF8)
214  _mirePCREoptions |= PCRE_UTF8;
215 #endif
216  } else {
217 #if defined(PCRE_UTF8)
218  _mirePCREoptions &= ~PCRE_UTF8;
219 #endif
220  }
221 
222  /*
223  * Set the default line ending value from the default in the PCRE library;
224  * "lf", "cr", "crlf", and "any" are supported. Anything else is treated
225  * as "lf".
226  */
227  if (newline == NULL) {
228  int val = 0;
229 #if defined(PCRE_CONFIG_NEWLINE)
230 /*@-modunconnomods@*/
231  (void)pcre_config(PCRE_CONFIG_NEWLINE, &val);
232 /*@=modunconnomods@*/
233 #endif
234  switch (val) {
235  default: newline = "lf"; break;
236  case '\r': newline = "cr"; break;
237 /*@-shiftimplementation@*/
238  case ('\r' << 8) | '\n': newline = "crlf"; break;
239 /*@=shiftimplementation@*/
240  case -1: newline = "any"; break;
241  case -2: newline = "anycrlf"; break;
242  }
243  }
244 
245  /* Interpret the newline type; the default settings are Unix-like. */
246  if (!strcasecmp(newline, "cr")) {
247 #if defined(PCRE_NEWLINE_CR)
248  _mirePCREoptions |= PCRE_NEWLINE_CR;
249 #endif
250  _mireEL = EL_CR;
251  } else if (!strcasecmp(newline, "lf")) {
252 #if defined(PCRE_NEWLINE_LF)
253  _mirePCREoptions |= PCRE_NEWLINE_LF;
254 #endif
255  _mireEL = EL_LF;
256  } else if (!strcasecmp(newline, "crlf")) {
257 #if defined(PCRE_NEWLINE_CRLF)
258  _mirePCREoptions |= PCRE_NEWLINE_CRLF;
259 #endif
260  _mireEL = EL_CRLF;
261  } else if (!strcasecmp(newline, "any")) {
262 #if defined(PCRE_NEWLINE_ANY)
263  _mirePCREoptions |= PCRE_NEWLINE_ANY;
264 #endif
265  _mireEL = EL_ANY;
266  } else if (!strcasecmp(newline, "anycrlf")) {
267 #if defined(PCRE_NEWLINE_ANYCRLF)
268  _mirePCREoptions |= PCRE_NEWLINE_ANYCRLF;
269 #endif
271  } else {
272  rc = -1;
273  }
274 
275  return rc;
276 }
277 
278 int mireSetLocale(/*@unused@*/ miRE mire, const char * locale)
279 {
280  const char * locale_from = NULL;
281  int rc = -1; /* assume failure */
282 
283  /* XXX TODO: --locale jiggery-pokery should be done env LC_ALL=C rpmgrep */
284  if (locale != NULL)
285  locale_from = "--locale";
286  else {
287  /*
288  * If a locale has not been provided as an option, see if the
289  * LC_CTYPE or LC_ALL environment variable is set, and if so,
290  * use it.
291  */
292 /*@-dependenttrans -observertrans@*/
293  if ((locale = getenv("LC_ALL")) != NULL)
294  locale_from = "LC_ALL";
295  else if ((locale = getenv("LC_CTYPE")) != NULL)
296  locale_from = "LC_CTYPE";
297  else {
298  locale_from = "glibc";
299  locale = "";
300  }
301 /*@=dependenttrans =observertrans@*/
302  }
303 
304  /*
305  * If a locale has been provided, set it, and generate the tables PCRE
306  * needs. Otherwise, _mirePCREtables == NULL, which uses default tables.
307  */
308  if (locale != NULL) {
309  const char * olocale = setlocale(LC_CTYPE, locale);
310  if (olocale == NULL) {
311 /*@-modfilesys@*/
312  fprintf(stderr,
313  _("%s: Failed to set locale %s (obtained from %s)\n"),
314  __progname, locale, locale_from);
315 /*@=modfilesys@*/
316  goto exit;
317  }
318 #if defined(WITH_PCRE)
319 /*@-evalorderuncon -onlytrans @*/
320  _mirePCREtables = pcre_maketables();
321 /*@=evalorderuncon =onlytrans @*/
322 #endif
323  if (setlocale(LC_CTYPE, olocale) == NULL)
324  goto exit;
325  }
326  rc = 0;
327 
328 exit:
329  return rc;
330 }
331 
332 int mireRegcomp(miRE mire, const char * pattern)
333 {
334  int rc = 0;
335 
336  mire->pattern = xstrdup(pattern);
337 
338  switch (mire->mode) {
339  case RPMMIRE_STRCMP:
340  break;
341  case RPMMIRE_PCRE:
342 #ifdef WITH_PCRE
343  mire->errcode = 0;
344  mire->errmsg = NULL;
345  mire->erroff = 0;
346  mire->pcre = pcre_compile2(mire->pattern, mire->coptions,
347  &mire->errcode, &mire->errmsg, &mire->erroff, mire->table);
348  if (mire->pcre == NULL) {
349  if (_mire_debug)
351  _("pcre_compile2 failed: %s(%d) at offset %d of \"%s\"\n"),
352  mire->errmsg, mire->errcode, mire->erroff, mire->pattern);
353  rc = -1;
354  goto exit; /* XXX HACK: rpmgrep is not expecting mireClean. */
355  }
356 #else
357  rc = -99;
358 #endif
359  break;
360  case RPMMIRE_DEFAULT:
361  case RPMMIRE_REGEX:
362  mire->preg = (regex_t *) xcalloc(1, sizeof(*mire->preg));
363  if (mire->cflags == 0)
364  mire->cflags = _mireREGEXoptions;
365  rc = regcomp(mire->preg, mire->pattern, mire->cflags);
366  if (rc) {
367  char msg[256];
368  (void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
369  msg[sizeof(msg)-1] = '\0';
370  rpmlog(RPMLOG_ERR, _("%s: regcomp failed: %s\n"),
371  mire->pattern, msg);
372  }
373  break;
374  case RPMMIRE_GLOB:
375  if (mire->fnflags == 0)
376  mire->fnflags = _mireGLOBoptions;
377  break;
378  default:
379  rc = -1;
380  break;
381  }
382 
383  if (rc)
384  (void) mireClean(mire);
385 
386 #ifdef WITH_PCRE
387 exit:
388 #endif
389 /*@-modfilesys@*/
390 if (_mire_debug)
391 fprintf(stderr, "<-- mireRegcomp(%p, \"%s\") rc %d\n", mire, pattern, rc);
392 /*@=modfilesys@*/
393  return rc;
394 }
395 
396 int mireRegexec(miRE mire, const char * val, size_t vallen)
397 {
398  int rc = -1; /* assume failure */
399 
400  switch (mire->mode) {
401  case RPMMIRE_STRCMP:
402  if (mire->pattern == NULL)
403  break;
404  if (vallen == 0)
405  vallen = strlen(val);
406  /* XXX strcasecmp? */
407  rc = strncmp(mire->pattern, val, vallen);
408  if (rc) rc = -1;
409  break;
410  case RPMMIRE_DEFAULT:
411  case RPMMIRE_REGEX:
412  if (mire->preg == NULL)
413  break;
414  /* XXX rpmgrep: ensure that the string is NUL terminated. */
415  if (vallen > 0) {
416  /* if (val[vallen] != '\0') might go outside of allocated memory */
417  char * t = strncpy(alloca(vallen+1), val, vallen);
418  t[vallen] = '\0';
419  val = t;
420  } else
421  if (vallen == 0)
422  vallen = strlen(val);
423 /*@-nullpass@*/
424  /* XXX HACK: PCRE returns 2/3 of array, POSIX dimensions regmatch_t. */
425  rc = regexec(mire->preg, val,
426  mire->noffsets/3, (regmatch_t *)mire->offsets, mire->eflags);
427 /*@=nullpass@*/
428  switch (rc) {
429  case 0: rc = 0; /*@innerbreak@*/ break;
430  case REG_NOMATCH: rc = -1;/*@innerbreak@*/ break;
431  default:
432  { char msg[256];
433  (void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
434  msg[sizeof(msg)-1] = '\0';
435  rpmlog(RPMLOG_ERR, _("%s: regexec failed: %s(%d)\n"),
436  mire->pattern, msg, rc);
437  if (rc < 0) rc -= 1; /* XXX ensure -1 is nomatch. */
438  if (rc > 0) rc = -(rc+1); /* XXX ensure errors are negative. */
439  } /*@innerbreak@*/ break;
440  }
441  break;
442  case RPMMIRE_PCRE:
443 #ifdef WITH_PCRE
444  if (mire->pcre == NULL)
445  break;
446  if (vallen == 0)
447  vallen = strlen(val);
448  rc = pcre_exec((pcre *)mire->pcre, (pcre_extra *)mire->hints,
449  val, (int)vallen, mire->startoff,
450  mire->eoptions, mire->offsets, mire->noffsets);
451  switch (rc) {
452  case 0: rc = 0; /*@innerbreak@*/ break;
453  case PCRE_ERROR_NOMATCH: rc = -1;/*@innerbreak@*/ break;
454  default:
455  if (_mire_debug && rc < 0)
456  rpmlog(RPMLOG_ERR, _("pcre_exec failed: return %d\n"), rc);
457  /*@innerbreak@*/ break;
458  }
459 #else
460  rc = -99;
461 #endif
462  break;
463  case RPMMIRE_GLOB:
464  if (mire->pattern == NULL)
465  break;
466  /* XXX rpmgrep: ensure that the string is NUL terminated. */
467  if (vallen > 0) {
468  /* if (val[vallen] != '\0') might go outside of allocated memory */
469  char * t = strncpy(alloca(vallen+1), val, vallen);
470  t[vallen] = '\0';
471  val = t;
472  }
473  rc = fnmatch(mire->pattern, val, mire->fnflags);
474  switch (rc) {
475  case 0: rc = 0; /*@innerbreak@*/ break;
476  case FNM_NOMATCH: rc = -1;/*@innerbreak@*/ break;
477  default:
478  if (_mire_debug)
479  rpmlog(RPMLOG_ERR, _("fnmatch failed: return %d\n"), rc);
480  if (rc < 0) rc -= 1; /* XXX ensure -1 is nomatch. */
481  if (rc > 0) rc = -(rc+1); /* XXX ensure errors are negative. */
482  /*@innerbreak@*/ break;
483  }
484  break;
485  default:
486  break;
487  }
488 
489 /*@-modfilesys@*/
490 if (_mire_debug)
491 fprintf(stderr, "<-- mireRegexec(%p, %p[%u]) rc %d mode %d \"%.*s\"\n", mire, val, (unsigned)vallen, rc, mire->mode, (int)(vallen < 20 ? vallen : 20), val);
492 /*@=modfilesys@*/
493  return rc;
494 }
495 
496 /*@-onlytrans@*/ /* XXX miRE array, not refcounted. */
497 int mireAppend(rpmMireMode mode, int tag, const char * pattern,
498  const unsigned char * table, miRE * mirep, int * nmirep)
499 {
500  miRE mire;
501  int xx;
502 
503  if (*mirep == NULL) {
504  (*mirep) = mireGetPool(_mirePool);
505  mire = (*mirep);
506  } else {
507  yarnLock use = (*mirep)->_item.use;
508  void *pool = (*mirep)->_item.pool;
509 
510  /* XXX only the 1st element in the array has a usage mutex. */
511  (*mirep) = (miRE) xrealloc((*mirep), ((*nmirep) + 1) * sizeof(*mire));
512  mire = (*mirep) + (*nmirep);
513  memset(mire, 0, sizeof(*mire));
514  /* XXX ensure no segfault, copy the use/pool from 1st item. */
515 /*@-assignexpose@*/
516  mire->_item.use = use;
517  mire->_item.pool = pool;
518 /*@=assignexpose@*/
519  }
520 
521  (*nmirep)++;
522  xx = mireSetCOptions(mire, mode, tag, 0, table);
523 /*@-usereleased@*/
524  return mireRegcomp(mire, pattern);
525 /*@=usereleased@*/
526 }
527 /*@=onlytrans@*/
528 
529 int mireLoadPatterns(rpmMireMode mode, int tag, const char ** patterns,
530  const unsigned char * table, miRE * mirep, int * nmirep)
531 {
532  const char *pattern;
533  int rc = -1; /* assume failure */
534 
535  if (patterns != NULL) /* note rc=0 return with no patterns to load. */
536  while ((pattern = *patterns++) != NULL) {
537  /* XXX pcre_options is not used. should it be? */
538  /* XXX more realloc's than necessary. */
539  int xx = mireAppend(mode, tag, pattern, table, mirep, nmirep);
540  if (xx) {
541  rc = xx;
542  goto exit;
543  }
544  }
545  rc = 0;
546 
547 exit:
548  return rc;
549 }
550 
551 int mireApply(miRE mire, int nmire, const char *s, size_t slen, int rc)
552 {
553  int i;
554 
555  if (slen == 0)
556  slen = strlen(s);
557 
558  if (mire)
559  for (i = 0; i < nmire; mire++, i++) {
560  int xx = mireRegexec(mire, s, slen);
561 
562  /* Check if excluding or including condition applies. */
563  if (rc < 0 && xx < 0)
564  continue; /* excluding: continue on negative matches. */
565  if (rc > 0 && xx >= 0)
566  continue; /* including: continue on positive matches. */
567  /* Save 1st found termination condition and exit. */
568  rc = xx;
569  break;
570  }
571  return rc;
572 }
573 
574 int mireStudy(miRE mire, int nmires)
575 {
576  int rc = -1; /* assume failure */
577  int j;
578 
579  /* Study the PCRE regex's, as we will be running them many times */
580  if (mire) /* note rc=0 return with no mire's. */
581  for (j = 0; j < nmires; mire++, j++) {
582  if (mire->mode != RPMMIRE_PCRE)
583  continue;
584 #if defined(WITH_PCRE)
585  { const char * error;
586  mire->hints = pcre_study((pcre *)mire->pcre, 0, &error);
587  if (error != NULL) {
588  char s[32];
589  if (nmires == 1) s[0] = '\0'; else sprintf(s, _(" number %d"), j);
590  rpmlog(RPMLOG_ERR, _("%s: Error while studying regex%s: %s\n"),
591  __progname, s, error);
592  goto exit;
593  }
594  }
595 #endif
596  }
597  rc = 0;
598 
599 #if defined(WITH_PCRE)
600 exit:
601 #endif
602  return rc;
603 }
static void mireFini(void *_mire)
Definition: mire.c:71
int mireSetEOptions(miRE mire, int *offsets, int noffsets)
Initialize pattern execute options (PCRE only).
Definition: mire.c:156
int _mire_debug
Definition: mire.c:18
miRE mireNew(rpmMireMode mode, int tag)
Create pattern container.
Definition: mire.c:113
int mireApply(miRE mire, int nmire, const char *s, size_t slen, int rc)
Apply array of patterns to a string.
Definition: mire.c:551
#define FNM_PATHNAME
Definition: fnmatch.h:41
int _mireGLOBoptions
GLOB default: FNM_PATHNAME | FNM_PERIOD.
Definition: mire.c:30
int mireLoadPatterns(rpmMireMode mode, int tag, const char **patterns, const unsigned char *table, miRE *mirep, int *nmirep)
Load patterns from string array.
Definition: mire.c:529
char * getenv(const char *name)
void * mireFreeAll(miRE mire, int nmire)
Destroy compiled patterns.
Definition: mire.c:96
char * xstrdup(const char *str)
Definition: rpmmalloc.c:321
const unsigned char * _mirePCREtables
Definition: mire.c:21
#define __progname
Definition: system.h:363
int mireRegcomp(miRE mire, const char *pattern)
Compile pattern match.
Definition: mire.c:332
static ARGV_t patterns
Definition: rpmgrep.c:87
int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options, const unsigned char *table)
Initialize pattern compile options.
Definition: mire.c:121
int mireClean(miRE mire)
Deallocate pattern match memory.
Definition: mire.c:38
void * rpmioFreePoolItem(rpmioItem item, const char *msg, const char *fn, unsigned ln)
Free a pool item.
Definition: rpmmalloc.c:186
static void rpmlog(int code, const char *fmt,...)
Definition: rpmlog.h:299
int _mirePCREoptions
PCRE default: 0.
Definition: mire.c:36
char * alloca()
Yet Another syslog(3) API clone.
void * xcalloc(size_t nmemb, size_t size)
Definition: rpmmalloc.c:300
const char * mode
Definition: mongo.h:440
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
Definition: rpmmalloc.c:220
RPM pattern matching.
Definition: mire.h:37
Definition: mire.h:37
struct miRE_s * miRE
Definition: mire.h:60
#define setlocale(Category, Locale)
Definition: system.h:513
int mireRegexec(miRE mire, const char *val, size_t vallen)
Execute pattern match.
Definition: mire.c:396
rpmioPool _mirePool
Definition: mire.c:79
enum rpmMireMode_e rpmMireMode
Tag value pattern match mode.
#define FNM_PERIOD
Definition: fnmatch.h:43
int mireStudy(miRE mire, int nmires)
Study PCRE patterns (if any).
Definition: mire.c:574
const char const int i
Definition: bson.h:778
mireEL_t _mireEL
Definition: mire.c:24
int mireSetLocale(miRE mire, const char *locale)
Compile locale-specific PCRE tables.
Definition: mire.c:278
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
Definition: rpmmalloc.c:109
Definition: mire.h:37
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
Definition: rpmiotypes.h:756
#define FNM_EXTMATCH
Definition: fnmatch.h:49
miRE mireGetPool(rpmioPool pool)
Allocate a miRE container from the pool.
Definition: mire.c:81
int _mireSTRINGoptions
STRING default: 0.
Definition: mire.c:27
int _mireREGEXoptions
REGEX default: REG_EXTENDED.
Definition: mire.c:33
int mireAppend(rpmMireMode mode, int tag, const char *pattern, const unsigned char *table, miRE *mirep, int *nmirep)
Append pattern to array.
Definition: mire.c:497
#define _(Text)
Definition: system.h:29
const char const char * pattern
Definition: bson.h:971
miRE mireLink(miRE mire)
Reference a pattern container instance.
#define FNM_NOMATCH
Definition: fnmatch.h:53
int mireSetGOptions(const char *newline, int caseless, int multiline, int utf8)
Initialize pattern global options (PCRE only).
Definition: mire.c:180
#define FNM_CASEFOLD
Definition: fnmatch.h:48
static const char * locale
Definition: rpmgrep.c:84
static const char * newline
Definition: rpmgrep.c:74
const char const bson const bson int int int options
Definition: mongo.h:569
int fnmatch(char *pattern, const char *string, int flags) const
Definition: fnmatch.c:279
enum mireEL_e mireEL_t
Line ending types.
#define xrealloc
Definition: system.h:35
int j
Definition: mongo.h:438
Definition: mire.h:37