Librepo library 1.18.0
C library for downloading linux repository metadata and packages
Loading...
Searching...
No Matches
Substitution of variables in url

Data Structures

struct  LrVar
 

Typedefs

typedef GSList LrUrlVars
 

Functions

LrUrlVarslr_urlvars_set (LrUrlVars *list, const char *var, const char *value)
 
void lr_urlvars_free (LrUrlVars *list)
 
char * lr_url_substitute (const char *url, LrUrlVars *list)
 

Detailed Description

Typedef Documentation

◆ LrUrlVars

typedef GSList LrUrlVars

LrUrlVars list is in fact GSList

Definition at line 41 of file url_substitution.h.

Function Documentation

◆ lr_url_substitute()

char * lr_url_substitute ( const char *  url,
LrUrlVars list 
)

Substitute variables in the url. Returns a newly allocated string. ${var_name} and $var_name syntaxes are supported. var_name: [A-Za-z0-9_]+ Non-exsistent variables are not substituted.

Parameters
urla url
lista list of variables and its substitutions or NULL
Returns
a newly allocated string with substituted url

◆ lr_urlvars_free()

void lr_urlvars_free ( LrUrlVars list)

Frees all of the memory used by LrUrlVars.

Parameters
lista list of substitutions

◆ lr_urlvars_set()

LrUrlVars * lr_urlvars_set ( LrUrlVars list,
const char *  var,
const char *  value 
)

Set value of variable. Use variable names without '$' prefix. If value is NULL, variable will be removed from the list. If list is NULL, new list will be created.

Parameters
lista GSList or NULL for the first item
vara variable name (must not be a NULL)
valuea variable value
Returns
the new start of the GSList of url substitutions