summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/lsnetdrake
blob: edf3cc54c92de2eb3359cd1793fe48c1f2506721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);
use network::nfs;
use network::smb;

"@ARGV" =~ /-h/ and die "usage: lsnetdrake [-h] [--nfs] [--smb]\n";

my $nfs = !@ARGV || "@ARGV" =~ /-(nfs)/;
my $smb = !@ARGV || "@ARGV" =~ /-(smb)/;

$| = 1;
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";

my @l;
push @l, network::nfs->new if $nfs;
push @l, network::smb->new if $smb;

foreach my $class (@l) {
    foreach my $server (sort_names($class->find_servers)) {
	foreach my $export (sort_names($class->find_exports($server))) {
	    print $class->to_fullstring($export), "\n";
	}
    }
}

sub sort_names { 
    sort { $a->{name} cmp $b->{name} } @_;
}