summaryrefslogtreecommitdiffstats
path: root/java
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 /java
parent62ccc07e744d5ebfb45d9344827d36f9f61699f4 (diff)
downloadlibguestfs-f450ce75b754fb869b34433c0126f7bb592b141b.tar.gz
libguestfs-f450ce75b754fb869b34433c0126f7bb592b141b.tar.xz
libguestfs-f450ce75b754fb869b34433c0126f7bb592b141b.zip
Generated code for 'wc_*' commands.
Diffstat (limited to 'java')
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java54
-rw-r--r--java/com_redhat_et_libguestfs_GuestFS.c54
2 files changed, 108 insertions, 0 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java
index c664801d..64b0802b 100644
--- a/java/com/redhat/et/libguestfs/GuestFS.java
+++ b/java/com/redhat/et/libguestfs/GuestFS.java
@@ -3569,4 +3569,58 @@ public HashMap<String,String> test0rhashtableerr ()
private native String _mkdtemp (long g, String template)
throws LibGuestFSException;
+ /**
+ * count lines in a file
+ * <p>
+ * This command counts the lines in a file, using the "wc
+ * -l" external command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int wc_l (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("wc_l: handle is closed");
+ return _wc_l (g, path);
+ }
+ private native int _wc_l (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * count words in a file
+ * <p>
+ * This command counts the words in a file, using the "wc
+ * -w" external command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int wc_w (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("wc_w: handle is closed");
+ return _wc_w (g, path);
+ }
+ private native int _wc_w (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * count characters in a file
+ * <p>
+ * This command counts the characters in a file, using the
+ * "wc -c" external command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int wc_c (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("wc_c: handle is closed");
+ return _wc_c (g, path);
+ }
+ private native int _wc_c (long g, String path)
+ throws LibGuestFSException;
+
}
diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c
index 3048cef6..3a162597 100644
--- a/java/com_redhat_et_libguestfs_GuestFS.c
+++ b/java/com_redhat_et_libguestfs_GuestFS.c
@@ -4145,3 +4145,57 @@ Java_com_redhat_et_libguestfs_GuestFS__1mkdtemp
return jr;
}
+JNIEXPORT jint JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1wc_1l
+ (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *path;
+
+ path = (*env)->GetStringUTFChars (env, jpath, NULL);
+ r = guestfs_wc_l (g, path);
+ (*env)->ReleaseStringUTFChars (env, jpath, path);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return 0;
+ }
+ return (jint) r;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1wc_1w
+ (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *path;
+
+ path = (*env)->GetStringUTFChars (env, jpath, NULL);
+ r = guestfs_wc_w (g, path);
+ (*env)->ReleaseStringUTFChars (env, jpath, path);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return 0;
+ }
+ return (jint) r;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1wc_1c
+ (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *path;
+
+ path = (*env)->GetStringUTFChars (env, jpath, NULL);
+ r = guestfs_wc_c (g, path);
+ (*env)->ReleaseStringUTFChars (env, jpath, path);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return 0;
+ }
+ return (jint) r;
+}
+