home *** CD-ROM | disk | FTP | other *** search
/ ftp.cse.unsw.edu.au / 2014.06.ftp.cse.unsw.edu.au.tar / ftp.cse.unsw.edu.au / pub / doc / languages / perl / nutshell / ch6 / lfix < prev    next >
Encoding:
Text File  |  1992-10-18  |  484 b   |  32 lines

  1. #!/usr/bin/perl
  2.  
  3. # Usage: lfix cc -L ... -l ...
  4. #        lfix ld -L ... -l ...
  5.  
  6. while (@ARGV) {
  7.     $_ = shift;
  8.     if (/^-L(.*)/) {
  9.     push(@liblist, $1);
  10.     next;
  11.     }
  12.  
  13.     elsif (/^-l(.*)/) {
  14.     $libname = $1;
  15.     foreach $dir (@liblist) {
  16.         if (-f "$dir/lib$libname.a") {
  17.         $_ = "$dir/lib$libname.a";
  18.         last;
  19.         }
  20.         elsif (-f "$dir/llib-l$libname.ln") {
  21.         $_ = "$dir/llib-l$libname.ln";
  22.         last;
  23.         }
  24.     }
  25.     }
  26.     push(@newargv, $_);
  27. }
  28.  
  29. # Now do the new command.
  30.  
  31. exec @newargv;
  32.