JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr#!/usr/bin/perl # hostconfig-lib.pl # These are functions specific to the hostconfig file # used by darwin # written by Michael A. Peters sub hostconfig_settings { #### # # This subroutine reads the hostconfig file into an array # and outputs a second array containing matched pairs of # the startup action and what the startup action is set to # #### local($conffile, @hconf); $conffile = "$config{'hostconfig'}"; open(LOCAL, "<".$conffile); @conf = ; close(LOCAL); @conf = grep /^\w/, @conf; while (<@conf>) { push @hconf, [ split /=/ ]; } return @hconf; } sub hostconfig_gather { #### # # Gathers information about an action item that is set in the hostconfig # file. # # It takes one arguement- the type of info wanted (description or # scriptname) # # It outputs a hash where the action item is the key, and what was # requested is the value. # # Thus, we can use the hash to find out what startup script is # associated with the MAILSERVER action or what description goes with # that action. # # Originally I wanted to output an array with two elements where the # first was one type of hash, and the second element was the second type # of hash, but I couldn't get that to work (array of hashes) # #### local ($hash_type, @startupdir, $plist, @action_to_description, @action_to_script, @sec_action_to_description, @sec_action_to_script, $element, @ls, @script, $a, $action_name, @param, $description); my($hash_type) = @_; @startupdir = (); @startupdir = split (/:/, $config{'startup_dirs'}); $plist = $config{'plist'}; @action_to_description = (); @action_to_script = (); @sec_action_to_description = (); @sec_action_to_script = (); foreach $element (@startupdir) { if ( -d "$element" ) { opendir (LOCAL, $element); @ls = readdir LOCAL; closedir LOCAL; shift @ls; shift @ls; foreach $a (@ls) { #we need BOTH an executable and a plist- or its useless. #executable script has to be in a directory of the same #name for some reason if (( -x "$element/$a/$a") && ( -e "$element/$a/$plist")) { #Get the startup action associated with script open (SCRIPT, "$element/$a/$a"); @script =