summaryrefslogtreecommitdiffstats
path: root/Modules/sgimodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-09-12 10:40:46 (GMT)
committerGuido van Rossum <guido@python.org>1994-09-12 10:40:46 (GMT)
commit43021932bc26bc9a3d64f8158d089b6d68dc8f9c (patch)
treeaf46fa19197f23ae87b45635ea80b2b3ed43dd41 /Modules/sgimodule.c
parentae311bd50361f38f689791d6099ca634ff33e046 (diff)
downloadcpython-43021932bc26bc9a3d64f8158d089b6d68dc8f9c.zip
cpython-43021932bc26bc9a3d64f8158d089b6d68dc8f9c.tar.gz
cpython-43021932bc26bc9a3d64f8158d089b6d68dc8f9c.tar.bz2
Added _getpty interface.
Diffstat (limited to 'Modules/sgimodule.c')
-rw-r--r--Modules/sgimodule.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c
index 92a8acd..69f9f7c 100644
--- a/Modules/sgimodule.c
+++ b/Modules/sgimodule.c
@@ -28,6 +28,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "modsupport.h"
#include "ceval.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+
extern int sginap(long);
static object *
@@ -45,8 +51,32 @@ sgi_nap(self, args)
return None;
}
+extern char *_getpty(int *, int, mode_t, int);
+
+static object *
+sgi__getpty(self, args)
+ object *self;
+ object *args;
+{
+ int oflag;
+ int mode;
+ int nofork;
+ char *name;
+ int fildes;
+ if (!getargs(args, "(iii)", &oflag, &mode, &nofork))
+ return NULL;
+ errno = 0;
+ name = _getpty(&fildes, oflag, (mode_t)mode, nofork);
+ if (name == NULL) {
+ err_errno(IOError);
+ return NULL;
+ }
+ return mkvalue("(si)", name, fildes);
+}
+
static struct methodlist sgi_methods[] = {
{"nap", sgi_nap},
+ {"_getpty", sgi__getpty},
{NULL, NULL} /* sentinel */
};