summaryrefslogtreecommitdiff
path: root/python/rpmfd-py.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-10-15 11:34:26 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-10-15 11:34:26 +0300
commited40ff253a88ab399c28cf22005193e7389d5e23 (patch)
tree55da19694a49539af3d5cb321ceb1a61f5f3c90b /python/rpmfd-py.c
parented6ed5c1ce0854f1b8956a66e8a429c9d5ff3948 (diff)
downloadrpm-ed40ff253a88ab399c28cf22005193e7389d5e23.tar.gz
rpm-ed40ff253a88ab399c28cf22005193e7389d5e23.tar.bz2
rpm-ed40ff253a88ab399c28cf22005193e7389d5e23.zip
Add tell() method to rpm.fd class
Diffstat (limited to 'python/rpmfd-py.c')
-rw-r--r--python/rpmfd-py.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c
index 8458410d0..077cf9e1f 100644
--- a/python/rpmfd-py.c
+++ b/python/rpmfd-py.c
@@ -182,6 +182,16 @@ static PyObject *rpmfd_seek(rpmfdObject *s, PyObject *args, PyObject *kwds)
Py_RETURN_NONE;
}
+static PyObject *rpmfd_tell(rpmfdObject *s)
+{
+ off_t offset;
+ Py_BEGIN_ALLOW_THREADS
+ offset = Ftell(s->fd);
+ Py_END_ALLOW_THREADS
+ return Py_BuildValue("L", offset);
+
+}
+
static PyObject *rpmfd_read(rpmfdObject *s, PyObject *args, PyObject *kwds)
{
char *kwlist[] = { "size", NULL };
@@ -257,6 +267,8 @@ static struct PyMethodDef rpmfd_methods[] = {
NULL },
{ "seek", (PyCFunction) rpmfd_seek, METH_VARARGS|METH_KEYWORDS,
NULL },
+ { "tell", (PyCFunction) rpmfd_tell, METH_NOARGS,
+ NULL },
{ "write", (PyCFunction) rpmfd_write, METH_VARARGS|METH_KEYWORDS,
NULL },
{ NULL, NULL }