summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-07-26 02:57:20 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-07-26 02:57:20 (GMT)
commit70e89c11fea0f2711dc8305949b6f753efc034fe (patch)
tree611ec599358398ad5a6bbc47597241e6e1855706
parentfdee0f0aa779fbe648cebe68878e9be5dc47e0bd (diff)
downloadcpython-70e89c11fea0f2711dc8305949b6f753efc034fe.zip
cpython-70e89c11fea0f2711dc8305949b6f753efc034fe.tar.gz
cpython-70e89c11fea0f2711dc8305949b6f753efc034fe.tar.bz2
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
-rw-r--r--Modules/_cursesmodule.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 82c9be8..3aa3f31 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2004,6 +2004,50 @@ PyCurses_Start_Color(PyObject *self, PyObject *args)
}
static PyObject *
+PyCurses_tigetflag(PyObject *self, PyObject *args)
+{
+ char *capname;
+
+ PyCursesInitialised;
+
+ if (!PyArg_ParseTuple(args, "z", &capname))
+ return NULL;
+
+ return PyInt_FromLong( (long) tigetflag( capname ) );
+}
+
+static PyObject *
+PyCurses_tigetnum(PyObject *self, PyObject *args)
+{
+ char *capname;
+
+ PyCursesInitialised;
+
+ if (!PyArg_ParseTuple(args, "z", &capname))
+ return NULL;
+
+ return PyInt_FromLong( (long) tigetnum( capname ) );
+}
+
+static PyObject *
+PyCurses_tigetstr(PyObject *self, PyObject *args)
+{
+ char *capname;
+
+ PyCursesInitialised;
+
+ if (!PyArg_ParseTuple(args, "z", &capname))
+ return NULL;
+
+ capname = tigetstr( capname );
+ if (capname == 0 || capname == (char*) -1) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return PyString_FromString( capname );
+}
+
+static PyObject *
PyCurses_TypeAhead(PyObject *self, PyObject *args)
{
int fd;
@@ -2149,6 +2193,9 @@ static PyMethodDef PyCurses_methods[] = {
{"start_color", (PyCFunction)PyCurses_Start_Color},
{"termattrs", (PyCFunction)PyCurses_termattrs},
{"termname", (PyCFunction)PyCurses_termname},
+ {"tigetflag", (PyCFunction)PyCurses_tigetflag, METH_VARARGS},
+ {"tigetnum", (PyCFunction)PyCurses_tigetnum, METH_VARARGS},
+ {"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS},
{"typeahead", (PyCFunction)PyCurses_TypeAhead},
{"unctrl", (PyCFunction)PyCurses_UnCtrl},
{"ungetch", (PyCFunction)PyCurses_UngetCh},