develooper Front page | perl.perl5.porters | Postings from June 2001

[PATCH File/Spec/Unix.pm ExtUtils/MM_Unix.pm] for QNX

Thread Next
From:
Norton Allen
Date:
June 27, 2001 07:27
Subject:
[PATCH File/Spec/Unix.pm ExtUtils/MM_Unix.pm] for QNX
Message ID:
200106271433.KAA04947@bottesini.harvard.edu
The patch to File/Spec/Unix.pm duplicates a fix that has
been in place in ExtUtils/MM_Unix.pm for some time to support
POSIX-style node names for QNX. I have extended the functionality
to embrace Neutrino, aka QNX6. This may apply to some other
operating systems as well.

 -Norton Allen

exit 0
=============

*** ../ORIG/perl-10825/lib/File/Spec/Unix.pm	Sat Jun  2 13:10:07 2001
--- perl-10825/lib/File/Spec/Unix.pm	Wed Jun 27 10:26:34 2001
***************
*** 34,45 ****
  
  sub canonpath {
      my ($self,$path) = @_;
      $path =~ s|/+|/|g unless($^O eq 'cygwin');     # xx////xx  -> xx/xx
      $path =~ s|(/\.)+/|/|g;                        # xx/././xx -> xx/xx
      $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
      $path =~ s|^/(\.\./)+|/|s;                     # /../../xx -> xx
      $path =~ s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
!     return $path;
  }
  
  =item catdir
--- 34,51 ----
  
  sub canonpath {
      my ($self,$path) = @_;
+     
+     # Handle POSIX-style node names beginning with double slash
+     my $node = '';
+     if ( $^O =~ m/^qnx|nto$/ && $path =~ s:^(//[^/]+)(/|\z):/:s ) {
+       $node = $1;
+     }
      $path =~ s|/+|/|g unless($^O eq 'cygwin');     # xx////xx  -> xx/xx
      $path =~ s|(/\.)+/|/|g;                        # xx/././xx -> xx/xx
      $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
      $path =~ s|^/(\.\./)+|/|s;                     # /../../xx -> xx
      $path =~ s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
!     return "$node$path";
  }
  
  =item catdir
*** ../ORIG/perl-10825/lib/ExtUtils/MM_Unix.pm	Tue Jun 19 07:45:39 2001
--- perl-10825/lib/ExtUtils/MM_Unix.pm	Wed Jun 27 10:27:01 2001
***************
*** 81,95 ****
  
  sub canonpath {
      my($self,$path) = @_;
      my $node = '';
!     if ( $^O eq 'qnx' && $path =~ s|^(//\d+)/|/|s ) {
        $node = $1;
      }
      $path =~ s|(?<=[^/])/+|/|g ;                   # xx////xx  -> xx/xx
      $path =~ s|(/\.)+/|/|g ;                       # xx/././xx -> xx/xx
      $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
      $path =~ s|(?<=[^/])/\z|| ;                    # xx/       -> xx
!     "$node$path";
  }
  
  =item catdir
--- 81,97 ----
  
  sub canonpath {
      my($self,$path) = @_;
+     
+     # Handle POSIX-style node names beginning with double slash
      my $node = '';
!     if ( $^O =~ m/^qnx|nto$/ && $path =~ s:^(//[^/]+)(/|\z):/:s ) {
        $node = $1;
      }
      $path =~ s|(?<=[^/])/+|/|g ;                   # xx////xx  -> xx/xx
      $path =~ s|(/\.)+/|/|g ;                       # xx/././xx -> xx/xx
      $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
      $path =~ s|(?<=[^/])/\z|| ;                    # xx/       -> xx
!     return "$node$path";
  }
  
  =item catdir

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About