]> granicus.if.org Git - python/commitdiff
Experimental feature: allow \n as well as \r as newline for text files, by breaking...
authorJack Jansen <jack.jansen@cwi.nl>
Mon, 27 Aug 2001 23:16:34 +0000 (23:16 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Mon, 27 Aug 2001 23:16:34 +0000 (23:16 +0000)
Mac/Python/macglue.c

index 9c01fd74b807ed48c0bb102042989f9a2dd72265..d42484bfbebc0796d453b7d77de7715e915faed3 100644 (file)
@@ -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