[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - New function xfm_lens_name



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=174e416282518386aac8d29b995a4225f06d5fd3
Commit:        174e416282518386aac8d29b995a4225f06d5fd3
Parent:        d2a4672a9178d00194664a5e596894c242dd46c7
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Thu Jan 7 10:50:45 2010 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Thu Jan 7 11:45:04 2010 -0800

New function xfm_lens_name

  * src/transfrom.h (xfm_lens_name): add prototype
  * src/transform.c (xfm_lens_name): new function
---
 src/transform.c |   10 ++++++++++
 src/transform.h |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/transform.c b/src/transform.c
index 2b8677d..bd762c1 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -462,6 +462,16 @@ static struct lens *lens_from_name(struct augeas *aug, const char *name) {
     return NULL;
 }
 
+const char *xfm_lens_name(struct tree *xfm) {
+    struct tree *l = tree_child(xfm, s_lens);
+
+    if (l == NULL)
+        return "(unknown)";
+    if (l->value == NULL)
+        return "(noname)";
+    return l->value;
+}
+
 static struct lens *xfm_lens(struct augeas *aug, struct tree *xfm) {
     struct tree *l = NULL;
 
diff --git a/src/transform.h b/src/transform.h
index 1178f64..567d5b3 100644
--- a/src/transform.h
+++ b/src/transform.h
@@ -87,6 +87,9 @@ int transform_save(struct augeas *aug, struct tree *xfm,
  * Return 0 on success, -1 on failure
  */
 int remove_file(struct augeas *aug, struct tree *tree);
+
+/* Return a printable name for the transform XFM. Never returns NULL. */
+const char *xfm_lens_name(struct tree *xfm);
 #endif
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]