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

@@ -4631,6 +4631,78 @@ py_guestfs_mkdtemp (PyObject *self, PyObject *args)
return py_r;
}
static PyObject *
py_guestfs_wc_l (PyObject *self, PyObject *args)
{
PyObject *py_g;
guestfs_h *g;
PyObject *py_r;
int r;
const char *path;
if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_wc_l",
&py_g, &path))
return NULL;
g = get_handle (py_g);
r = guestfs_wc_l (g, path);
if (r == -1) {
PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
return NULL;
}
py_r = PyInt_FromLong ((long) r);
return py_r;
}
static PyObject *
py_guestfs_wc_w (PyObject *self, PyObject *args)
{
PyObject *py_g;
guestfs_h *g;
PyObject *py_r;
int r;
const char *path;
if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_wc_w",
&py_g, &path))
return NULL;
g = get_handle (py_g);
r = guestfs_wc_w (g, path);
if (r == -1) {
PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
return NULL;
}
py_r = PyInt_FromLong ((long) r);
return py_r;
}
static PyObject *
py_guestfs_wc_c (PyObject *self, PyObject *args)
{
PyObject *py_g;
guestfs_h *g;
PyObject *py_r;
int r;
const char *path;
if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_wc_c",
&py_g, &path))
return NULL;
g = get_handle (py_g);
r = guestfs_wc_c (g, path);
if (r == -1) {
PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
return NULL;
}
py_r = PyInt_FromLong ((long) r);
return py_r;
}
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -4803,6 +4875,9 @@ static PyMethodDef methods[] = {
{ (char *) "scrub_file", py_guestfs_scrub_file, METH_VARARGS, NULL },
{ (char *) "scrub_freespace", py_guestfs_scrub_freespace, METH_VARARGS, NULL },
{ (char *) "mkdtemp", py_guestfs_mkdtemp, METH_VARARGS, NULL },
{ (char *) "wc_l", py_guestfs_wc_l, METH_VARARGS, NULL },
{ (char *) "wc_w", py_guestfs_wc_w, METH_VARARGS, NULL },
{ (char *) "wc_c", py_guestfs_wc_c, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};

View File

@@ -1727,3 +1727,21 @@ class GuestFS:
"""
return libguestfsmod.mkdtemp (self._o, template)
def wc_l (self, path):
u"""This command counts the lines in a file, using the "wc
-l" external command.
"""
return libguestfsmod.wc_l (self._o, path)
def wc_w (self, path):
u"""This command counts the words in a file, using the "wc
-w" external command.
"""
return libguestfsmod.wc_w (self._o, path)
def wc_c (self, path):
u"""This command counts the characters in a file, using the
"wc -c" external command.
"""
return libguestfsmod.wc_c (self._o, path)