"Fossies" - the Fresh Open Source Software Archive

Member "pikt-1.19.0/lib/configs_samples/programs/acctmgr_common_programs.cfg" (28 Sep 2001, 1503 Bytes) of package /linux/misc/old/pikt-1.19.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ///////////////////////////////////////////////////////////////////////////////
    2 //
    3 // acctmgr_common_programs.cfg
    4 // 
    5 ///////////////////////////////////////////////////////////////////////////////
    6 	use Getopt::Std ;
    7 	getopts('hdtvmD') ;
    8 	$HELP = $opt_h ;
    9 	$DEBUG = $opt_d ;
   10 	$TEST = $opt_t ;
   11 	$VERBOSE = $opt_v ;
   12 	$MAKE = $opt_m ;
   13 	$DAEMON = $opt_D ;	# or non-interactive
   14 	
   15 	sub docmd {
   16 	
   17 		if ($TEST || $DEBUG) {
   18 			print "$_[0]\n" ;
   19 		}
   20 		if (! $DEBUG) {
   21 			system($_[0]) ;
   22 		}
   23 	
   24 	}
   25 	
   26 	sub print_mail {
   27 	
   28 		if ($TEST || $DEBUG) {
   29 			print "$_[0]\n" ;
   30 		}
   31 		if (! $DEBUG) {
   32 			print MAIL "$_[0]\n" ;
   33 		}
   34 	
   35 	}
   36 	
   37 	sub fail_message {
   38 	
   39 		if ($TEST || $DEBUG || ! $DAEMON) {
   40 			print "$_[0]\n" ;
   41 		}
   42 		if (! $DEBUG && $DAEMON) {
   43 			open(MAIL, "|$MAIL -s 'acctmgr' $OPERATOR") || die("open(\"|\$MAIL ...\"): $!") ;
   44 			print MAIL "$_[0]\n" ;
   45 			close(MAIL) ;
   46 		}
   47 	
   48 	}
   49 	
   50 	# this may go unused in this particular script
   51 	sub getid {
   52 	
   53 		local($key, $database, $ypmatch) = @_ ;
   54 		local($match) ;
   55 	
   56 #ifndef acctmgrmake
   57 		if (! $ypmatch) {
   58 			$cmd = sprintf "=ssh %s -n \"grep '^$key:' =acctmgrnisdir/$database\"", "=nismaster" ;
   59 			open(GREP, "$cmd 2> /dev/null |") ;
   60 			$match = <GREP> ;
   61 			chomp $match ;
   62 			close(GREP) ;
   63 		} else {
   64 #endifdef
   65 		open(YPMATCH, "=ypmatch $key $database 2> /dev/null |") ;
   66 		$match = <YPMATCH> ;
   67 		chomp $match ;
   68 		close(YPMATCH) ;
   69 #ifndef acctmgrmake
   70 		}
   71 #endifdef
   72 		(split(/:/, $match))[2] ;
   73 	
   74 	}
   75 ///////////////////////////////////////////////////////////////////////////////