]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added '-d' command line debugging option
authorserassio <>
Mon, 26 Dec 2005 18:18:25 +0000 (18:18 +0000)
committerserassio <>
Mon, 26 Dec 2005 18:18:25 +0000 (18:18 +0000)
helpers/external_acl/wbinfo_group/wbinfo_group.pl

index 9710b9f925f10a3805de2a7f6c3bc5b159b4947c..b8ebed826336d1dd19385a5f80d1954b244ff78e 100644 (file)
@@ -12,6 +12,9 @@
 #   Jerry Murdock <jmurdock@itraktech.com>
 #
 # Version history:
+#   2005-12-26 Guido Serassio <guido.serassio@acmeconsulting.it>
+#               Add '-d' command line debugging option
+#
 #   2005-12-24 Guido Serassio <guido.serassio@acmeconsulting.it>
 #               Fix for wbinfo from Samba 3.0.21
 #
 #              Initial release
 
 
+#
+# Globals
+#
+use vars qw/ %opt /;
+
 # Disable output buffering
 $|=1;           
 
 sub debug {
-       # Uncomment this to enable debugging
-       #print STDERR "@_\n";
+       print STDERR "@_\n" if $opt{d};
 }
 
 #
@@ -47,6 +54,31 @@ sub check {
         return 'ERR';
 }
 
+#
+# Command line options processing
+#
+sub init()
+{
+    use Getopt::Std;
+    my $opt_string = 'hd';
+    getopts( "$opt_string", \%opt ) or usage();
+    usage() if $opt{h};
+}
+
+#
+# Message about this program and how to use it
+#
+sub usage()
+{
+       print "Usage: wbinfo_group.pl -dh\n";
+       print "\t-d enable debugging\n";
+       print "\t-h print the help\n";
+       exit;
+}
+
+init();
+print STDERR "Debugging mode ON.\n" if $opt{d};
+
 #
 # Main loop
 #