From: serassio <> Date: Mon, 26 Dec 2005 18:18:25 +0000 (+0000) Subject: Added '-d' command line debugging option X-Git-Tag: SQUID_3_0_PRE4~428 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47ea041341b3a57947a092a753ee593b50763ff9;p=thirdparty%2Fsquid.git Added '-d' command line debugging option --- diff --git a/helpers/external_acl/wbinfo_group/wbinfo_group.pl b/helpers/external_acl/wbinfo_group/wbinfo_group.pl index 9710b9f925..b8ebed8263 100644 --- a/helpers/external_acl/wbinfo_group/wbinfo_group.pl +++ b/helpers/external_acl/wbinfo_group/wbinfo_group.pl @@ -12,6 +12,9 @@ # Jerry Murdock # # Version history: +# 2005-12-26 Guido Serassio +# Add '-d' command line debugging option +# # 2005-12-24 Guido Serassio # Fix for wbinfo from Samba 3.0.21 # @@ -25,12 +28,16 @@ # 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 #