Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. #
  4. # Globals
  5. #
  6. my $YPCAT = "/usr/bin/ypcat";
  7. my $MAPNAME = "auto_direct";
  8. # NONE!
  9. #
  10. # main block - keep it all in one nice neat place
  11. #
  12. main: {
  13. my (%opts, %mounts)=();
  14. my ($i,$j,$k)=();
  15. #
  16. if(scalar(@ARGV) != 1) {
  17. exit(0); #Just die quietly. Users shouldn't call us.
  18. }
  19. #
  20. open(FILE, "$YPCAT -k $MAPNAME|")
  21. or die("Can't fork $YPCAT. Contact Admin.");
  22. #
  23. while(defined($_=<FILE>)) {
  24. ($i,$j,$k)=split();
  25. $i =~ s[^/][];
  26. $opts{$i}=$j if($i);
  27. $mounts{$i}=$k if($i);
  28. }
  29. #
  30. # How do we add the options, etc. in?.... hmmm...
  31. #
  32. printf("%s\n",$mounts{$ARGV[0]}) if($mounts{$ARGV[0]});
  33. close(FILE);
  34. #
  35. exit(0);
  36. } # end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement