!+ ! NAME ! disk_cli_utils ! DESCRIPTION ! This module contains the cli interface for the disk report tool. ! The CLD file for the tool is called disk.cld and contains a fairly ! large array of qualifiers for the tool. ! ! RETURN VALUE ! ! HISTORY ! 6/88 Bauer Initial version for disk_report tool. ! !- MODULE disk$cli IDENT 'v1.0'; ! ! Constant Declarations ! CONSTANT CLI$_NEGATED EXTERNAL INTEGER; ! End of input list hit CONSTANT CLI$_ABSENT EXTERNAL INTEGER; ! End of input list hit CONSTANT CLI$_PRESENT EXTERNAL INTEGER; ! Qualifier exists CONSTANT CLI$_LOCPRES EXTERNAL INTEGER; ! Local qualifier exists CONSTANT SS$_NORMAL EXTERNAL INTEGER; ! Good status CONSTANT MAX_BLOCKS_PERCENT = 1; CONSTANT CUM_BLOCKS_PERCENT = 2; CONSTANT MAX_REPORTS = 20; ! ! EXTERNAL Data References ! DECLARE command_line : EXTERNAL STRING; DECLARE percent_type : EXTERNAL INTEGER; DECLARE input_file_number : EXTERNAL INTEGER; DECLARE input_file_tree : EXTERNAL TREE (INTEGER) OF STRING; DECLARE output_file : EXTERNAL STRING; DECLARE summary_report_flag : EXTERNAL BOOLEAN; DECLARE complete_report_flag : EXTERNAL BOOLEAN; DECLARE root_report_flag : EXTERNAL BOOLEAN; DECLARE top_dir_report_number : EXTERNAL INTEGER; DECLARE slash_merged_flag : EXTERNAL BOOLEAN; DECLARE master_summary_report_flag : EXTERNAL INTEGER; DECLARE table_only : EXTERNAL BOOLEAN; DECLARE max_depth : EXTERNAL INTEGER; DECLARE over_block_size : EXTERNAL INTEGER; !+ ! NAME ! parse_command_line -- extracts CLD parameters for tool ! ! DESCRIPTION ! ! RETURN VALUE ! ! HISTORY ! 6/88 Bauer Initial implementation. ! !- PROCEDURE parse_command_line; EXTERNAL PROCEDURE cli$get_value (STRING, STRING, INTEGER) OF INTEGER; ! CLI system routine EXTERNAL PROCEDURE cli$present (STRING) OF INTEGER; ! CLI system routine EXTERNAL PROCEDURE read_root_map_file (STRING); ! Reads in the master root map file EXTERNAL PROCEDURE read_idl_file (STRING); EXTERNAL PROCEDURE sys$exit ( VALUE INTEGER ); EXTERNAL PROCEDURE read_disk_size_table (STRING); DECLARE dummy : INTEGER; ! Dummy parameter DECLARE ret_status : INTEGER; ! Have to return status somewhere DECLARE input_file_name : STRING; ! Log file name DECLARE temp : STRING; ! Dummy string WHILE cli$get_value('directory_log_file', input_file_name, dummy) ! Get all LOG file names <> CLI$_ABSENT; IF INDEX(input_file_name,'.IDL') <> 0 THEN CALL read_idl_file (input_file_name); ELSE input_file_number = input_file_number + 1; ! And store for later scanning IF input_file_number > MAX_REPORTS THEN write '%DISKRPT-E-TOOMANYLOGS, Maximum number of directory log files exceeded (', MAX_REPORTS, ') - constant can be changed in software'; CALL SYS$EXIT(1); END IF; input_file_tree(input_file_number) = input_file_name; END IF; END WHILE; IF cli$present ('output') = CLI$_PRESENT ! Get output file name THEN ret_status = cli$get_value('output', output_file, dummy); ELSE output_file = 'SYS$OUTPUT'; END IF; IF cli$present('master') = CLI$_PRESENT ! Merged table? THEN slash_merged_flag = TRUE; table_only = FALSE; IF cli$get_value ('master', temp, dummy) = SS$_NORMAL ! Merged master map table THEN CALL read_root_map_file (temp); IF cli$present('table_only') = CLI$_PRESENT ! Only dump master roots from the THEN ! input map table table_only = TRUE; END IF; END IF; IF cli$present('msummary') = CLI$_NEGATED THEN master_summary_report_flag = 0; ELSE IF cli$get_value ('msummary', temp, dummy) = SS$_NORMAL THEN master_summary_report_flag = 1; ELSE master_summary_report_flag = 2; END IF; END IF; ELSE slash_merged_flag = FALSE; END IF; percent_type = MAX_BLOCKS_PERCENT; ! Use Total Disk Space as denominator IF cli$present ('percent') = CLI$_PRESENT ! What types of percentages do you want THEN ret_status = cli$get_value('percent', temp, dummy); IF temp[1..3] = 'TOT' THEN percent_type = MAX_BLOCKS_PERCENT; ! Use Total Disk Space as denominator ELSE percent_type = CUM_BLOCKS_PERCENT; ! Use Allocated Disk Space as denominator END IF; END IF; IF cli$present ('summary') = CLI$_NEGATED ! No Summary report? THEN summary_report_flag = FALSE; ELSE summary_report_flag = TRUE; END IF; IF cli$present ('root') = CLI$_NEGATED ! No root report? THEN root_report_flag = FALSE; ELSE root_report_flag = TRUE; END IF; IF cli$present ('complete') = CLI$_PRESENT ! Complete directory report? THEN complete_report_flag = TRUE; ELSE complete_report_flag = FALSE; END IF; IF cli$present ('top_directories') = CLI$_PRESENT ! Top directory report? THEN IF cli$get_value ('top_directories', temp, dummy) = SS$_NORMAL THEN top_dir_report_number = INTEGER(temp); END IF; ELSE IF cli$present ('top_directories') = CLI$_NEGATED THEN top_dir_report_number = 0; ELSE top_dir_report_number = 10; END IF; END IF; IF cli$present ('over_block_size') = CLI$_PRESENT ! Ignore dirs not over N blocks THEN ret_status = cli$get_value('over_block_size', temp, dummy); over_block_size = INTEGER (temp); ELSE over_block_size = 0; END IF; IF cli$present ('max_depth') = CLI$_PRESENT ! Ignore dirs more than N levels deep THEN ret_status = cli$get_value('max_depth', temp, dummy); max_depth = INTEGER (temp); ELSE max_depth = 999; ! Make it so high all passes END IF; IF cli$present ('disk_size_table') = CLI$_PRESENT THEN ret_status = cli$get_value('disk_size_table', temp, dummy); CALL read_disk_size_table(temp); END IF; ret_status = cli$get_value('$LINE', command_line, dummy); ! What command was entered END PROCEDURE; END MODULE;