summaryrefslogtreecommitdiff
path: root/ext/File
diff options
context:
space:
mode:
authorChris Nandor <pudge@pobox.com>2001-03-30 11:51:00 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-30 22:45:45 +0000
commit7369a5240f1efb9ab50b6f47289fb602aaaccc25 (patch)
tree8bd35f245afe232b7bb3bbb4d775377fc9f3dac3 /ext/File
parentf76dcffd2a85ebbf391d02c50da184b1b8a1232e (diff)
downloadperl-7369a5240f1efb9ab50b6f47289fb602aaaccc25.tar.gz
File::Glob stuff for Mac OS
Message-Id: <p05010400b6eaab36051c@[10.0.1.177]> p4raw-id: //depot/perl@9479
Diffstat (limited to 'ext/File')
-rw-r--r--ext/File/Glob/Glob.pm22
-rw-r--r--ext/File/Glob/bsd_glob.c28
2 files changed, 43 insertions, 7 deletions
diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm
index 76adbe7b3d..561f33154d 100644
--- a/ext/File/Glob/Glob.pm
+++ b/ext/File/Glob/Glob.pm
@@ -376,14 +376,32 @@ Win32 users should use the real slash. If you really want to use
backslashes, consider using Sarathy's File::DosGlob, which comes with
the standard Perl distribution.
+=item *
+
+Mac OS (Classic) users should note a few differences. Since
+Mac OS is not Unix, when the glob code encounters a tilde glob (e.g.
+~user/foo) and the C<GLOB_TILDE> flag is used, it simply returns that
+pattern without doing any expansion.
+
+Glob on Mac OS is case-insensitive by default (if you don't use any
+flags). If you specify any flags at all and still want glob
+to be case-insensitive, you must include C<GLOB_NOCASE> in the flags.
+
+The path separator is ':' (aka colon), not '/' (aka slash). Mac OS users
+should be careful about specifying relative pathnames. While a full path
+always begins with a volume name, a relative pathname should always
+begin with a ':'. If specifying a volume name only, a trailing ':' is
+required.
+
=back
=head1 AUTHOR
The Perl interface was written by Nathan Torkington E<lt>gnat@frii.comE<gt>,
and is released under the artistic license. Further modifications were
-made by Greg Bacon E<lt>gbacon@cs.uah.eduE<gt> and Gurusamy Sarathy
-E<lt>gsar@activestate.comE<gt>. The C glob code has the
+made by Greg Bacon E<lt>gbacon@cs.uah.eduE<gt>, Gurusamy Sarathy
+E<lt>gsar@activestate.comE<gt>, and Thomas Wegner
+E<lt>wegner_thomas@yahoo.comE<gt>. The C glob code has the
following copyright:
Copyright (c) 1989, 1993 The Regents of the University of California.
diff --git a/ext/File/Glob/bsd_glob.c b/ext/File/Glob/bsd_glob.c
index a0becd1e14..6e2c9f1e85 100644
--- a/ext/File/Glob/bsd_glob.c
+++ b/ext/File/Glob/bsd_glob.c
@@ -79,8 +79,11 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
-# else
-# define MAXPATHLEN 1024
+# ifdef MACOS_TRADITIONAL
+# define MAXPATHLEN 255
+# else
+# define MAXPATHLEN 1024
+# endif
# endif
#endif
@@ -93,7 +96,11 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
#define BG_QUOTE '\\'
#define BG_RANGE '-'
#define BG_RBRACKET ']'
-#define BG_SEP '/'
+#ifdef MACOS_TRADITIONAL
+# define BG_SEP ':'
+#else
+# define BG_SEP '/'
+#endif
#ifdef DOSISH
#define BG_SEP2 '\\'
#endif
@@ -451,6 +458,12 @@ glob0(const Char *pattern, glob_t *pglob)
int c, err, oldflags, oldpathc;
Char *bufnext, patbuf[MAXPATHLEN+1];
+#ifdef MACOS_TRADITIONAL
+ if ( (*pattern == BG_TILDE) && (pglob->gl_flags & GLOB_TILDE) ) {
+ return(globextend(pattern, pglob));
+ }
+#endif
+
qpat = globtilde(pattern, patbuf, pglob);
qpatnext = qpat;
oldflags = pglob->gl_flags;
@@ -861,10 +874,15 @@ g_opendir(register Char *str, glob_t *pglob)
{
char buf[MAXPATHLEN];
- if (!*str)
+ if (!*str) {
+#ifdef MACOS_TRADITIONAL
+ strcpy(buf, ":");
+#else
strcpy(buf, ".");
- else
+#endif
+ } else {
g_Ctoc(str, buf);
+ }
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
return((*pglob->gl_opendir)(buf));