|
rpm 5.3.12
|
RPM pattern matching. More...


Go to the source code of this file.
Defines | |
| #define | mireUnlink(_mire) (miRE)rpmioUnlinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__) |
| #define | mireLink(_mire) (miRE)rpmioLinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__) |
| #define | mireFree(_mire) (miRE)rpmioFreePoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__) |
Typedefs | |
| typedef enum mireEL_e | mireEL_t |
| Line ending types. | |
| typedef struct miRE_s * | miRE |
| typedef enum rpmMireMode_e | rpmMireMode |
| Tag value pattern match mode. | |
Enumerations | |
| enum | mireEL_e { EL_LF, EL_CR, EL_CRLF, EL_ANY, EL_ANYCRLF } |
| Line ending types. More... | |
| enum | rpmMireMode_e { RPMMIRE_DEFAULT = 0, RPMMIRE_STRCMP = 1, RPMMIRE_REGEX = 2, RPMMIRE_GLOB = 3, RPMMIRE_PCRE = 4 } |
| Tag value pattern match mode. More... | |
Functions | |
| int | mireClean (miRE mire) |
| Deallocate pattern match memory. | |
| miRE | mireGetPool (rpmioPool pool) |
| Allocate a miRE container from the pool. | |
| miRE | mireUnlink (miRE mire) |
| Unreference a pattern container instance. | |
| miRE | mireLink (miRE mire) |
| Reference a pattern container instance. | |
| miRE | mireFree (miRE mire) |
| Free pattern container. | |
| void * | mireFreeAll (miRE mire, int nmire) |
| Destroy compiled patterns. | |
| miRE | mireNew (rpmMireMode mode, int tag) |
| Create pattern container. | |
| int | mireSetCOptions (miRE mire, rpmMireMode mode, int tag, int options, const unsigned char *table) |
| Initialize pattern compile options. | |
| int | mireSetEOptions (miRE mire, int *offsets, int noffsets) |
| Initialize pattern execute options (PCRE only). | |
| int | mireSetGOptions (const char *newline, int caseless, int multiline, int utf8) |
| Initialize pattern global options (PCRE only). | |
| int | mireSetLocale (miRE mire, const char *locale) |
| Compile locale-specific PCRE tables. | |
| int | mireRegcomp (miRE mire, const char *pattern) |
| Compile pattern match. | |
| int | mireRegexec (miRE mire, const char *val, size_t vallen) |
| Execute pattern match. | |
| int | mireAppend (rpmMireMode mode, int tag, const char *pattern, const unsigned char *table, miRE *mirep, int *nmirep) |
| Append pattern to array. | |
| int | mireLoadPatterns (rpmMireMode mode, int tag, const char **patterns, const unsigned char *table, miRE *mirep, int *nmirep) |
| Load patterns from string array. | |
| int | mireApply (miRE mire, int nmire, const char *s, size_t slen, int rc) |
| Apply array of patterns to a string. | |
| int | mireStudy (miRE mire, int nmires) |
| Study PCRE patterns (if any). | |
Variables | |
| int | _mire_debug |
| rpmioPool | _mirePool |
| const unsigned char * | _mirePCREtables |
| mireEL_t | _mireEL |
| int | _mireSTRINGoptions |
| STRING default: 0. | |
| int | _mireGLOBoptions |
| GLOB default: FNM_PATHNAME | FNM_PERIOD. | |
| int | _mireREGEXoptions |
| REGEX default: REG_EXTENDED. | |
| int | _mirePCREoptions |
| PCRE default: 0. | |
RPM pattern matching.
Definition in file mire.h.
| typedef enum rpmMireMode_e rpmMireMode |
Tag value pattern match mode.
| enum mireEL_e |
| enum rpmMireMode_e |
Tag value pattern match mode.
| RPMMIRE_DEFAULT |
posix regex with \., .* and ^...$ added |
| RPMMIRE_STRCMP |
strings using strcmp(3) |
| RPMMIRE_REGEX |
posix regex(7) patterns using regcomp(3) |
| RPMMIRE_GLOB |
glob(7) patterns using fnmatch(3) |
| RPMMIRE_PCRE |
pcre patterns using pcre_compile2(3) |
| int mireAppend | ( | rpmMireMode | mode, |
| int | tag, | ||
| const char * | pattern, | ||
| const unsigned char * | table, | ||
| miRE * | mirep, | ||
| int * | nmirep | ||
| ) |
Append pattern to array.
| mode | type of pattern match |
| tag | identifier (like an rpmTag) |
| pattern | pattern to compile |
| table | (PCRE) locale table to use (NULL uses default table) |
| *mirep | pattern array |
| *nmirep | no. of patterns in array |
Definition at line 489 of file mire.c.
References mireGetPool(), mireRegcomp(), mireSetCOptions(), and xrealloc().
Referenced by mireLoadPatterns(), rpmdbTriggerGlobs(), rpmfcExpandRegexps(), rpmPlatform(), and strsubFormat().
| int mireApply | ( | miRE | mire, |
| int | nmire, | ||
| const char * | s, | ||
| size_t | slen, | ||
| int | rc | ||
| ) |
Apply array of patterns to a string.
| mire | compiled pattern array |
| nmire | no. of patterns in array |
| s | string to apply against |
| slen | length of string (0 will use strlen(s)) |
| rc | -1 == excluding, +1 == including, 0 == single pattern |
Definition at line 543 of file mire.c.
References mireRegexec().
Referenced by grep_or_recurse(), and rpmrepoGetFileList().
| int mireClean | ( | miRE | mire | ) |
Deallocate pattern match memory.
| mire | pattern container |
Definition at line 38 of file mire.c.
References _free(), _mire_debug, RPMMIRE_PCRE, and RPMMIRE_REGEX.
Referenced by handleOneTrigger(), mireFini(), mireFreeAll(), and mireRegcomp().
Free pattern container.
| mire | pattern container |
Referenced by dbiMireKeys(), handleOneTrigger(), rpmcliFini(), rpmcliInstallElementPath(), rpmfcApply(), rpmfcExpandRegexps(), rpmfcSCRIPT(), rpmmiAddPattern(), and tagValidate().
| void* mireFreeAll | ( | miRE | mire, |
| int | nmire | ||
| ) |
Destroy compiled patterns.
| mire | pattern array |
| nre | no of patterns in array |
Definition at line 95 of file mire.c.
References _free(), mireClean(), and rpmioFreePoolItem().
Referenced by rpmdsFini(), rpmfcFreeRegexps(), rpmfiFini(), rpmFreeRpmrc(), rpmmiFini(), rpmPlatform(), rpmrepoFini(), runTriggers(), and strsubFormat().
Allocate a miRE container from the pool.
| pool | mire pool |
Definition at line 80 of file mire.c.
References _mire_debug, _mirePool, mireFini(), rpmioGetPool(), and rpmioNewPool().
Referenced by mireAppend(), mireNew(), and rpmmiAddPattern().
Reference a pattern container instance.
| mire | pattern container |
Referenced by mireNew(), and rpmmiAddPattern().
| int mireLoadPatterns | ( | rpmMireMode | mode, |
| int | tag, | ||
| const char ** | patterns, | ||
| const unsigned char * | table, | ||
| miRE * | mirep, | ||
| int * | nmirep | ||
| ) |
Load patterns from string array.
| mode | type of pattern match |
| tag | identifier (like an rpmTag) |
| patterns | patterns to compile |
| table | (PCRE) locale table to use (NULL uses default table) |
| *mirep | pattern array |
| *nmirep | no. of patterns in array |
Definition at line 521 of file mire.c.
References mireAppend().
Referenced by main().
| miRE mireNew | ( | rpmMireMode | mode, |
| int | tag | ||
| ) |
Create pattern container.
| mode | type of pattern match |
| tag | identifier (e.g. an rpmTag) |
Definition at line 110 of file mire.c.
References mireGetPool(), and mireLink().
Referenced by dbiMireKeys(), handleOneTrigger(), rpmcliInstallElementPath(), rpmEVRmire(), rpmfcApply(), rpmfcSCRIPT(), rpmmiAddPattern(), and tagValidate().
| int mireRegcomp | ( | miRE | mire, |
| const char * | pattern | ||
| ) |
Compile pattern match.
| mire | pattern container |
| val | pattern to compile |
Definition at line 331 of file mire.c.
References _, _mire_debug, _mireGLOBoptions, _mireREGEXoptions, mireClean(), rpmlog(), RPMLOG_ERR, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_PCRE, RPMMIRE_REGEX, RPMMIRE_STRCMP, xcalloc(), and xstrdup().
Referenced by compile_single_pattern(), dbiMireKeys(), handleOneTrigger(), mireAppend(), rpmcliInstallElementPath(), rpmEVRmire(), rpmfcApply(), rpmfcSCRIPT(), rpmmiAddPattern(), and tagValidate().
| int mireRegexec | ( | miRE | mire, |
| const char * | val, | ||
| size_t | vallen | ||
| ) |
Execute pattern match.
| mire | pattern container |
| val | value to match |
| vallen | length of value string (0 will use strlen) |
Definition at line 395 of file mire.c.
References _, _mire_debug, alloca(), FNM_NOMATCH, fnmatch(), rpmlog(), RPMLOG_ERR, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_PCRE, RPMMIRE_REGEX, and RPMMIRE_STRCMP.
Referenced by dbiMireKeys(), handleOneTrigger(), mireApply(), mireSkip(), pcregrep(), rpmcliWalkFirst(), rpmEVRparse(), rpmfcApply(), rpmfcMatchRegexps(), rpmfcSCRIPT(), rpmGetMacroEntries(), rpmPlatformScore(), runTriggersLoop(), strsubFormat(), and tagValidate().
| int mireSetCOptions | ( | miRE | mire, |
| rpmMireMode | mode, | ||
| int | tag, | ||
| int | options, | ||
| const unsigned char * | table | ||
| ) |
Initialize pattern compile options.
| mire | pattern container |
| mode | type of pattern match |
| tag | identifier (e.g. an rpmTag) |
| options | pattern options (0 uses default options) |
| table | (PCRE only) locale tables |
Definition at line 118 of file mire.c.
References _mireGLOBoptions, _mirePCREoptions, _mireREGEXoptions, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_PCRE, RPMMIRE_REGEX, and RPMMIRE_STRCMP.
Referenced by compile_single_pattern(), mireAppend(), rpmEVRmire(), and tagValidate().
| int mireSetEOptions | ( | miRE | mire, |
| int * | offsets, | ||
| int | noffsets | ||
| ) |
Initialize pattern execute options (PCRE only).
| mire | pattern container |
| *offsets | (PCRE only) string offset(s) |
| noffsets | (PCRE only) no. of string offsets |
Definition at line 153 of file mire.c.
References RPMMIRE_PCRE, and RPMMIRE_REGEX.
Referenced by pcregrep(), rpmEVRparse(), and strsubFormat().
| int mireSetGOptions | ( | const char * | newline, |
| int | caseless, | ||
| int | multiline, | ||
| int | utf8 | ||
| ) |
Initialize pattern global options (PCRE only).
| newline | newline ending identifier |
| caseless | should case be ignored? |
| multline | are multiline matches permitted? |
| utf8 | assume utf8 matching? |
Definition at line 177 of file mire.c.
References _mireEL, _mireGLOBoptions, _mirePCREoptions, _mireREGEXoptions, EL_ANY, EL_ANYCRLF, EL_CR, EL_CRLF, EL_LF, and FNM_CASEFOLD.
| int mireSetLocale | ( | miRE | mire, |
| const char * | locale | ||
| ) |
Compile locale-specific PCRE tables.
| mire | pattern container |
| locale | locale string (NULL uses usual envvar's) |
Definition at line 275 of file mire.c.
References _, __progname, _mirePCREtables, getenv(), setlocale, and xstrdup().
| int mireStudy | ( | miRE | mire, |
| int | nmires | ||
| ) |
Study PCRE patterns (if any).
| mire | pattern container |
| nmires | no. of patterns in container |
Definition at line 566 of file mire.c.
References _, __progname, rpmlog(), RPMLOG_ERR, and RPMMIRE_PCRE.
Unreference a pattern container instance.
| mire | pattern container |
| int _mire_debug |
Definition at line 18 of file mire.c.
Referenced by mireClean(), mireGetPool(), mireRegcomp(), mireRegexec(), and rpmmiAddPattern().
Definition at line 24 of file mire.c.
Referenced by end_of_line(), mireSetGOptions(), and previous_line().
| int _mireGLOBoptions |
GLOB default: FNM_PATHNAME | FNM_PERIOD.
Definition at line 30 of file mire.c.
Referenced by mireRegcomp(), mireSetCOptions(), and mireSetGOptions().
| int _mirePCREoptions |
PCRE default: 0.
Definition at line 36 of file mire.c.
Referenced by mireSetCOptions(), and mireSetGOptions().
| const unsigned char* _mirePCREtables |
Definition at line 21 of file mire.c.
Referenced by compile_single_pattern(), and mireSetLocale().
Definition at line 78 of file mire.c.
Referenced by mireGetPool(), rpmioClean(), and rpmmiAddPattern().
REGEX default: REG_EXTENDED.
Definition at line 33 of file mire.c.
Referenced by mireRegcomp(), mireSetCOptions(), and mireSetGOptions().
1.7.4