rpm
5.4.15
|
#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmlog.h>
#include <argv.h>
#include <rpmaug.h>
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | _RPMIOB_INTERNAL |
#define | _RPMAUG_INTERNAL |
#define | SEP '/' |
#define | DATADIR "/usr/share" |
#define | AUGEAS_LENS_DIR DATADIR "/augeas/lenses" |
#define | AUGEAS_LENS_DIST_DIR DATADIR "/augeas/lenses/dist" |
#define | PATH_SEP_CHAR ':' |
#define | ARGMINMAX(_min, _max) (int)(((_min) << 8) | ((_max) & 0xff)) |
Functions | |
static void | rpmaugFini (void *_aug) |
static rpmaug | rpmaugGetPool (rpmioPool pool) |
rpmaug | rpmaugNew (const char *root, const char *loadpath, unsigned int flags) |
Create and load a augeas wrapper. More... | |
int | rpmaugDefvar (rpmaug aug, const char *name, const char *expr) |
Define an augeas variable. More... | |
int | rpmaugDefnode (rpmaug aug, const char *name, const char *expr, const char *value, int *created) |
Define an augeas node. More... | |
int | rpmaugGet (rpmaug aug, const char *path, const char **value) |
Get the value associated with a path. More... | |
int | rpmaugSet (rpmaug aug, const char *path, const char *value) |
Set the value associated with a path. More... | |
int | rpmaugInsert (rpmaug aug, const char *path, const char *label, int before) |
Insert new sibling node before/after a given node. More... | |
int | rpmaugRm (rpmaug aug, const char *path) |
Remove node and associated sub-tree. More... | |
int | rpmaugMv (rpmaug aug, const char *src, const char *dst) |
Move src node to dst node. More... | |
int | rpmaugMatch (rpmaug aug, const char *path, char ***matches) |
Return path(s) in tree that match an expression. More... | |
int | rpmaugSave (rpmaug aug) |
Save changed files to disk, appending .augnew or .augsave as requested. More... | |
int | rpmaugLoad (rpmaug aug) |
Load files/lenses from disk. More... | |
int | rpmaugPrint (rpmaug aug, FILE *out, const char *path) |
Print node paths that match an expression. More... | |
void | rpmaugFprintf (rpmaug aug, const char *fmt,...) |
Append augeas output to an iob. More... | |
static char * | cleanstr (char *path, const char sep) |
static char * | cleanpath (char *path) |
static void | err_check (void) |
static char * | ls_pattern (const char *path) |
static int | child_count (const char *path) |
static int | cmd_quit (int ac, char *av[]) |
static int | cmd_ls (int ac, char *av[]) |
static int | cmd_match (int ac, char *av[]) |
static int | cmd_rm (int ac, char *av[]) |
static int | cmd_mv (int ac, char *av[]) |
static int | cmd_set (int ac, char *av[]) |
static int | cmd_defvar (int ac, char *av[]) |
static int | cmd_defnode (int ac, char *av[]) |
static int | cmd_clear (int ac, char *av[]) |
static int | cmd_get (int ac, char *av[]) |
static int | cmd_print (int ac, char *av[]) |
static int | cmd_save (int ac, char *av[]) |
static int | cmd_load (int ac, char *av[]) |
static int | cmd_ins (int ac, char *av[]) |
static int | cmd_help (int ac, char *av[]) |
rpmRC | rpmaugRun (rpmaug aug, const char *str, const char **resultp) |
Run augeas commands from a buffer. More... | |
Variables | |
int | _rpmaug_debug = 0 |
rpmaug | _rpmaugI = NULL |
rpmioPool | _rpmaugPool = NULL |
static const char | _root [] = "/" |
const char * | _rpmaugRoot = _root |
static const char | _loadpath [] = "" |
const char * | _rpmaugLoadpath = _loadpath |
unsigned int | _rpmaugFlags = 0 |
const char ** | _rpmaugLoadargv |
struct poptOption | rpmaugPoptTable [] |
Popt option table for options to configure Augeas augtool. More... | |
const struct poptOption | _rpmaugCommandTable [] |
#define ARGMINMAX | ( | _min, | |
_max | |||
) | (int)(((_min) << 8) | ((_max) & 0xff)) |
#define AUGEAS_LENS_DIR DATADIR "/augeas/lenses" |
Definition at line 358 of file rpmaug.c.
Referenced by cmd_help().
#define SEP '/' |
Definition at line 351 of file rpmaug.c.
Referenced by cleanpath(), cmd_ls(), and ls_pattern().
|
static |
Definition at line 418 of file rpmaug.c.
References err_check(), ls_pattern(), and rpmaugMatch().
Referenced by cmd_ls().
|
static |
Definition at line 380 of file rpmaug.c.
References cleanstr(), and SEP.
Referenced by cmd_clear(), cmd_defnode(), cmd_defvar(), cmd_get(), cmd_ins(), cmd_ls(), cmd_match(), cmd_mv(), cmd_print(), cmd_rm(), and cmd_set().
|
static |
|
static |
Definition at line 574 of file rpmaug.c.
References cleanpath(), err_check(), rpmaugFprintf(), and rpmaugSet().
|
static |
Definition at line 555 of file rpmaug.c.
References cleanpath(), err_check(), name, rpmaugDefnode(), and rpmaugFprintf().
|
static |
Definition at line 543 of file rpmaug.c.
References cleanpath(), err_check(), name, rpmaugDefvar(), and rpmaugFprintf().
|
static |
Definition at line 585 of file rpmaug.c.
References cleanpath(), err_check(), rpmaugFprintf(), and rpmaugGet().
|
static |
Definition at line 665 of file rpmaug.c.
References _rpmaugCommandTable, AUGEAS_LENS_DIR, and rpmaugFprintf().
|
static |
Definition at line 641 of file rpmaug.c.
References cleanpath(), err_check(), rpmaugFprintf(), and rpmaugInsert().
|
static |
Definition at line 625 of file rpmaug.c.
References err_check(), rpmaugFprintf(), rpmaugLoad(), and rpmaugMatch().
|
static |
Definition at line 436 of file rpmaug.c.
References _free(), child_count(), cleanpath(), err_check(), i, ls_pattern(), rpmaugFprintf(), rpmaugGet(), rpmaugMatch(), and SEP.
|
static |
Definition at line 466 of file rpmaug.c.
References _free(), cleanpath(), err_check(), i, pattern, rpmaugFprintf(), rpmaugGet(), and rpmaugMatch().
|
static |
Definition at line 519 of file rpmaug.c.
References cleanpath(), err_check(), rpmaugFprintf(), and rpmaugMv().
|
static |
Definition at line 601 of file rpmaug.c.
References cleanpath(), err_check(), and rpmaugPrint().
|
static |
Definition at line 507 of file rpmaug.c.
References cleanpath(), err_check(), rpmaugFprintf(), and rpmaugRm().
|
static |
Definition at line 608 of file rpmaug.c.
References err_check(), rpmaugFprintf(), rpmaugMatch(), and rpmaugSave().
|
static |
Definition at line 531 of file rpmaug.c.
References cleanpath(), err_check(), rpmaugFprintf(), and rpmaugSet().
|
static |
Definition at line 385 of file rpmaug.c.
References minor.
Referenced by child_count(), cmd_clear(), cmd_defnode(), cmd_defvar(), cmd_get(), cmd_ins(), cmd_load(), cmd_ls(), cmd_match(), cmd_mv(), cmd_print(), cmd_rm(), cmd_save(), and cmd_set().
|
static |
int rpmaugDefnode | ( | rpmaug | aug, |
const char * | name, | ||
const char * | expr, | ||
const char * | value, | ||
int * | created | ||
) |
Define an augeas node.
aug | augeas wrapper (NULL uses global interpreter) |
name | variable name |
expr | expression to be evaluated (must eval to a nodeset) |
value | initial node value (if creating) |
*created | 1 if node was created |
Definition at line 179 of file rpmaug.c.
Referenced by cmd_defnode().
int rpmaugDefvar | ( | rpmaug | aug, |
const char * | name, | ||
const char * | expr | ||
) |
Define an augeas variable.
aug | augeas wrapper (NULL uses global interpreter) |
name | variable name |
expr | expression to be evaluated |
Definition at line 165 of file rpmaug.c.
Referenced by cmd_defvar().
|
static |
Definition at line 39 of file rpmaug.c.
References _free(), and rpmiobFree().
Referenced by rpmaugGetPool().
void rpmaugFprintf | ( | rpmaug | aug, |
const char * | fmt, | ||
... | |||
) |
Append augeas output to an iob.
aug | augeas wrapper (NULL uses global interpreter) |
fmt | format to use |
Definition at line 322 of file rpmaug.c.
References _free(), b, rpmiobAppend(), vsnprintf(), xmalloc, and xrealloc.
Referenced by cmd_clear(), cmd_defnode(), cmd_defvar(), cmd_get(), cmd_help(), cmd_ins(), cmd_load(), cmd_ls(), cmd_match(), cmd_mv(), cmd_rm(), cmd_save(), cmd_set(), and rpmaugRun().
int rpmaugGet | ( | rpmaug | aug, |
const char * | path, | ||
const char ** | value | ||
) |
Get the value associated with a path.
aug | augeas wrapper (NULL uses global interpreter) |
path | path to lookup |
*value | returned value (malloc'd) |
Definition at line 194 of file rpmaug.c.
Referenced by cmd_get(), cmd_ls(), and cmd_match().
Definition at line 60 of file rpmaug.c.
References _rpmaugPool, rpmaugFini(), rpmioGetPool(), and rpmioNewPool().
Referenced by rpmaugNew().
int rpmaugInsert | ( | rpmaug | aug, |
const char * | path, | ||
const char * | label, | ||
int | before | ||
) |
Insert new sibling node before/after a given node.
aug | augeas wrapper (NULL uses global interpreter) |
path | path to node in tree |
label | label to insert |
before | insert label into tree before path? (else after) |
Definition at line 222 of file rpmaug.c.
Referenced by cmd_ins().
int rpmaugLoad | ( | rpmaug | aug | ) |
Load files/lenses from disk.
aug | augeas wrapper (NULL uses global interpreter) |
Definition at line 292 of file rpmaug.c.
Referenced by cmd_load().
int rpmaugMatch | ( | rpmaug | aug, |
const char * | path, | ||
char *** | matches | ||
) |
Return path(s) in tree that match an expression.
aug | augeas wrapper (NULL uses global interpreter) |
path | path expression to match |
*matches | paths that match |
Definition at line 264 of file rpmaug.c.
Referenced by child_count(), cmd_load(), cmd_ls(), cmd_match(), and cmd_save().
int rpmaugMv | ( | rpmaug | aug, |
const char * | src, | ||
const char * | dst | ||
) |
rpmaug rpmaugNew | ( | const char * | root, |
const char * | loadpath, | ||
unsigned int | flags | ||
) |
Create and load a augeas wrapper.
root | augeas filesystem root |
loadpath | augeas load path (colon separated) |
flags | augeas flags |
Definition at line 132 of file rpmaug.c.
References _rpmaugLoadpath, _rpmaugRoot, flags, rpmaugGetPool(), rpmaugLink(), rpmiobNew(), and xstrdup().
Referenced by expandMacro().
int rpmaugPrint | ( | rpmaug | aug, |
FILE * | out, | ||
const char * | path | ||
) |
Print node paths that match an expression.
aug | augeas wrapper (NULL uses global interpreter) |
out | ouput file (NULL uses stdout) |
path | node path expression |
Definition at line 306 of file rpmaug.c.
Referenced by cmd_print().
int rpmaugRm | ( | rpmaug | aug, |
const char * | path | ||
) |
Run augeas commands from a buffer.
aug | augeas wrapper (NULL uses global interpreter) |
str | augeas commands to run |
*resultp | output running augeas commands |
Definition at line 763 of file rpmaug.c.
References _free(), rpmioP_s::ac, argvFree(), rpmioP_s::av, rpmaugFprintf(), rpmiobStr(), rpmioParse(), RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, and rpmioP_s::str.
Referenced by expandMacro().
int rpmaugSave | ( | rpmaug | aug | ) |
Save changed files to disk, appending .augnew or .augsave as requested.
aug | augeas wrapper (NULL uses global interpreter) |
Definition at line 278 of file rpmaug.c.
Referenced by cmd_save().
int rpmaugSet | ( | rpmaug | aug, |
const char * | path, | ||
const char * | value | ||
) |
Set the value associated with a path.
aug | augeas wrapper (NULL uses global interpreter) |
path | path to lookup |
value | value |
Definition at line 208 of file rpmaug.c.
Referenced by cmd_clear(), and cmd_set().
const struct poptOption _rpmaugCommandTable[] |
Definition at line 683 of file rpmaug.c.
Referenced by cmd_help().
unsigned int _rpmaugFlags = 0 |
Definition at line 80 of file rpmaug.c.
Referenced by expandMacro().
rpmaug _rpmaugI = NULL |
Definition at line 36 of file rpmaug.c.
Referenced by rpmioClean().
const char* _rpmaugLoadpath = _loadpath |
Definition at line 79 of file rpmaug.c.
Referenced by expandMacro(), and rpmaugNew().
rpmioPool _rpmaugPool = NULL |
Definition at line 58 of file rpmaug.c.
Referenced by rpmaugGetPool(), and rpmioClean().
const char* _rpmaugRoot = _root |
Definition at line 76 of file rpmaug.c.
Referenced by expandMacro(), and rpmaugNew().