rpm  5.4.10
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 
113 miRE mireNew(rpmMireMode mode, int tag)
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  if (locale)
286  locale_from = "--locale";
287  else {
288  /*
289  * If a locale has not been provided as an option, see if the
290  * LC_CTYPE or LC_ALL environment variable is set, and if so,
291  * use it.
292  */
293 /*@-dependenttrans -observertrans@*/
294  if ((locale = getenv("LC_ALL")) != NULL)
295  locale_from = "LC_ALL";
296  else if ((locale = getenv("LC_CTYPE")) != NULL)
297  locale_from = "LC_CTYPE";
298 /*@=dependenttrans =observertrans@*/
299  if (locale)
300  locale = xstrdup(locale);
301  }
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 #ifdef NOTYET
323  if (setlocale(LC_CTYPE, olocale) == NULL)
324  goto exit;
325 #endif
326 #endif
327  }
328  rc = 0;
329 
330 exit:
331  return rc;
332 }
333 
334 int mireRegcomp(miRE mire, const char * pattern)
335 {
336  int rc = 0;
337 
338  mire->pattern = xstrdup(pattern);
339 
340  switch (mire->mode) {
341  case RPMMIRE_STRCMP:
342  break;
343  case RPMMIRE_PCRE:
344 #ifdef WITH_PCRE
345  mire->errcode = 0;
346  mire->errmsg = NULL;
347  mire->erroff = 0;
348  mire->pcre = pcre_compile2(mire->pattern, mire->coptions,
349  &mire->errcode, &mire->errmsg, &mire->erroff, mire->table);
350  if (mire->pcre == NULL) {
351  if (_mire_debug)
353  _("pcre_compile2 failed: %s(%d) at offset %d of \"%s\"\n"),
354  mire->errmsg, mire->errcode, mire->erroff, mire->pattern);
355  rc = -1;
356  goto exit; /* XXX HACK: rpmgrep is not expecting mireClean. */
357  }
358 #else
359  rc = -99;
360 #endif
361  break;
362  case RPMMIRE_DEFAULT:
363  case RPMMIRE_REGEX:
364  mire->preg = (regex_t *) xcalloc(1, sizeof(*mire->preg));
365  if (mire->cflags == 0)
366  mire->cflags = _mireREGEXoptions;
367  rc = regcomp(mire->preg, mire->pattern, mire->cflags);
368  if (rc) {
369  char msg[256];
370  (void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
371  msg[sizeof(msg)-1] = '\0';
372  rpmlog(RPMLOG_ERR, _("%s: regcomp failed: %s\n"),
373  mire->pattern, msg);
374  }
375  break;
376  case RPMMIRE_GLOB:
377  if (mire->fnflags == 0)
378  mire->fnflags = _mireGLOBoptions;
379  break;
380  default:
381  rc = -1;
382  break;
383  }
384 
385  if (rc)
386  (void) mireClean(mire);
387 
388 #ifdef WITH_PCRE
389 exit:
390 #endif
391 /*@-modfilesys@*/
392 if (_mire_debug)
393 fprintf(stderr, "<-- mireRegcomp(%p, \"%s\") rc %d\n", mire, pattern, rc);
394 /*@=modfilesys@*/
395  return rc;
396 }
397 
398 int mireRegexec(miRE mire, const char * val, size_t vallen)
399 {
400  int rc = -1; /* assume failure */
401 
402  switch (mire->mode) {
403  case RPMMIRE_STRCMP:
404  if (mire->pattern == NULL)
405  break;
406  if (vallen == 0)
407  vallen = strlen(val);
408  /* XXX strcasecmp? */
409  rc = strncmp(mire->pattern, val, vallen);
410  if (rc) rc = -1;
411  break;
412  case RPMMIRE_DEFAULT:
413  case RPMMIRE_REGEX:
414  if (mire->preg == NULL)
415  break;
416  /* XXX rpmgrep: ensure that the string is NUL terminated. */
417  if (vallen > 0) {
418  /* if (val[vallen] != '\0') might go outside of allocated memory */
419  char * t = strncpy(alloca(vallen+1), val, vallen);
420  t[vallen] = '\0';
421  val = t;
422  } else
423  if (vallen == 0)
424  vallen = strlen(val);
425 /*@-nullpass@*/
426  /* XXX HACK: PCRE returns 2/3 of array, POSIX dimensions regmatch_t. */
427  rc = regexec(mire->preg, val,
428  mire->noffsets/3, (regmatch_t *)mire->offsets, mire->eflags);
429 /*@=nullpass@*/
430  switch (rc) {
431  case 0: rc = 0; /*@innerbreak@*/ break;
432  case REG_NOMATCH: rc = -1;/*@innerbreak@*/ break;
433  default:
434  { char msg[256];
435  (void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
436  msg[sizeof(msg)-1] = '\0';
437  rpmlog(RPMLOG_ERR, _("%s: regexec failed: %s(%d)\n"),
438  mire->pattern, msg, rc);
439  if (rc < 0) rc -= 1; /* XXX ensure -1 is nomatch. */
440  if (rc > 0) rc = -(rc+1); /* XXX ensure errors are negative. */
441  } /*@innerbreak@*/ break;
442  }
443  break;
444  case RPMMIRE_PCRE:
445 #ifdef WITH_PCRE
446  if (mire->pcre == NULL)
447  break;
448  if (vallen == 0)
449  vallen = strlen(val);
450  rc = pcre_exec((pcre *)mire->pcre, (pcre_extra *)mire->hints,
451  val, (int)vallen, mire->startoff,
452  mire->eoptions, mire->offsets, mire->noffsets);
453  switch (rc) {
454  case 0: rc = 0; /*@innerbreak@*/ break;
455  case PCRE_ERROR_NOMATCH: rc = -1;/*@innerbreak@*/ break;
456  default:
457  if (_mire_debug && rc < 0)
458  rpmlog(RPMLOG_ERR, _("pcre_exec failed: return %d\n"), rc);
459  /*@innerbreak@*/ break;
460  }
461 #else
462  rc = -99;
463 #endif
464  break;
465  case RPMMIRE_GLOB:
466  if (mire->pattern == NULL)
467  break;
468  /* XXX rpmgrep: ensure that the string is NUL terminated. */
469  if (vallen > 0) {
470  /* if (val[vallen] != '\0') might go outside of allocated memory */
471  char * t = strncpy(alloca(vallen+1), val, vallen);
472  t[vallen] = '\0';
473  val = t;
474  }
475  rc = fnmatch(mire->pattern, val, mire->fnflags);
476  switch (rc) {
477  case 0: rc = 0; /*@innerbreak@*/ break;
478  case FNM_NOMATCH: rc = -1;/*@innerbreak@*/ break;
479  default:
480  if (_mire_debug)
481  rpmlog(RPMLOG_ERR, _("fnmatch failed: return %d\n"), rc);
482  if (rc < 0) rc -= 1; /* XXX ensure -1 is nomatch. */
483  if (rc > 0) rc = -(rc+1); /* XXX ensure errors are negative. */
484  /*@innerbreak@*/ break;
485  }
486  break;
487  default:
488  break;
489  }
490 
491 /*@-modfilesys@*/
492 if (_mire_debug)
493 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);
494 /*@=modfilesys@*/
495  return rc;
496 }
497 
498 /*@-onlytrans@*/ /* XXX miRE array, not refcounted. */
499 int mireAppend(rpmMireMode mode, int tag, const char * pattern,
500  const unsigned char * table, miRE * mirep, int * nmirep)
501 {
502  miRE mire;
503  int xx;
504 
505  if (*mirep == NULL) {
506  (*mirep) = mireGetPool(_mirePool);
507  mire = (*mirep);
508  } else {
509  yarnLock use = (*mirep)->_item.use;
510  void *pool = (*mirep)->_item.pool;
511 
512  /* XXX only the 1st element in the array has a usage mutex. */
513  (*mirep) = (miRE) xrealloc((*mirep), ((*nmirep) + 1) * sizeof(*mire));
514  mire = (*mirep) + (*nmirep);
515  memset(mire, 0, sizeof(*mire));
516  /* XXX ensure no segfault, copy the use/pool from 1st item. */
517 /*@-assignexpose@*/
518  mire->_item.use = use;
519  mire->_item.pool = pool;
520 /*@=assignexpose@*/
521  }
522 
523  (*nmirep)++;
524  xx = mireSetCOptions(mire, mode, tag, 0, table);
525 /*@-usereleased@*/
526  return mireRegcomp(mire, pattern);
527 /*@=usereleased@*/
528 }
529 /*@=onlytrans@*/
530 
531 int mireLoadPatterns(rpmMireMode mode, int tag, const char ** patterns,
532  const unsigned char * table, miRE * mirep, int * nmirep)
533 {
534  const char *pattern;
535  int rc = -1; /* assume failure */
536 
537  if (patterns != NULL) /* note rc=0 return with no patterns to load. */
538  while ((pattern = *patterns++) != NULL) {
539  /* XXX pcre_options is not used. should it be? */
540  /* XXX more realloc's than necessary. */
541  int xx = mireAppend(mode, tag, pattern, table, mirep, nmirep);
542  if (xx) {
543  rc = xx;
544  goto exit;
545  }
546  }
547  rc = 0;
548 
549 exit:
550  return rc;
551 }
552 
553 int mireApply(miRE mire, int nmire, const char *s, size_t slen, int rc)
554 {
555  int i;
556 
557  if (slen == 0)
558  slen = strlen(s);
559 
560  if (mire)
561  for (i = 0; i < nmire; mire++, i++) {
562  int xx = mireRegexec(mire, s, slen);
563 
564  /* Check if excluding or including condition applies. */
565  if (rc < 0 && xx < 0)
566  continue; /* excluding: continue on negative matches. */
567  if (rc > 0 && xx >= 0)
568  continue; /* including: continue on positive matches. */
569  /* Save 1st found termination condition and exit. */
570  rc = xx;
571  break;
572  }
573  return rc;
574 }
575 
576 int mireStudy(miRE mire, int nmires)
577 {
578  int rc = -1; /* assume failure */
579  int j;
580 
581  /* Study the PCRE regex's, as we will be running them many times */
582  if (mire) /* note rc=0 return with no mire's. */
583  for (j = 0; j < nmires; mire++, j++) {
584  if (mire->mode != RPMMIRE_PCRE)
585  continue;
586 #if defined(WITH_PCRE)
587  { const char * error;
588  mire->hints = pcre_study((pcre *)mire->pcre, 0, &error);
589  if (error != NULL) {
590  char s[32];
591  if (nmires == 1) s[0] = '\0'; else sprintf(s, _(" number %d"), j);
592  rpmlog(RPMLOG_ERR, _("%s: Error while studying regex%s: %s\n"),
593  __progname, s, error);
594  goto exit;
595  }
596  }
597 #endif
598  }
599  rc = 0;
600 
601 #if defined(WITH_PCRE)
602 exit:
603 #endif
604  return rc;
605 }
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:553
#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:531
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:322
const unsigned char * _mirePCREtables
Definition: mire.c:21
#define __progname
Definition: system.h:428
int mireRegcomp(miRE mire, const char *pattern)
Compile pattern match.
Definition: mire.c:334
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:187
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:301
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
Definition: rpmmalloc.c:221
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:472
int mireRegexec(miRE mire, const char *val, size_t vallen)
Execute pattern match.
Definition: mire.c:398
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:576
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:110
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:647
#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
struct yarnLock_s * yarnLock
Definition: rpmiotypes.h:34
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:499
#define _(Text)
Definition: system.h:30
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
int fnmatch(char *pattern, const char *string, int flags) const
Definition: fnmatch.c:273
enum mireEL_e mireEL_t
Line ending types.
#define xrealloc
Definition: system.h:36
Definition: mire.h:37