rpm  5.4.14
Data Structures | Macros | Typedefs | Functions | Variables
#include "system.h"
#include <stdarg.h>
#include <rpmio_internal.h>
#include <rpmlog.h>
#include <mire.h>
#include <rpmaug.h>
#include <rpmficl.h>
#include <rpmgit.h>
#include <rpmjs.h>
#include <rpmperl.h>
#include <rpmpython.h>
#include <rpmruby.h>
#include <rpmsm.h>
#include <rpmsquirrel.h>
#include <rpmsql.h>
#include <rpmtcl.h>
#include <rpmuuid.h>
#include <rpmmacro.h>
#include "debug.h"
Include dependency graph for macro.c:

Go to the source code of this file.

Data Structures

struct  MacroBuf_s
 Macro expansion state. More...
 

Macros

#define isblank(_c)   ((char)(_c) == ' ' || (char)(_c) == '\t')
 
#define iseol(_c)   ((char)(_c) == '\n' || (char)(_c) == '\r')
 
#define STREQ(_t, _f, _fn)   ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn)))
 
#define _RPMAUG_INTERNAL   /* XXX for _rpmaugFoo globals */
 
#define _MACRO_INTERNAL
 
#define SAVECHAR(_mb, _c)   { *(_mb)->t = (char) (_c), (_mb)->t++, (_mb)->nb--; }
 
#define _MAX_MACRO_DEPTH   16
 
#define _PRINT_MACRO_TRACE   0
 
#define _PRINT_EXPAND_TRACE   0
 
#define _MAX_LOAD_DEPTH   2
 
#define MACRO_CHUNK_SIZE   16
 
#define SKIPBLANK(_s, _c)
 
#define SKIPNONBLANK(_s, _c)
 
#define COPYNAME(_ne, _s, _c)
 
#define COPYOPTS(_oe, _s, _c)
 
#define POPT_ERROR_NOARG   -10
 
#define POPT_ERROR_BADQUOTE   -15
 
#define POPT_ERROR_MALLOC   -21
 
#define POPT_ARGV_ARRAY_GROW_DELTA   5
 
#define _suffix(_s, _x)   (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x)))
 

Typedefs

typedef struct MacroBuf_sMacroBuf
 

Functions

static int expandMacro (MacroBuf mb)
 
return strcmp (ame->name, bme->name)
 
 qsort (mc->macroTable, mc->firstFree, sizeof(mc->macroTable[0]), compareMacroName)
 
 for (i=0;i< mc->firstFree;i++)
 
static char * dupMacroEntry (MacroEntry me)
 
void rpmDumpMacroTable (MacroContext mc, FILE *fp)
 Print macros to file stream. More...
 
int rpmGetMacroEntries (MacroContext mc, void *_mire, int used, const char ***avp)
 Return macro entries as string array. More...
 
static MacroEntryif (mc==NULL)
 Find entry in macro table. More...
 
 if (fgets(q,(int) size, f)==NULL)
 
 if (nb==0||(*q!= '\\'&&!bc &&!pc)||*(q+1)== '\0')
 
 while (size > 0)
 
 return (nread > 0?buf:NULL)
 
 while ((c=*p++)!= '\0')
 
 return (const char *)
 Pre-print macro expression to be expanded. More...
 
 if (!(te > t))
 
 if (mb->depth > 0)
 
 fprintf (stderr,"%3d<%*s", mb->depth,(2 *mb->depth+1),"")
 
 fprintf (stderr,"%.*s%s",(int)(te-t), t, ellipsis)
 
 fprintf (stderr,"\n")
 
 memset (sbuf, 0,(flen+1))
 
 strncpy (sbuf, f, flen)
 
 memset (tbuf, 0,(ulen+1))
 
 strncpy (u, tbuf,(ulen-mb->nb+1))
 
 strncpy (buf, cmd, clen)
 
 if ((shf=popen(buf,"r"))==NULL)
 
void pclose (shf)
 
 while (((char)(mb->t[-1])== '\n'||(char)(mb->t[-1])== '\r'))
 
 while (((c)=(int)*(s))&&((char)(c)== ' '||(char)(c)== '\t'))
 
 while (((c)=(int)*(s))&&(xisalnum(c)||(c)==(int) '_')) { while ((( c ) = (int) *( s )) && ((char)( c ) == ' ' || (char)( c ) == '\t')) ( s )++
 
 delMacro (mc, n)
 
 delMacroAll (mc, n)
 
static void pushMacro (MacroEntry *mep, const char *n, const char *o, const char *b, int level)
 Push new macro definition onto macro entry stack. More...
 
 if (me)
 
 sortMacroTable (mc)
 
static const char * grabArgs (MacroBuf mb, const MacroEntry me, const char *se, const char *lastc)
 Parse arguments (to next new line) for parameterized macro. More...
 
 strncpy (buf, msg, msglen)
 
void expandU (mb, buf, bufn)
 
 rpmlog (RPMLOG_ERR,"%s\n", buf)
 
else fprintf (stderr,"%s", buf)
 
static void doFoo (MacroBuf mb, int negate, const char *f, size_t fn, const char *g, size_t gn)
 Execute macro primitives. More...
 
static int expandFIFO (MacroBuf mb, MacroEntry me, const char *g, size_t gn)
 
static int XpoptDupArgv (int argc, char **argv, int *argcPtr, char ***argvPtr)
 
static int XpoptParseArgvString (const char *s, int *argcPtr, char ***argvPtr)
 
 if (++mb->depth > max_macro_depth)
 
 while (rc==0 &&mb->nb > 0 &&(c=(int)*s)!=(int)'\0')
 
 printExpansion (mb, t, mb->t)
 
int rpmSecuritySaneFile (const char *filename)
 Check whether configuration file is moderately secure to load. More...
 
int rpmGlob (const char *patterns, int *argcPtr, const char ***argvPtr)
 Return URL path(s) from a (URL prefixed) pattern glob. More...
 
int expandMacros (void *spec, MacroContext mc, char *sbuf, size_t slen)
 Expand macro into buffer. More...
 
void addMacro (MacroContext mc, const char *n, const char *o, const char *b, int level)
 Add macro to context. More...
 
void delMacro (MacroContext mc, const char *n)
 Delete macro from context. More...
 
void delMacroAll (MacroContext mc, const char *n)
 
int rpmDefineMacro (MacroContext mc, const char *macro, int level)
 Define macro in context. More...
 
int rpmUndefineMacro (MacroContext mc, const char *macro)
 Undefine macro in context. More...
 
void rpmLoadMacros (MacroContext mc, int level)
 Load macros from specific context into global context. More...
 
int rpmLoadMacroFile (MacroContext mc, const char *fn, int nesting)
 Load macro context from a macro file. More...
 
void rpmInitMacros (MacroContext mc, const char *macrofiles)
 Initialize macro context from set of macrofile(s). More...
 
void rpmFreeMacros (MacroContext mc)
 Destroy macro context. More...
 
int isCompressed (const char *file, rpmCompressedMagic *compressed)
 Return type of compression used in file. More...
 
char * rpmExpand (const char *arg,...)
 Return (malloc'ed) concatenated macro expansion(s). More...
 
char * rpmMCExpand (MacroContext mc, const char *arg,...)
 Return (malloc'ed) concatenated macro expansion(s) in a context. More...
 
int rpmExpandNumeric (const char *arg)
 Return macro expansion as a numeric value. More...
 
char * rpmCleanPath (char *path)
 Canonicalize file path. More...
 
char * rpmGetPath (const char *path,...)
 Return (malloc'ed) expanded, canonicalized, file path. More...
 
const char * rpmGenPath (const char *urlroot, const char *urlmdir, const char *urlfile)
 Merge 3 args into path, any or all of which may be a url. More...
 

Variables

const char * rpmMacrofiles = MACROFILES
 List of macro files to read when configuring rpm. More...
 
static struct MacroContext_s rpmGlobalMacroContext_s
 
MacroContext rpmGlobalMacroContext = &rpmGlobalMacroContext_s
 
static struct MacroContext_s rpmCLIMacroContext_s
 
MacroContext rpmCLIMacroContext = &rpmCLIMacroContext_s
 
int max_macro_depth = 16
 
int print_macro_trace = 0
 
int print_expand_trace = 0
 
int _max_load_depth = 2
 
static size_t _macro_BUFSIZ = 16 * 1024
 
static int
 Compare macro entries by name (qsort/bsearch). More...
 
MacroEntry bme = *((MacroEntry *)bp)
 
 return
 
static void
 Enlarge macro table. More...
 
key name = (char *)name
 
 ret
 
static char *size_t nb = 0
 fgets(3) analogue that reads \ continuations. More...
 
size_t nread = 0
 
FILE * f = fdGetFILE(fd)
 
int pc = 0
 
int bc = 0
 
char * p = buf
 
 do
 
 q = '\n'
 
 size = nb
 
static const char *char c
 Return text between pl and matching pr characters. More...
 
int choplen
 
 te
 
 ellipsis = ""
 
const char * s = mb->s
 
int rc = expandMacro(mb)
 
 sbuf = (char *) alloca(flen + 1)
 
char * t = mb->t
 
char * tbuf = (char *) alloca(ulen + 1)
 
char * buf = (char *) alloca(bufn)
 Parse (and execute) macro undefinition. More...
 
FILE * shf
 
static const char *size_t bufn = _macro_BUFSIZ
 Parse (and execute) new macro definition. More...
 
char * n = buf
 
char * ne = n
 
char * oe = ne + 1
 
char * b
 
char * be
 
int oc = (int) ')'
 
if(*)(c) s ('){s++;o=oe;{while(((oc)=(int)*(s))&&(oc)!=(int) ')')*(oe)++=*(s)++;*(oe)= '\0';};s++;}b=be=oe+1;while(((c)=(int)*(s))&&((char (')
 
return se
 
int ndeleted = 0
 
int i
 
MacroEntry me
 
const char * fe
 
const char * g
 
const char * ge
 
size_t fn
 
size_t gn
 
int negate
 
int stackarray
 
const char * lastc
 
int chkexist
 
mb depth
 
static int _debug = 0
 
Class: Rpmts
 key = (MacroEntry) memset(alloca(sizeof(*key)), 0, sizeof(*key))
 
Class: Rpmds
char * o = NULL
 

Macro Definition Documentation

#define _MACRO_INTERNAL

Definition at line 97 of file macro.c.

#define _MAX_LOAD_DEPTH   2

Definition at line 164 of file macro.c.

#define _MAX_MACRO_DEPTH   16

Definition at line 152 of file macro.c.

Referenced by rpmLoadMacroFile().

#define _PRINT_EXPAND_TRACE   0

Definition at line 160 of file macro.c.

#define _PRINT_MACRO_TRACE   0

Definition at line 156 of file macro.c.

#define _RPMAUG_INTERNAL   /* XXX for _rpmaugFoo globals */

Definition at line 73 of file macro.c.

#define _suffix (   _s,
  _x 
)    (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x)))

Referenced by rpmInitMacros().

#define COPYNAME (   _ne,
  _s,
  _c 
)
Value:
{ SKIPBLANK(_s,_c); \
while(((_c) = (int) *(_s)) && (xisalnum(_c) || (_c) == (int) '_')) \
*(_ne)++ = *(_s)++; \
*(_ne) = '\0'; \
}
static int xisalnum(int c)
Definition: rpmiotypes.h:440
#define SKIPBLANK(_s, _c)
Definition: macro.c:575
while((rc=poptGetNextOpt(optCon)) > 0)
Definition: poptALL.c:809

Definition at line 587 of file macro.c.

#define COPYOPTS (   _oe,
  _s,
  _c 
)
Value:
{ while(((_c) = (int) *(_s)) && (_c) != (int) ')') \
*(_oe)++ = *(_s)++; \
*(_oe) = '\0'; \
}

Definition at line 594 of file macro.c.

Referenced by ('){s++;o=oe;{while(((oc)=(int)*(s))&&(oc)!=(int) ')')*(oe)++=*(s)++;*(oe)= '\0';};s++;}b=be=oe+1;while(((c)=(int)*(s))&&((char.

#define isblank (   _c)    ((char)(_c) == ' ' || (char)(_c) == '\t')

Definition at line 9 of file macro.c.

Referenced by doFoo(), grabArgs(), and while().

#define iseol (   _c)    ((char)(_c) == '\n' || (char)(_c) == '\r')

Definition at line 11 of file macro.c.

Referenced by while().

#define MACRO_CHUNK_SIZE   16

Definition at line 169 of file macro.c.

#define POPT_ARGV_ARRAY_GROW_DELTA   5

Definition at line 1525 of file macro.c.

Referenced by XpoptParseArgvString().

#define POPT_ERROR_BADQUOTE   -15

error in paramter quoting

Definition at line 1522 of file macro.c.

Referenced by XpoptParseArgvString().

#define POPT_ERROR_MALLOC   -21

memory allocation failed

Definition at line 1523 of file macro.c.

Referenced by XpoptDupArgv(), and XpoptParseArgvString().

#define POPT_ERROR_NOARG   -10

missing argument

Definition at line 1521 of file macro.c.

Referenced by XpoptDupArgv().

#define SAVECHAR (   _mb,
  _c 
)    { *(_mb)->t = (char) (_c), (_mb)->t++, (_mb)->nb--; }

Definition at line 148 of file macro.c.

Referenced by while().

#define SKIPBLANK (   _s,
  _c 
)
Value:
/*@-globs@*/ /* FIX: __ctype_b */ \
while (((_c) = (int) *(_s)) && isblank(_c)) \
(_s)++; \
/*@=globs@*/
#define isblank(_c)
Definition: macro.c:9
while((rc=poptGetNextOpt(optCon)) > 0)
Definition: poptALL.c:809

Definition at line 575 of file macro.c.

Referenced by rpmLoadMacroFile().

#define SKIPNONBLANK (   _s,
  _c 
)
Value:
/*@-globs@*/ /* FIX: __ctype_b */ \
while (((_c) = (int) *(_s)) && !(isblank(_c) || iseol(_c))) \
(_s)++; \
/*@=globs@*/
#define isblank(_c)
Definition: macro.c:9
while((rc=poptGetNextOpt(optCon)) > 0)
Definition: poptALL.c:809
#define iseol(_c)
Definition: macro.c:11

Definition at line 581 of file macro.c.

#define STREQ (   _t,
  _f,
  _fn 
)    ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn)))

Definition at line 13 of file macro.c.

Referenced by doFoo(), and while().

Typedef Documentation

typedef struct MacroBuf_s * MacroBuf

Function Documentation

void addMacro ( MacroContext  mc,
const char *  n,
const char *  o,
const char *  b,
int  level 
)

Add macro to context.

Deprecated:
Use rpmDefineMacro().
Parameters
mcmacro context (NULL uses global context).
nmacro name
omacro paramaters
bmacro body
levelmacro recursion level (0 is entry API)

Definition at line 2722 of file macro.c.

References _, findEntry(), n, NULL, pushMacro(), rpmGlobalMacroContext, rpmlog(), RPMLOG_ERR, sortMacroTable(), and strcmp().

Referenced by addMacroDefault(), addSource(), doSetupMacro(), grabArgs(), handlePreambleTag(), headerMacrosLoad(), makeGPGSignature(), parsePreamble(), parseSpec(), rpmcliInstall(), rpmLoadMacros(), rpmPlatform(), rpmRebuildTargetVars(), rpmtsOpenSDB(), setDefaults(), setPathDefault(), and while().

delMacro ( mc  ,
n   
)
void delMacro ( MacroContext  mc,
const char *  n 
)

Delete macro from context.

Parameters
mcmacro context (NULL uses global context).
nmacro name

Definition at line 2761 of file macro.c.

References findEntry(), NULL, rpmGlobalMacroContext, and sortMacroTable().

delMacroAll ( mc  ,
n   
)
void delMacroAll ( MacroContext  mc,
const char *  n 
)

Definition at line 2776 of file macro.c.

References delMacro(), findEntry(), NULL, and rpmGlobalMacroContext.

static void doFoo ( MacroBuf  mb,
int  negate,
const char *  f,
size_t  fn,
const char *  g,
size_t  gn 
)
static

Execute macro primitives.

Parameters
mbmacro expansion state
negateshould logic be inverted?
fbeginning of field f
fnlength of field f
gbeginning of field g
gnlength of field g

Definition at line 1271 of file macro.c.

References _macro_BUFSIZ, alloca(), be, buf, c, COMPRESSED_OTHER, expandU(), getenv(), gn, i, int, isblank, isCompressed(), j, k, mode, n, negate, NULL, PATH_MAX, realpath(), rpmlog(), RPMLOG_ERR, RPMLOG_INFO, RPMLOG_MASK, rpmlogSetMask(), rpmuuidMake(), sprintf(), stpcpy(), stpncpy(), STREQ, strncpy(), urlPath(), uuid_ns, uuid_version, void, xisdigit(), and xisspace().

Referenced by while().

static char* dupMacroEntry ( MacroEntry  me)
static

Definition at line 257 of file macro.c.

References assert(), nb, NULL, stpcpy(), t, te, and xmalloc.

Referenced by rpmGetMacroEntries().

static int expandFIFO ( MacroBuf  mb,
MacroEntry  me,
const char *  g,
size_t  gn 
)
static

Definition at line 1501 of file macro.c.

References rc.

Referenced by while().

static int expandMacro ( MacroBuf  mb)
static

Referenced by expandMacros(), and while().

int expandMacros ( void spec,
MacroContext  mc,
char *  sbuf,
size_t  slen 
)

Expand macro into buffer.

Deprecated:
Use rpmExpand().
Todo:
Eliminate from API.
Parameters
speccookie (unused)
mcmacro context (NULL uses global context).
Return values
sbufinput macro to expand, output expansion
Parameters
slensize of buffer
Returns
0 on success

Definition at line 2687 of file macro.c.

References _, alloca(), MacroBuf_s::depth, MacroBuf_s::expand_trace, expandMacro(), MacroBuf_s::macro_trace, MacroBuf_s::mc, MacroBuf_s::nb, NULL, print_expand_trace, print_macro_trace, rc, rpmGlobalMacroContext, rpmlog(), RPMLOG_ERR, MacroBuf_s::s, sbuf, spec, MacroBuf_s::spec, strncpy(), MacroBuf_s::t, and tbuf.

Referenced by addFileToTagAux(), copyNextLineFromOFI(), processPackageFiles(), rpmExpand(), rpmGetPath(), and rpmMCExpand().

void expandU ( mb  ,
buf  ,
bufn   
)

Referenced by doFoo(), and grabArgs().

for ( i  = 0; i < mc->firstFree; i++)

Definition at line 247 of file macro.c.

References i, and NULL.

fprintf ( stderr  ,
"%3d<%*s", mb->  depth,
(2 *mb->depth+1)  ,
""   
)
fprintf ( stderr  ,
"%.*s%s ,
(int)(te-t ,
t  ,
ellipsis   
)
fprintf ( stderr  ,
"\n"   
)
else fprintf ( stderr  ,
"%s"  ,
buf   
)
static const char* grabArgs ( MacroBuf  mb,
const MacroEntry  me,
const char *  se,
const char *  lastc 
)
static

Parse arguments (to next new line) for parameterized macro.

Todo:
Use popt rather than getopt to parse args.
Parameters
mbmacro expansion state
memacro entry slot
searguments to parse
lastcstop parsing at lastc
Returns
address to continue parsing

Definition at line 1069 of file macro.c.

References _, _free(), _macro_BUFSIZ, addMacro(), alloca(), argv, b, be, buf, c, MacroBuf_s::depth, exit, expandU(), int, isblank, MacroBuf_s::mc, NULL, optCon, poptContext, rpmlog(), RPMLOG_ERR, se, sprintf(), stpcpy(), and xcalloc().

Referenced by while().

static MacroEntry* if ( mc  = NULL)

Find entry in macro table.

Parameters
mcmacro context
namemacro name
namelenno. of bytes
Returns
address of slot in macro table with name (or NULL)

Definition at line 372 of file macro.c.

References alloca(), strncpy(), and t.

if ( fgets(q,(int) size, f = NULL)

Definition at line 418 of file macro.c.

if ( nb  = = 0 || (*q != '\\' && !bc && !pc) || *(q+1) == '\0')

Definition at line 447 of file macro.c.

References q.

if ( te > t)

Definition at line 545 of file macro.c.

References _, MacroBuf_s::depth, and fprintf().

if ( mb->  depth,
 
)

Definition at line 554 of file macro.c.

References choplen, and MacroBuf_s::depth.

if ( (shf=popen(buf,"r"))  = NULL)

Definition at line 714 of file macro.c.

if ( me  )

Definition at line 1000 of file macro.c.

References _free(), and NULL.

if ( ++mb->  depth,
max_macro_depth   
)

Definition at line 1707 of file macro.c.

References _, MacroBuf_s::depth, MacroBuf_s::expand_trace, max_macro_depth, rpmlog(), and RPMLOG_ERR.

int isCompressed ( const char *  file,
rpmCompressedMagic compressed 
)

Return type of compression used in file.

Parameters
filename of file
Return values
compressedaddress of compression type
Returns
0 on success, 1 on I/O error

Definition at line 3045 of file macro.c.

References _, COMPRESSED_7ZIP, COMPRESSED_BZIP2, COMPRESSED_LRZIP, COMPRESSED_LZIP, COMPRESSED_LZMA, COMPRESSED_LZOP, COMPRESSED_NOT, COMPRESSED_OTHER, COMPRESSED_XZ, COMPRESSED_ZIP, Fclose(), fd, Ferror(), Fopen(), Fread(), Fstrerror(), nb, NULL, rc, rpmlog(), RPMLOG_ERR, and void.

Referenced by doFoo(), doPatch(), and doUntar().

memset ( sbuf  ,
,
(flen+1)   
)
memset ( tbuf  ,
,
(ulen+1)   
)
void pclose ( shf  )

Referenced by rpmdsLdconfig(), and rpmdsPipe().

printExpansion ( mb  ,
t  ,
mb->  t 
)
static void pushMacro ( MacroEntry mep,
const char *  n,
const char *  o,
const char *  b,
int  level 
)
static

Push new macro definition onto macro entry stack.

Parameters
mepaddress of macro entry slot
nmacro name
omacro parameters (NULL if none)
bmacro body (NULL becomes "")
levelmacro recursion level

Definition at line 960 of file macro.c.

References me, n, NULL, xmalloc, and xstrdup().

Referenced by addMacro().

qsort ( mc->  macroTable,
mc->  firstFree,
sizeof(mc->macroTable[0])  ,
compareMacroName   
)
return ( nread  ,
0?buf:NULL   
)
return ( const char *  )

Pre-print macro expression to be expanded.

Parameters
mbmacro expansion state
scurrent expansion string
seend of string

Definition at line 484 of file macro.c.

char* rpmCleanPath ( char *  path)

Canonicalize file path.

Note
Path canonicalization always removes the pesky trailing '/'.
Parameters
pathpath to canonicalize (in-place)
Returns
pointer to path

Definition at line 3279 of file macro.c.

References NULL, path, s, se, t, and te.

Referenced by db3open(), doLookup(), relocateFileList(), rpmGetPath(), rpmioAccess(), and rpmQueryVerify().

int rpmDefineMacro ( MacroContext  mc,
const char *  macro,
int  level 
)

Define macro in context.

Parameters
mcmacro context (NULL uses global context).
macromacro name, options, body
levelmacro recursion level (0 is entry API)
Returns
Todo:
Document.

Definition at line 2789 of file macro.c.

References alloca(), MacroBuf_s::mc, memset(), rpmGlobalMacroContext, and void.

Referenced by ftsCacheUpdate(), main(), rpmcliAllArgCallback(), rpmioAllArgCallback(), rpmLoadMacroFile(), and rpmmc_add().

void rpmDumpMacroTable ( MacroContext  mc,
FILE *  fp 
)

Print macros to file stream.

Parameters
mcmacro context (NULL uses global context).
fpfile stream (NULL uses stderr).

Definition at line 285 of file macro.c.

References _, fprintf(), i, me, NULL, and rpmGlobalMacroContext.

Referenced by rpmShowRC(), and while().

char* rpmExpand ( const char *  arg,
  ... 
)

Return (malloc'ed) concatenated macro expansion(s).

Parameters
argmacro(s) to expand (NULL terminates list)
Returns
macro expansion (malloc'ed)

Definition at line 3178 of file macro.c.

References _macro_BUFSIZ, bufn, expandMacros(), NULL, s, stpcpy(), t, te, void, xmalloc, xrealloc, and xstrdup().

Referenced by _GetPass(), addChangelog(), archScore(), checkForValidArchitectures(), checkUnpackagedFiles(), cpio_doio(), dbiTagsInit(), debevrfmtTag(), debmd5sumsTag(), defaultMachine(), doPatch(), doPrimary(), doSetupMacro(), fillOutMainPackage(), Fopen(), for(), formatValue(), getMachineInfo(), headerMacrosLoad(), headerMacrosUnload(), headerSprintf(), i18nTag(), if(), initGlobs(), initSourceHeader(), lookupPackage(), main(), makeGPGSignature(), Open(), open_dso(), packageBinaries(), packageSources(), parseBuildInstallClean(), parseForRegexLang(), parseForSimple(), parsePreamble(), parseSpec(), prepFetch(), processBinaryFiles(), processSourceFiles(), rdToken(), readLine(), Realpath(), rpmCheckPassPhrase(), rpmcliEvalSlurp(), rpmcliImportPubkeys(), rpmcliInstallElementPath(), rpmcliQuery(), rpmdbExportL10N_SQL(), rpmdbNew(), rpmdcParseZeroInstall(), rpmdsCpuinfo(), rpmdsEVRorder(), rpmdsLdconfig(), rpmdsPipe(), rpmdsSysinfo(), rpmEVRmire(), rpmEVRorder(), rpmExpandNumeric(), rpmfcClassify(), rpmfcExec(), rpmfcExpandAppend(), rpmfcExpandRegexps(), rpmfcGenerateDependsHelper(), rpmfcSCRIPT(), rpmgiNext(), rpmgiOpen(), rpmInstallSourcePackage(), rpmioAllArgCallback(), rpmmiAddPattern(), rpmnsArch(), rpmnsParse(), rpmnsProbeSignature(), rpmperlNew(), rpmPlatform(), rpmpsmStage(), rpmpythonNew(), rpmrbLoadClasses(), rpmrbLoadFile(), rpmReadConfigFiles(), rpmReadRC(), rpmrepoDoRepoMetadata(), rpmrepoInitPopt(), rpmrepoMDExpand(), rpmRollback(), rpmShowProgress(), rpmShowRC(), rpmsqlNew(), rpmsqlRun(), rpmtsAddInstallElement(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsOpenSDB(), rpmtsRollback(), rpmtsSkipFiles(), rpmtsSolve(), rpmvtNew(), runImmedTriggers(), runInstScript(), runScript(), runTriggers(), statFormat(), strsubFormat(), tagLoadATags(), tagValidate(), unsatisfiedDepend(), urlFind(), urlGetFile(), and writeRPM().

int rpmExpandNumeric ( const char *  arg)
void rpmFreeMacros ( MacroContext  mc)

Destroy macro context.

Parameters
mcmacro context (NULL uses global context).

Definition at line 3016 of file macro.c.

References _free(), i, me, memset(), NULL, and rpmGlobalMacroContext.

const char* rpmGenPath ( const char *  urlroot,
const char *  urlmdir,
const char *  urlfile 
)

Merge 3 args into path, any or all of which may be a url.

The leading part of the first URL encountered is used for the result, other URL prefixes are discarded, permitting a primitive form of URL inheiritance.

Parameters
urlrootroot URL (often path to chroot, or NULL)
urlmdirdirectory URL (often a directory, or NULL)
urlfilefile URL (often a file, or NULL)
Returns
expanded, merged, canonicalized path (malloc'ed)

Definition at line 3417 of file macro.c.

References _free(), alloca(), file, fprintf(), NULL, result, rpmGetPath(), strncpy(), t, URL_IS_DASH, and urlPath().

Referenced by addSource(), createDir(), db3close(), db3open(), db_init(), doIcon(), doPatch(), doScript(), doSetupMacro(), doUntar(), for(), handlePreambleTag(), prepFetch(), processBinaryFile(), processMetadataFile(), processPackageFiles(), rpmdsNew(), rpmfcGenerateDepends(), rpmfiNew(), rpmpsmStage(), rpmrepoInitPopt(), rpmTempFile(), sql_close(), sql_initDB(), and sql_open().

int rpmGetMacroEntries ( MacroContext  mc,
void _mire,
int  used,
const char ***  avp 
)

Return macro entries as string array.

Parameters
mcmacro context (NULL uses global context)
_mirepattern to match (NULL disables)
usedmacro usage (<0 all, =0 unused, >=1 used count)
Return values
*avpmacro definitions
Returns
no. of entries

Definition at line 319 of file macro.c.

References ac, av, dupMacroEntry(), i, me, mireRegexec(), NULL, rpmGlobalMacroContext, xcalloc(), and xrealloc.

Referenced by packageSources(), rpmmc_list(), and rpmtsFini().

char* rpmGetPath ( const char *  path,
  ... 
)
int rpmGlob ( const char *  patterns,
int argcPtr,
const char ***  argvPtr 
)

Return URL path(s) from a (URL prefixed) pattern glob.

Parameters
patternsglob pattern
Return values
*argcPtrno. of paths
*argvPtrarray of paths (malloc'd contiguous blob)
Returns
0 on success XXX FIXME: rpmRC return?

Definition at line 2547 of file macro.c.

References _free(), ac, argv, av, exit, fprintf(), glob_t::gl_pathc, glob_t::gl_pathv, Glob(), Glob_error(), Glob_pattern_p(), GLOB_TILDE, Globfree(), i, j, nb, NULL, path, rc, setlocale, strncpy(), t, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), void, xmalloc, XpoptParseArgvString(), xrealloc, and xstrdup().

Referenced by for(), IDTXglob(), processBinaryFile(), rpmcliInstallElementPath(), rpmgiGlobArgv(), rpmInitMacros(), rpmioInit(), rpmLoadMacroFile(), and rpmReadPackageManifest().

void rpmInitMacros ( MacroContext  mc,
const char *  macrofiles 
)

Initialize macro context from set of macrofile(s).

Parameters
mcmacro context
macrofilescolon separated list of macro files (NULL does nothing)

Definition at line 2930 of file macro.c.

References _free(), _max_load_depth, _suffix, ac, av, i, m, me, NULL, RMIL_CMDLINE, rpmCLIMacroContext, rpmGlob(), rpmGlobalMacroContext, rpmLoadMacroFile(), rpmLoadMacros(), rpmlog(), RPMLOG_WARNING, rpmSecuritySaneFile(), void, xmalloc, and xstrdup().

Referenced by rpmmc_init_macros(), and rpmReadRC().

int rpmLoadMacroFile ( MacroContext  mc,
const char *  fn,
int  nesting 
)

Load macro context from a macro file.

Parameters
mc(unused)
fnmacro file name
nestingmax load recursion depth, 0 disables.

Definition at line 2851 of file macro.c.

References _, _free(), _macro_BUFSIZ, _MAX_MACRO_DEPTH, alloca(), argv, buf, c, exit, Fclose(), fd, Ferror(), Fopen(), i, max_macro_depth, NULL, rc, RMIL_MACROFILES, rpmDefineMacro(), rpmGlob(), rpmLoadMacroFile(), rpmlog(), RPMLOG_WARNING, rpmMCExpand(), s, SKIPBLANK, void, and xx.

Referenced by rpmInitMacros(), rpmLoadMacroFile(), rpmmc_load_macro_file(), and while().

void rpmLoadMacros ( MacroContext  mc,
int  level 
)

Load macros from specific context into global context.

Parameters
mcmacro context (NULL does nothing).
levelmacro recursion level (0 is entry API)

Definition at line 2811 of file macro.c.

References addMacro(), i, me, NULL, and rpmGlobalMacroContext.

Referenced by rpmInitMacros().

rpmlog ( RPMLOG_ERR  ,
"%s\n"  ,
buf   
)

Referenced by _rpmtsCheck(), _rpmtsRun(), _specQuery(), addChangelog(), addFile(), addFileToTagAux(), addMacro(), addSource(), build(), buildHost(), buildSpec(), cacheStashLatest(), checkForDuplicates(), checkForRequired(), checkForValidArchitectures(), checkOwners(), checkPackages(), checkUnpackagedFiles(), copyFile(), copyNextLineFromOFI(), cpio_copy(), cpio_doio(), createDir(), db3close(), db3open(), db_fini(), db_init(), dbiFindMatches(), dbiMireKeys(), dbiOpen(), dnlInitIterator(), doAddSubtract(), doFoo(), doIcon(), doLogical(), doMultiplyDivide(), doPatch(), doPatchMacro(), doPrimary(), doRelational(), doSetupMacro(), doUntar(), expandMacros(), Fadvise(), Fallocate(), fiIntersect(), findErases(), findPreambleTag(), flushBuffer(), for(), fsmMapAttrs(), fsmMkdirs(), fsmStage(), genCpioListAndHeader(), getFilesystemList(), getGidS(), getGname(), getGnameS(), getOutputFrom(), getUidS(), getUname(), getUnameS(), grabArgs(), handlePreambleTag(), headerCheck(), IDTXglob(), if(), initGlobs(), installArgCallback(), iosmMapAttrs(), iosmMkdirs(), iosmStage(), isCompressed(), main(), makeGPGSignature(), makeHDRSignature(), manageFile(), miFreeHeader(), mireRegcomp(), mireRegexec(), mireStudy(), packageBinaries(), parseBuildInstallClean(), parseDescription(), parseExpressionBoolean(), parseExpressionString(), parseFiles(), parseForAttr(), parseForConfig(), parseForDev(), parseForLang(), parseForSimple(), parseForVerify(), parseNoSource(), parsePreamble(), parsePrep(), parseRCPOT(), parseScript(), parseSpec(), pkgUnpackagedSubdirs(), prepFetch(), prepFetchVerbose(), printDeps(), printSize(), processBinaryFile(), processBinaryFiles(), processMetadataFile(), processPackageFiles(), processScriptFiles(), processSourceFiles(), psmWait(), queryHeader(), rdToken(), readFile(), readLine(), readLineFromOFI(), relocateFileList(), removeSillyDeps(), rpmalAllFileSatisfiesDepend(), rpmCheckPassPhrase(), rpmcliImportPubkeys(), rpmcliInstall(), rpmcliInstallProblems(), rpmcliInstallSuggests(), rpmcliSign(), rpmdbCheckSignals(), rpmdbCount(), rpmdbExportHR_MIB(), rpmdbNew(), rpmdbRemove(), rpmdsCompare(), rpmdsNotify(), rpmdsProblem(), rpmErase(), rpmEVRcompare(), rpmfcApply(), rpmfcClassify(), rpmfcExpandRegexps(), rpmfcGenerateDependsHelper(), rpmfcHelper(), rpmfcMatchRegexps(), rpmfiDecideFate(), rpmGetFilesystemUsage(), rpmgiInitFilter(), rpmgiLoadReadHeader(), rpmgiNext(), rpmgiOpen(), rpmgiWalkPathFilter(), rpmInitMacros(), rpmInstallSource(), rpmInstallSourcePackage(), rpmioAllArgCallback(), rpmioFreePool(), rpmioInit(), rpmioMkpath(), rpmioNewPool(), rpmLoadMacroFile(), rpmmgBuffer(), rpmmgFile(), rpmmgNew(), rpmmiNext(), rpmMkdirPath(), rpmpsmStage(), rpmQueryVerify(), rpmReadHeaders(), rpmReadPackageFile(), rpmReadPackageManifest(), rpmReSign(), rpmRollback(), rpmShowProgress(), rpmSingleHeaderFromFD(), rpmspecQuery(), rpmTempFile(), rpmts_Die(), rpmtsAddInstallElement(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsCheckInstalledFiles(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsInitDSI(), rpmtsOpenDB(), rpmtsOpenSDB(), rpmtsPrepare(), rpmtsProcess(), rpmtsRebuildDB(), rpmtsRollback(), rpmtsSanityCheck(), rpmtsSkipFiles(), rpmtsSolve(), rpmuuidMake(), rpmVerifySignatures(), rpmvfVerify(), rpmWriteHeaders(), runScript(), showQueryPackage(), showVerifyPackage(), sql_busy_handler(), sql_cdel(), sql_cget(), sql_close(), sql_cput(), sql_open(), tagValidate(), timeCheck(), urlConnect(), urlGetFile(), urlSplit(), verifyDependencies(), while(), writeRPM(), wrSignature(), and Xcvtdberr().

char* rpmMCExpand ( MacroContext  mc,
const char *  arg,
  ... 
)

Return (malloc'ed) concatenated macro expansion(s) in a context.

Parameters
mcmacro context
argmacro(s) to expand (NULL terminates list)
Returns
macro expansion (malloc'ed)

Definition at line 3215 of file macro.c.

References _macro_BUFSIZ, bufn, expandMacros(), NULL, s, stpcpy(), t, te, void, xmalloc, xrealloc, and xstrdup().

Referenced by rpmLoadMacroFile(), and rpmmc_expand().

int rpmSecuritySaneFile ( const char *  filename)

Check whether configuration file is moderately secure to load.

Parameters
filenamefilename to check
Returns
1 on success, 0 on failure XXX FIXME: rpmRC return?

Definition at line 2524 of file macro.c.

Referenced by for(), rpmInitMacros(), and rpmioInit().

int rpmUndefineMacro ( MacroContext  mc,
const char *  macro 
)

Undefine macro in context.

Parameters
mcmacro context (NULL uses global context).
macromacro name
Returns
Todo:
Document.

Definition at line 2803 of file macro.c.

References rpmGlobalMacroContext, and void.

Referenced by rpmcliAllArgCallback(), rpmioAllArgCallback(), and rpmmc_del().

sortMacroTable ( mc  )

Referenced by addMacro(), and delMacro().

return strcmp ( ame->  name,
bme->  name 
)

Referenced by addFile(), addMacro(), addReqProv(), argvCmp(), cacheWalkPathFilter(), checkPackageDeps(), checkResponse(), chkSuffix(), Chroot(), cmpArgvStr(), cmpItem(), compareFileListRecs(), cpioStrCmp(), dateToTimet(), dncmp(), doPatchMacro(), doRelational(), extractRegular(), FDGSkip(), Fdopen(), fiIntersect(), findErases(), findTag(), Fopen(), for(), fsmMkdirs(), fsmSetup(), fsmStage(), genCpioListAndHeader(), getFilesystemList(), getGidS(), getGnameS(), getHostAddress(), getUidS(), getUnameS(), gnameToGid(), handleOverlappedFiles(), handlePreambleTag(), hashEqualityString(), headerSprintf(), httpReq(), IDTXglob(), indexcmp(), iosmMkdirs(), iosmSetup(), iosmStage(), iosmStrCmp(), langCmp(), lookupInCanonTable(), lookupInDefaultTable(), lookupPackage(), main(), nwlookupTag(), packagedDir(), parseDescription(), parseForConfig(), parseForSimple(), parseForVerify(), parseScript(), parseSimplePart(), parseSpec(), pkgUnpackagedSubdirs(), PRCOSkip(), prepFetch(), providePackageNVR(), relocateFileList(), Rename(), rpmalAllFileSatisfiesDepend(), rpmcliEvalSlurp(), rpmdcName2Algo(), rpmdcParseCoreutils(), rpmdcParseZeroInstall(), rpmdcPrintFile(), rpmdsCompare(), rpmdsCpuinfo(), rpmdsCpuinfoCtagFlags(), rpmdsELF(), rpmdsFind(), rpmdsNAcmp(), rpmdsNotify(), rpmdsSearch(), rpmdsUname(), rpmfcGenerateDepends(), rpmfcGenerateScriptletDeps(), rpmfcSCRIPT(), rpmfiCompare(), rpmfiDecideFate(), rpmfiNew(), rpmGetFilesystemUsage(), rpmgiWalkPathFilter(), rpmHeadersIdentical(), rpmhookTableFindBucket(), rpmioAccess(), rpmioInit(), rpmkuPassPhrase(), rpmmiAddPattern(), rpmnsArch(), rpmpkgCheck(), rpmpkgRead(), rpmpkgSizeof(), rpmpkgWrite(), rpmpsmStage(), rpmpythonRunFile(), rpmpythonSlurp(), rpmrepoDoRepoMetadata(), rpmrepoTestSetupDirs(), rpmSetMachine(), rpmsqlRun(), rpmsxMatch(), rpmts_setattro(), rpmtsAddInstallElement(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsEraseDebuginfo(), rpmtsPrepare(), rpmtsSanityCheck(), rpmtsSkipFiles(), rpmvfVerify(), rpmxarPull(), rpmxarPush(), runImmedTriggers(), runScript(), runTriggers(), runTriggersLoop(), sameProblem(), singleSprintf(), sql_step(), stashSt(), str2uuid(), sugcmp(), tagCmpName(), ufdOpen(), unameToUid(), unsatisfiedDepend(), urlGetFile(), urlStrcmp(), while(), wnlookupTag(), writeRPM(), and xarMode().

strncpy ( sbuf  ,
f  ,
flen   
)
strncpy ( u  ,
tbuf  ,
(ulen-mb->nb+1)   
)
strncpy ( buf  ,
cmd  ,
clen   
)
strncpy ( buf  ,
msg  ,
msglen   
)
while ( size  ,
 
)
while ( (c=*p++)!  = '\0')

Definition at line 474 of file macro.c.

References p.

while ( ((char)(mb->t[-1])== '\n'||(char)(mb->t[-1])== '\r')  )

Definition at line 721 of file macro.c.

References MacroBuf_s::nb, and MacroBuf_s::t.

while ( ((c)=(int)*(s))&&((char)(c)== ' '||(char)(c)== '\t')  )

Definition at line 750 of file macro.c.

while ( ((c)=(int)*(s))&&(xisalnum(c)||(c)==(int) '_')  ) { while ((( c ) = (int) *( s )) && ((char)( c ) == ' ' || (char)( c ) == '\t')) ( s )++

Definition at line 881 of file macro.c.

while ( rc  = = 0 && mb->nb,
0 &&(c=(int)*s)!  = (int)'\0' 
)
static int XpoptDupArgv ( int  argc,
char **  argv,
int argcPtr,
char ***  argvPtr 
)
static

< missing argument

< missing argument

< memory allocation failed

Definition at line 1527 of file macro.c.

References i, NULL, POPT_ERROR_MALLOC, POPT_ERROR_NOARG, and xmalloc.

Referenced by XpoptParseArgvString().

static int XpoptParseArgvString ( const char *  s,
int argcPtr,
char ***  argvPtr 
)
static

< memory allocation failed

< error in paramter quoting

< error in paramter quoting

Definition at line 1567 of file macro.c.

References alloca(), argv, buf, exit, memset(), NULL, POPT_ARGV_ARRAY_GROW_DELTA, POPT_ERROR_BADQUOTE, POPT_ERROR_MALLOC, rc, xmalloc, and XpoptDupArgv().

Referenced by rpmGlob().

Variable Documentation

if(*)( c )s ('){s++;o=oe;{while(((oc)=(int)*(s))&&(oc)!=(int) ')')*(oe)++=*(s)++;*(oe)= '\0';};s++;}b=be=oe+1;while(((c)=(int)*(s))&&((char(')

Definition at line 762 of file macro.c.

References COPYOPTS, and oe.

int _debug = 0
static

Definition at line 2545 of file macro.c.

size_t _macro_BUFSIZ = 16 * 1024
static

Definition at line 173 of file macro.c.

Referenced by doFoo(), grabArgs(), rpmExpand(), rpmGetPath(), rpmLoadMacroFile(), and rpmMCExpand().

int _max_load_depth = 2

Definition at line 166 of file macro.c.

Referenced by rpmInitMacros(), and while().

char* b
int bc = 0

Definition at line 412 of file macro.c.

Referenced by copyNextLineFromOFI(), and rpmbcInit().

char * be
MacroEntry bme = *((MacroEntry *)bp)

Definition at line 197 of file macro.c.

char * buf = (char *) alloca(bufn)
const char* size_t bufn = _macro_BUFSIZ

Parse (and execute) new macro definition.

Parameters
mbmacro expansion state
semacro definition to parse
levelmacro recursion level
expandbodyshould body be expanded?
Returns
address to continue parsing

Definition at line 742 of file macro.c.

Referenced by rpmExpand(), and rpmMCExpand().

int c
Initial value:
{
int lvl = 0

Return text between pl and matching pr characters.

Parameters
pstart of text
plleft char, i.e. '[', '(', '{', etc.
prright char, i.e. ']', ')', '}', etc.
Returns
address of last char before pr (or NULL)

Definition at line 470 of file macro.c.

Referenced by __crc32(), __crc64(), _tagCanonicalize(), argvSplit(), cvtfmode(), doFoo(), dpkgEVRctype(), FDGsqlTag(), FDGxmlTag(), FDGyamlTag(), ftpOpendir(), Glob_pattern_p(), grabArgs(), intFormat(), isPart(), jsonFormat(), jsonstrcpy(), jsonstrlen(), mireDup(), parseBits(), parseFormat(), PRCOsqlTag(), PRCOxmlTag(), PRCOyamlTag(), rpmdcParseCoreutils(), rpmioParse(), rpmLoadMacroFile(), rpmRebuildTargetVars(), shescapeFormat(), sqlstrcpy(), sqlstrlen(), stemEnd(), strunvis(), strvis(), sum32Digest(), sum64Digest(), unvis(), xmlstrcpy(), xmlstrlen(), yamlFormat(), yamlstrcpy(), and yamlstrlen().

int chkexist

Definition at line 1705 of file macro.c.

int choplen

Definition at line 543 of file macro.c.

Referenced by if().

mb depth

Definition at line 2516 of file macro.c.

Referenced by next_brace_sub().

do
Initial value:
{
*(++q) = '\0'
q
Definition: macro.c:451

Definition at line 416 of file macro.c.

ellipsis = ""

Definition at line 553 of file macro.c.

Referenced by fmtDBT().

const char * f = fdGetFILE(fd)
const char * fe
size_t fn
const char* g

Definition at line 1697 of file macro.c.

Referenced by rpmdsCpuinfo(), rpmdsLdconfig(), rpmdsPipe(), rpmdsSysinfoFile(), while(), and xarGid().

const char * ge

Definition at line 1697 of file macro.c.

Referenced by rpmdsCpuinfo(), rpmdsLdconfig(), rpmdsPipe(), and rpmdsSysinfoFile().

size_t gn

Definition at line 1698 of file macro.c.

Referenced by doFoo(), and while().

int i

Definition at line 1023 of file macro.c.

int
static
Initial value:
{
MacroEntry ame = *((MacroEntry *)ap)
struct MacroEntry_s * MacroEntry
Definition: rpmmacro.h:12

Compare macro entries by name (qsort/bsearch).

Parse args and string for PHP like %{foo <args> : <string> } syntax.

Expand output of shell command into target buffer.

Save source/target and expand macro in u.

Save source and expand field into target.

Parameters
ap1st macro entry
bp2nd macro entry
Returns
result of comparison
Parameters
mbmacro expansion state
ffield
flenno. bytes in field
Returns
result of expansion
Parameters
mbmacro expansion state
uinput macro, output expansion
ulenno. bytes in u buffer
Returns
result of expansion
Parameters
mbmacro expansion state
cmdshell command
clenno. bytes in shell command
Returns
result of expansion
Parameters
s"{ ... }" construct to parse
nbno. of bytes
Return values
*avpinvocation args
Returns
script string The main macro recursion loop.
Todo:
Dynamically reallocate target buffer.
Parameters
mbmacro expansion state
Returns
0 on success, 1 on failure

Definition at line 195 of file macro.c.

char * key = (MacroEntry) memset(alloca(sizeof(*key)), 0, sizeof(*key))
const char* lastc

Definition at line 1704 of file macro.c.

Referenced by while().

int max_macro_depth = 16

Definition at line 154 of file macro.c.

Referenced by if(), and rpmLoadMacroFile().

char * n = buf
key name = (char *)name

Definition at line 385 of file macro.c.

mb nb = 0

fgets(3) analogue that reads \ continuations.

Last newline always trimmed.

Parameters
bufinput buffer
sizeinbut buffer size (bytes)
fdfile handle
Returns
buffer, or NULL on end-of-file

Definition at line 409 of file macro.c.

Referenced by __crc32_combine(), __crc64_combine(), _tagCanonicalize(), _tagGenerate(), addFile(), argvJoin(), arHeaderRead(), arHeaderWrite(), arRead(), arSetup(), arWrite(), bncdataFormat(), cdataFormat(), copyEntry(), cpio_copy(), cpioHeaderRead(), cpioHeaderWrite(), cpioRead(), cpioTrailerWrite(), cpioWrite(), db3open(), dbiMireKeys(), debevrfmtTag(), debmd5sumsTag(), doIcon(), doLookup(), dupMacroEntry(), ensureOlder(), fdFgets(), FDGsqlTag(), FDGxmlTag(), FDGyamlTag(), fmtDBT(), for(), formatValue(), fsmFsPath(), handleOneTrigger(), hdrUnload(), headerCheck(), headerLoad(), hGetNVRA(), i18nTag(), intFormat(), iosmFsPath(), isCompressed(), jsonFormat(), mireDup(), missingokTag(), needswhatTag(), Open(), pgpGrab(), pgpMpiHex(), pgpsigFormat(), PRCOsqlTag(), PRCOxmlTag(), PRCOyamlTag(), providePackageNVR(), queryArgCallback(), rdLead(), rdSignature(), rpmbcSetRSA(), rpmcliAllArgCallback(), rpmcliImportPubkey(), rpmdcPrintCoreutils(), rpmdcPrintFile(), rpmdcPrintZeroInstall(), rpmdsDup(), rpmdsDupArgv(), rpmdsNewDNEVR(), rpmdsNVRMatchesDep(), rpmdsThis(), rpmEVRparse(), rpmfi_FDigest_get(), rpmfiBuildFClasses(), rpmfiBuildFDeps(), rpmfiNew(), rpmGetPath(), rpmgiEscapeSpaces(), rpmGlob(), rpmheRealloc(), rpmmgFile(), rpmProblemString(), rpmpsmStage(), rpmReadHeader(), rpmReadPackageFile(), rpmrepoInitPopt(), rpmrepoOpenMDFile(), rpmrepoProgress(), rpmrepoReadHeader(), rpmrepoRfileDigest(), rpmrfileXMLWrite(), rpmsqlRun(), rpmteColorDS(), rpmWriteHeader(), shescapeFormat(), spewescapeFormat(), sql_step(), statFormat(), strsubFormat(), tagSwab(), tarHeaderRead(), tarHeaderReadName(), tarHeaderWrite(), tarRead(), tarWrite(), unsatisfiedDepend(), urlStrdup(), verifyDependencies(), vrpmlog(), whatneedsTag(), writeFile(), writeRPM(), xarRead(), xmlFormat(), and yamlFormat().

int ndeleted = 0

Definition at line 1022 of file macro.c.

char * ne = n

Definition at line 744 of file macro.c.

Referenced by checkResponse(), ftpNLST(), headerLoad(), headerRemoveEntry(), Link(), and Rename().

int negate

Definition at line 1702 of file macro.c.

Referenced by doFoo(), rpmioAccess(), and while().

size_t nread = 0

Definition at line 410 of file macro.c.

static PyObject *rpmdsObject * o = NULL
int oc = (int) ')'
oe = ne + 1
p = buf
int pc = 0

Definition at line 412 of file macro.c.

Referenced by copyNextLineFromOFI().

int print_expand_trace = 0

Definition at line 162 of file macro.c.

Referenced by expandMacros(), and while().

int print_macro_trace = 0

Definition at line 158 of file macro.c.

Referenced by expandMacros(), and while().

if q * q = '\n'
return rc = expandMacro(mb)

Definition at line 614 of file macro.c.

return ret
return

Definition at line 200 of file macro.c.

MacroContext rpmCLIMacroContext = &rpmCLIMacroContext_s
struct MacroContext_s rpmCLIMacroContext_s
static

Definition at line 125 of file macro.c.

MacroContext rpmGlobalMacroContext = &rpmGlobalMacroContext_s
struct MacroContext_s rpmGlobalMacroContext_s
static

Definition at line 120 of file macro.c.

mb s = mb->s

Definition at line 613 of file macro.c.

sbuf[flen] = (char *) alloca(flen + 1)

Definition at line 616 of file macro.c.

Referenced by expandMacros().

const char * se
FILE* shf

Definition at line 704 of file macro.c.

size = nb

Definition at line 452 of file macro.c.

int stackarray

Definition at line 1703 of file macro.c.

* mb t = mb->t

Definition at line 666 of file macro.c.

tbuf[ulen] = (char *) alloca(ulen + 1)

Definition at line 668 of file macro.c.

Referenced by expandMacros(), and rpmdsNewDNEVR().

te
static void
static
Initial value:
{
if (mc->macroTable == NULL) {
mc->macrosAllocated = 16 ;
mc->macroTable = (MacroEntry *)
xmalloc(sizeof(*mc->macroTable) * mc->macrosAllocated);
mc->firstFree = 0;
} else {
mc->macrosAllocated += 16 ;
mc->macroTable = (MacroEntry *)
xrealloc(mc->macroTable, sizeof(*mc->macroTable) *
mc->macrosAllocated);
}
memset(&mc->macroTable[mc->firstFree], 0, 16 * sizeof(*(mc->macroTable)))
memset(_r, 0, sizeof(*_r))
return NULL
Definition: poptALL.c:613
#define xmalloc
Definition: system.h:32
struct MacroEntry_s * MacroEntry
Definition: rpmmacro.h:12
#define xrealloc
Definition: system.h:35

Enlarge macro table.

Perform macro message output.

Free parsed arguments for parameterized macro.

Pop macro definition from macro entry stack.

Post-print expanded macro expression.

Sort entries in macro table.

Parameters
mcmacro context
mbmacro expansion state
tcurrent expansion string result
teend of string
mepaddress of macro entry slot
mbmacro expansion state
mbmacro expansion state
waserroruse rpmError()?
msgmessage to ouput
msglenno. of bytes in message

Definition at line 215 of file macro.c.

Referenced by doFoo(), isCompressed(), rpmDefineMacro(), rpmExpand(), rpmGetPath(), rpmGlob(), rpmInitMacros(), rpmLoadMacroFile(), rpmMCExpand(), and rpmUndefineMacro().