/[gnump3d]/gnump3d/bin/getlibdir
ViewVC logotype

Diff of /gnump3d/bin/getlibdir

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by skx, Mon Jul 28 22:25:47 2003 UTC revision 1.2 by skx, Tue Oct 14 20:40:51 2003 UTC
# Line 32  Line 32 
32  #  http://www.steve.org.uk/  #  http://www.steve.org.uk/
33  #  #
34  #  #
35    
36    
37  use strict;  use strict;
38    
39    
40  #  #
41  # We want to prefer a short directory, such as  #  Only examine directories beneath /usr
 # /usr/lib/perl5/  
42  #  #
43  my $shortest = undef;  my @dirs = grep( /^\/usr/, @INC );
44    
45    
46  #  #
47  # Process all the builtin directories.  #  Find the shortest one.
48  #  #
49  foreach my $dir ( sort( @INC ) )  @dirs = sort { length( $a ) <=> length( $ b ) }  @dirs ;
50  {  
     next if ( $dir eq "." );  
     next if (! $dir =~ /usr/ );  
   
     if ( defined( $shortest ) )  
     {  
         if ( length( $dir ) lt length( $shortest ) )  
         {  
             $shortest = $dir;  
         }  
     }  
     else  
     {  
         $shortest = $dir;  
     }  
 }  
51    
52  #  #
53  # Strip trailing '/' if present.  #  Print it out - stripping the trailing '/' if present
54  #  #
55  if ( $shortest =~ /(.*)\/$/ )  if ( $dirs[0] =~ /(.*)\/$/ ) {
56  {      $dirs[0] = $1;
     $shortest = $1;  
57  }  }
58    
59  #  print $dirs[0];
 # All done.  
 #  
 print $shortest;  

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26