[augeas-devel] augeas: master - * src/augtool.c: new 'load' command
David Lutterkort
lutter at fedoraproject.org
Fri Mar 20 00:04:28 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=0165997a1c91eaba627b4ad5e92a5cc6f44ea789
Commit: 0165997a1c91eaba627b4ad5e92a5cc6f44ea789
Parent: 6b936936d3387c5bd378b347388b75309d5535ae
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Tue Mar 17 23:20:30 2009 -0700
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Mar 19 10:41:40 2009 -0700
* src/augtool.c: new 'load' command
---
src/augtool.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/augtool.c b/src/augtool.c
index 2e7ba6a..af6b0df 100644
--- a/src/augtool.c
+++ b/src/augtool.c
@@ -239,6 +239,22 @@ static int cmd_save(ATTRIBUTE_UNUSED char *args[]) {
return r;
}
+static int cmd_load(ATTRIBUTE_UNUSED char *args[]) {
+ int r;
+ r = aug_load(aug);
+ if (r == -1) {
+ printf("Loading failed\n");
+ } else {
+ r = aug_match(aug, "/augeas/events/saved", NULL);
+ if (r > 0) {
+ printf("Saved %d file(s)\n", r);
+ } else if (r < 0) {
+ printf("Error during match: %d\n", r);
+ }
+ }
+ return r;
+}
+
static int cmd_ins(char *args[]) {
const char *label = args[0];
const char *where = args[1];
@@ -373,6 +389,9 @@ static const struct command const commands[] = {
"Save all pending changes to disk. For now, files are not overwritten.\n"
" Instead, new files with extension .augnew are created"
},
+ { "load", 0, 0, cmd_load, "load",
+ "Load files accordig to the transforms in /augeas/load."
+ },
{ "help", 0, 0, cmd_help, "help",
"Print this help text"
},
More information about the augeas-devel
mailing list