I started coding aug_lens_put and it's going ok, but I'm having trouble
adding public api calls. Consider the attached patch. When I compile a
link against the library in the src/.libs file I get compile errors:

test_put.c:(.text+0x67): undefined reference to `aug_lens_put'
collect2: ld returned 1 exit status

but aug_init and aug_close are defined. Did I miss a step to export that
function?

Thanks.

btw, i have more code than just that patch, I'm only posting the minimum
code to explain the problem.

-- 
My GnuPGP key at:
www.basementcode.com/public_key.txt
diff --git a/src/augeas.c b/src/augeas.c
index 050efbb..13acb02 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -1076,6 +1076,26 @@ int aug_save(struct augeas *aug) {
     return -1;
 }
 
+int aug_lens_put(struct augeas *aug, const char *lens,
+                 const char *path,
+                 const char *text, size_t text_len,
+                 char **new_text, size_t new_text_len) {
+    /*
+      Here, LENS is the name of a lens, say "Hosts.lns", PATH is the path to
+      the subtree of interest, say "/files/etc/hosts", TEXT is the original
+      string, and NEW_TEXT a pointer to the newly allocated string resulting
+      from transforming the tree at PATH back int a string.
+     */
+
+    /*
+      FIXME:?
+      Alot of this code was adopted from transform_save...
+      Maybe it would be better to change transform_save to call this function
+      then only take care of saving to disk afterwards.
+    */
+    
+}
+
 static int print_one(FILE *out, const char *path, const char *value) {
     int r;
 
diff --git a/src/augeas.h b/src/augeas.h
index 2caf7df..b70e9d3 100644
--- a/src/augeas.h
+++ b/src/augeas.h
@@ -224,6 +224,11 @@ int aug_match(const augeas *aug, const char *path, char 
***matches);
  */
 int aug_save(augeas *aug);
 
+int aug_lens_put(struct augeas *, const char *lens,
+                 const char *path,
+                 const char *text, size_t text_len,
+                 char **new_text, size_t new_text_len);
+
 /* Function: aug_load
  *
  * Load files into the tree. Which files to load and what lenses to use on
_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to