Change 16509: Make perlio (!sfio) work on MacOS

[email protected] (Chris Nandor) Thu, 9 May 2002 00:53:13 -0400
Newsgroups perl.perl5.changes.mac
Message-ID <p05100309b8ffb1367f7b@[10.0.1.177]>
Change 16509 by pudge@pudge-mobile on 2002/05/09 03:32:47

	Make perlio (!sfio) work on MacOS

Affected files ...

.... //depot/macperl/macos/config.h#4 edit
.... //depot/macperl/macos/config.sh#3 edit
.... //depot/macperl/macos/macish.c#4 edit

Differences ...

==== //depot/macperl/macos/config.h#4 (text) ====
Index: macperl/macos/config.h
--- macperl/macos/config.h#3~16252~	Sun Apr 28 12:07:33 2002
+++ macperl/macos/config.h	Wed May  8 20:32:47 2002
@@ -770,7 +770,7 @@
  *	This symbol, if defined, indicates to the C program that it should
  *	include <sfio.h>.
  */
-#define	I_SFIO		/**/
+/*#define	I_SFIO		/ **/
 
 /* I_STDDEF:
  *	This symbol, if defined, indicates that <stddef.h> exists and should
@@ -2229,7 +2229,7 @@
  *	This symbol, if defined, indicates that sfio should
  *	be used.
  */
-#define USE_SFIO /**/
+/*#define USE_SFIO / **/
 
 /* HAS_SHM:
  *	This symbol, if defined, indicates that the entire shm*(2) library is

==== //depot/macperl/macos/config.sh#3 (text) ====
Index: macperl/macos/config.sh
--- macperl/macos/config.sh#2~16252~	Sun Apr 28 12:07:33 2002
+++ macperl/macos/config.sh	Wed May  8 20:32:47 2002
@@ -326,7 +326,7 @@
 d_setsent='undef'
 d_setsid='undef'
 d_setvbuf='define'
-d_sfio='define'
+d_sfio='undef'
 d_shm='undef'
 d_shmat='undef'
 d_shmatprototype='undef'
@@ -491,7 +491,7 @@
 i_pthread='undef'
 i_pwd='undef'
 i_rpcsvcdbm='undef'
-i_sfio='define'
+i_sfio='undef'
 i_sgtty='undef'
 i_shadow='undef'
 i_socks='undef'
@@ -795,7 +795,7 @@
 useopcode='true'
 useperlio='define'
 useposix='true'
-usesfio='true'
+usesfio='false'
 useshrplib='false'
 usesocks='undef'
 usethreads='undef'

==== //depot/macperl/macos/macish.c#4 (text) ====
Index: macperl/macos/macish.c
--- macperl/macos/macish.c#3~16361~	Thu May  2 18:56:24 2002
+++ macperl/macos/macish.c	Wed May  8 20:32:47 2002
@@ -20,6 +20,9 @@
 #include <LowMem.h>
 #include <Timer.h>
 
+#undef FILE
+#define FILE	PerlIO
+
 char **environ;
 static  char ** gEnviron;
 static	char *	gEnvpool;
@@ -148,16 +151,17 @@
 
 int do_spawn(char * command)
 {
-   dTHX;
-   Sfio_t * temp = my_popen(command, "r");
-    char *   data;
-    
-    while (data = sfreserve(temp, -1, 0))
-	write(1, data, sfslen());
-	
+    dTHX;
+    PerlIO * temp = my_popen(command, "r");
+    char *   buf;
+    SSize_t  len;
+
+    while (len = PerlIO_read(temp, buf, sizeof(buf)))
+	write(1, buf, len);
+
     my_pclose(temp);
-	
-	return 0;
+
+    return 0;
 }
 
 int do_aspawn(SV *really,SV **mark,SV **sp)
@@ -949,6 +953,7 @@
 
 static void WriteMsgLn(PerlIO * io, const char * msg, size_t len, Boolean start)
 {
+	dTHX;
 	if (start)
 		PerlIO_write(io, "# ", 2);
 	PerlIO_write(io, msg, len);
@@ -956,6 +961,7 @@
 
 static void WriteMsg(PerlIO * io, const char * msg, size_t len, Boolean start)
 {
+	dTHX;
 	const char * nl;
 	
 	while (nl = (const char *)memchr(msg, '\n', len)) {
@@ -970,6 +976,7 @@
 
 void MacPerl_WriteMsg(void * io, const char * msg, size_t len)
 {
+	dTHX;
 	const char * line= msg;
 	const char * at;
 
End of Patch.