Generated code for 'wc_*' commands.

This commit is contained in:
Richard W.M. Jones
2009-06-29 10:09:13 +01:00
parent 62ccc07e74
commit f450ce75b7
25 changed files with 1648 additions and 157 deletions

View File

@@ -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;
}

View File

@@ -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;
}