[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.154,2.155
Skip Montanaro
python-dev@python.org
Wed, 19 Jul 2000 07:34:17 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9966
Modified Files:
posixmodule.c
Log Message:
new method isatty from Thomas Wouters
Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.154
retrieving revision 2.155
diff -C2 -r2.154 -r2.155
*** posixmodule.c 2000/07/16 12:04:31 2.154
--- posixmodule.c 2000/07/19 14:34:14 2.155
***************
*** 3245,3249 ****
--- 3245,3264 ----
}
+ static char posix_isatty__doc__[] =
+ "isatty(fd) -> Boolean\n\
+ Return true if the file descriptor 'fd' is an open file descriptor\n\
+ connected to a terminal.";
+ static PyObject *
+ posix_isatty(self, args)
+ PyObject *self;
+ PyObject *args;
+ {
+ int fd;
+ if (!PyArg_ParseTuple(args, "i:isatty", &fd))
+ return NULL;
+ return Py_BuildValue("i", isatty(fd));
+ }
+
#ifdef HAVE_PIPE
static char posix_pipe__doc__[] =
***************
*** 5039,5042 ****
--- 5054,5058 ----
{"fstat", posix_fstat, METH_VARARGS, posix_fstat__doc__},
{"fdopen", posix_fdopen, METH_VARARGS, posix_fdopen__doc__},
+ {"isatty", posix_isatty, METH_VARARGS, posix_isatty__doc__},
#ifdef HAVE_PIPE
{"pipe", posix_pipe, METH_VARARGS, posix_pipe__doc__},