CAMLreturn (Val_unit);
}
+
+/* val source : t -> path -> path option */
+CAMLprim value
+ocaml_augeas_source (value tv, value pathv)
+{
+ CAMLparam2 (tv, pathv);
+ CAMLlocal2 (optv, v);
+ augeas_t t = Augeas_t_val (tv);
+ const char *path = String_val (pathv);
+ char *file_path;
+ int r;
+
+ r = aug_source (t, path, &file_path);
+ if (r == 0) {
+ if (file_path) { /* Return Some file_path */
+ v = caml_copy_string (file_path);
+ optv = caml_alloc (1, 0);
+ Field (optv, 0) = v;
+ free (file_path);
+ } else /* Return None */
+ optv = Val_int (0);
+ }
+ else /* Error */
+ raise_error (t, "Augeas.source");
+
+ CAMLreturn (optv);
+}
= "ocaml_augeas_set"
external transform : t -> string -> string -> transform_mode -> unit
= "ocaml_augeas_transform"
+external source : t -> path -> path option
+ = "ocaml_augeas_source"
let () =
Callback.register_exception "Augeas.Error" (Error (AugErrInternal, "", "", ""))
val transform : t -> string -> string -> transform_mode -> unit
(** [transform t lens file mode] adds or removes (depending on
[mode]) the transformation of the specified [lens] for [file]. *)
+
+val source : t -> path -> path option
+ (** [source t path] returns the path to the node representing the
+ file to which [path] belongs, or [None] if [path] does not
+ represent any file. *)