summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-08-27 23:16:34 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-08-27 23:16:34 (GMT)
commit3070ee6b372b4b7cd0c2c695caa93bdc8d0d23fc (patch)
tree33e215a80cac17d9203f967dea914ea74910ad4d /Mac
parentc59e22000082722655517942d7662eec5a4a70ce (diff)
downloadcpython-3070ee6b372b4b7cd0c2c695caa93bdc8d0d23fc.zip
cpython-3070ee6b372b4b7cd0c2c695caa93bdc8d0d23fc.tar.gz
cpython-3070ee6b372b4b7cd0c2c695caa93bdc8d0d23fc.tar.bz2
Experimental feature: allow \n as well as \r as newline for text files, by breaking in to the lowlevel I/O system. Can be disabled by defining WITHOUT_UNIX_NEWLINES.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Python/macglue.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index 9c01fd7..d42484b 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -179,6 +179,23 @@ static PyObject *python_event_handler;
*/
int PyMac_AppearanceCompliant;
+#ifndef WITHOUT_UNIX_NEWLINES
+/*
+** Experimental feature (for 2.2a2): allow unix newlines
+** as well as Mac newlines on input. We replace a lowlevel
+** MSL routine to accomplish this
+*/
+void
+__convert_to_newlines(unsigned char * buf, size_t * n_ptr)
+{
+ unsigned char *p;
+ size_t n = *n_ptr;
+
+ for(p=buf; n > 0; p++, n--)
+ if ( *p == '\r' ) *p = '\n';
+}
+#endif /* WITHOUT_UNIX_NEWLINES */
+
/* Given an FSSpec, return the FSSpec of the parent folder */
static OSErr