Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- #
- # Globals
- #
- my $YPCAT = "/usr/bin/ypcat";
- my $MAPNAME = "auto_direct";
- # NONE!
- #
- # main block - keep it all in one nice neat place
- #
- main: {
- my (%opts, %mounts)=();
- my ($i,$j,$k)=();
- #
- if(scalar(@ARGV) != 1) {
- exit(0); #Just die quietly. Users shouldn't call us.
- }
- #
- open(FILE, "$YPCAT -k $MAPNAME|")
- or die("Can't fork $YPCAT. Contact Admin.");
- #
- while(defined($_=<FILE>)) {
- ($i,$j,$k)=split();
- $i =~ s[^/][];
- $opts{$i}=$j if($i);
- $mounts{$i}=$k if($i);
- }
- #
- # How do we add the options, etc. in?.... hmmm...
- #
- printf("%s\n",$mounts{$ARGV[0]}) if($mounts{$ARGV[0]});
- close(FILE);
- #
- exit(0);
- } # end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement