summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-06 15:30:39 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-06 15:30:39 (GMT)
commit22ffac1b1f8288bac7a277a8caa04ca731a54b81 (patch)
treeae5fe08b176740e436a59d7983bd437b79325b04 /Modules/main.c
parent859c797a48f09e1de12c723e282c569495d4dced (diff)
downloadcpython-22ffac1b1f8288bac7a277a8caa04ca731a54b81.zip
cpython-22ffac1b1f8288bac7a277a8caa04ca731a54b81.tar.gz
cpython-22ffac1b1f8288bac7a277a8caa04ca731a54b81.tar.bz2
Don't use setvbuf unless HAVE_SETVBUF is defined.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 83fd9dc..b62597a 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -205,25 +205,33 @@ Py_Main(argc, argv)
_setmode(fileno(stdout), O_BINARY);
#endif
#ifndef MPW
+#ifdef HAVE_SETVBUF
setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ);
setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);
setvbuf(stderr, (char *)NULL, _IONBF, BUFSIZ);
-#else
+#else /* !HAVE_SETVBUF */
+ setbuf(stdin, (char *)NULL);
+ setbuf(stdout, (char *)NULL);
+ setbuf(stderr, (char *)NULL);
+#endif /* !HAVE_SETVBUF */
+#else /* MPW */
/* On MPW (3.2) unbuffered seems to hang */
setvbuf(stdin, (char *)NULL, _IOLBF, BUFSIZ);
setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
setvbuf(stderr, (char *)NULL, _IOLBF, BUFSIZ);
-#endif
+#endif /* MPW */
}
else if (Py_InteractiveFlag) {
#ifdef MS_WINDOWS
/* Doesn't have to have line-buffered -- use unbuffered */
setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ);
setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);
-#else
+#else /* !MS_WINDOWS */
+#ifdef HAVE_SETVBUF
setvbuf(stdin, (char *)NULL, _IOLBF, BUFSIZ);
setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
-#endif
+#endif /* HAVE_SETVBUF */
+#endif /* !MS_WINDOWS */
/* Leave stderr alone - it should be unbuffered anyway. */
}