Change 16200: Fix a few MacPerl_CanonDir() problems

[email protected] (Chris Nandor) Fri, 26 Apr 2002 19:09:33 -0400
Newsgroups perl.perl5.changes.mac
Message-ID <p05100303b8ef8ea9ae9d@[10.0.1.177]>
Change 16200 by pudge@pudge-mobile on 2002/04/26 21:09:45

	Fix a few MacPerl_CanonDir() problems

Affected files ...

.... //depot/macperl/macos/macish.c#2 edit
.... //depot/macperl/macos/macish.h#2 edit

Differences ...

==== //depot/macperl/macos/macish.c#2 (text) ====
Index: perl/macos/macish.c
--- perl/macos/macish.c.~1~	Fri Apr 26 15:15:05 2002
+++ perl/macos/macish.c	Fri Apr 26 15:15:05 2002
@@ -683,7 +683,7 @@
 }
 #endif
 
-const char * MacPerl_CanonDir(const char * dir, char * buf)
+const char * MacPerl_CanonDir(const char * dir, char * buf, Boolean is_file)
 {
 	char * out = buf;
 	char * slash;
@@ -723,7 +723,7 @@
 		memcpy(out, dir, slash-dir);
 		out += slash-dir;
 		*out++ = ':';
-		for (;;) {
+		while (*slash == '/') {
 			while (*++slash == '/')
 				;
 			if (slash[0] == '.') {
@@ -748,7 +748,7 @@
 done:
 	strcpy(out, dir);
 	out += strlen(out);
-	if (out[-1] != ':')
+	if (!is_file && out[-1] != ':')
 		*out++ = ':';
 	*out = 0;
 

==== //depot/macperl/macos/macish.h#2 (text) ====
Index: perl/macos/macish.h
--- perl/macos/macish.h.~1~	Fri Apr 26 15:15:05 2002
+++ perl/macos/macish.h	Fri Apr 26 15:15:05 2002
@@ -74,7 +74,7 @@
 char * MacPerl_MPWFileName(char * file);
 char * GetSysErrText(short, char *);
 unsigned char * MacPerl_CopyC2P(const char * c, unsigned char * p);
-const char * MacPerl_CanonDir(const char * dir, char * buf);
+const char * MacPerl_CanonDir(const char * dir, char * buf, Boolean is_file);
 void MacPerl_WriteMsg(void * io, const char * msg, size_t len);
 void MacPerl_Exit(int status);
 
End of Patch.