cpython/Modules/sgimodule.c

56 lines
1.1 KiB
C
Raw Normal View History

1992-05-15 08:05:54 -03:00
/* SGI module -- random SGI-specific things */
#include "Python.h"
1992-05-15 08:05:54 -03:00
1994-09-12 07:40:46 -03:00
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static PyObject *
2000-07-10 09:29:26 -03:00
sgi_nap(PyObject *self, PyObject *args)
1992-05-15 08:05:54 -03:00
{
long ticks;
if (!PyArg_ParseTuple(args, "l:nap", &ticks))
return NULL;
Py_BEGIN_ALLOW_THREADS
sginap(ticks);
Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return Py_None;
1992-05-15 08:05:54 -03:00
}
1994-09-12 07:40:46 -03:00
extern char *_getpty(int *, int, mode_t, int);
static PyObject *
2000-07-10 09:29:26 -03:00
sgi__getpty(PyObject *self, PyObject *args)
1994-09-12 07:40:46 -03:00
{
int oflag;
int mode;
int nofork;
char *name;
int fildes;
if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork))
return NULL;
errno = 0;
name = _getpty(&fildes, oflag, (mode_t)mode, nofork);
if (name == NULL) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
return Py_BuildValue("(si)", name, fildes);
1994-09-12 07:40:46 -03:00
}
static PyMethodDef sgi_methods[] = {
{"nap", sgi_nap, METH_VARARGS},
{"_getpty", sgi__getpty, METH_VARARGS},
{NULL, NULL} /* sentinel */
1992-05-15 08:05:54 -03:00
};
void
initsgi(void)
1992-05-15 08:05:54 -03:00
{
Py_InitModule("sgi", sgi_methods);
1992-05-15 08:05:54 -03:00
}