18fe082e665835b0d2cfc62aa2316248ab1a16fc
[mat/samba.git] / examples / LDAP / smbldap-tools / smbldap-groupshow.pl
1 #!/usr/bin/perl -w
2
3 #  This code was developped by IDEALX (http://IDEALX.org/) and
4 #  contributors (their names can be found in the CONTRIBUTORS file).
5 #
6 #                 Copyright (C) 2001-2002 IDEALX
7 #
8 #  This program is free software; you can redistribute it and/or
9 #  modify it under the terms of the GNU General Public License
10 #  as published by the Free Software Foundation; either version 2
11 #  of the License, or (at your option) any later version.
12 #
13 #  This program is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #  GNU General Public License for more details.
17 #
18 #  You should have received a copy of the GNU General Public License
19 #  along with this program; if not, write to the Free Software
20 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 #  USA.
22
23 # Purpose of smbldap-groupshow : user (posix,shadow,samba) display
24 #
25 # History :
26 #       . originally by David Le Corfec <david.le-corfec@IDEALX.com>
27
28 use strict;
29 use FindBin;
30 use FindBin qw($RealBin);
31 use lib "$RealBin/";
32 use smbldap_tools;
33 use Getopt::Std;
34 my %Options;
35
36 my $ok = getopts('?', \%Options);
37
38 if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) {
39         print "Usage: $0 [-?] group\n";
40         print "  -?     show this help message\n";
41         exit (1);
42 }
43
44 # Read only first @ARGV
45 my $group = $ARGV[0];
46
47 my $lines = read_group($group);
48 if (!defined($lines)) {
49     print "$0: group $group doesn't exist\n";
50     exit (1);
51 }
52
53 print "$lines\n";
54
55 exit(0);
56
57 ############################################################
58
59 =head1 NAME
60
61        smbldap-groupshow.pl - Display group informations
62
63 =head1 SYNOPSIS
64
65        smbldap-groupshow.pl groupname
66
67 =head1 DESCRIPTION
68
69        The smbldap-groupshow.pl command displays informations
70        associated with the given group.
71
72 =cut
73
74 #'