summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 10:09:13 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 10:09:13 +0100
commitf450ce75b754fb869b34433c0126f7bb592b141b (patch)
treed5871faf1cc109629f7df0b59e1eb1403199ccf4 /ocaml
parent62ccc07e744d5ebfb45d9344827d36f9f61699f4 (diff)
downloadlibguestfs-f450ce75b754fb869b34433c0126f7bb592b141b.tar.gz
libguestfs-f450ce75b754fb869b34433c0126f7bb592b141b.tar.xz
libguestfs-f450ce75b754fb869b34433c0126f7bb592b141b.zip
Generated code for 'wc_*' commands.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml3
-rw-r--r--ocaml/guestfs.mli9
-rw-r--r--ocaml/guestfs_c_actions.c69
3 files changed, 81 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index a48b5264..b84504e7 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -284,3 +284,6 @@ external scrub_device : t -> string -> unit = "ocaml_guestfs_scrub_device"
external scrub_file : t -> string -> unit = "ocaml_guestfs_scrub_file"
external scrub_freespace : t -> string -> unit = "ocaml_guestfs_scrub_freespace"
external mkdtemp : t -> string -> string = "ocaml_guestfs_mkdtemp"
+external wc_l : t -> string -> int = "ocaml_guestfs_wc_l"
+external wc_w : t -> string -> int = "ocaml_guestfs_wc_w"
+external wc_c : t -> string -> int = "ocaml_guestfs_wc_c"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index d26d5bb0..4c1ef721 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -631,3 +631,12 @@ val scrub_freespace : t -> string -> unit
val mkdtemp : t -> string -> string
(** create a temporary directory *)
+val wc_l : t -> string -> int
+(** count lines in a file *)
+
+val wc_w : t -> string -> int
+(** count words in a file *)
+
+val wc_c : t -> string -> int
+(** count characters in a file *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index f4079564..beb41d77 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -4367,3 +4367,72 @@ ocaml_guestfs_mkdtemp (value gv, value templatev)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_wc_l (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("wc_l: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_wc_l (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "wc_l");
+
+ rv = Val_int (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_wc_w (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("wc_w: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_wc_w (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "wc_w");
+
+ rv = Val_int (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_wc_c (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("wc_c: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_wc_c (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "wc_c");
+
+ rv = Val_int (r);
+ CAMLreturn (rv);
+}
+