| Michael Walsh | 24f9183 | 2018-02-15 17:19:54 -0600 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 | #\ | 
 | 3 | exec wish "$0" -- ${1+"$@"} | 
 | 4 |  | 
 | 5 | source [exec bash -c "which source.tcl"] | 
 | 6 | my_source [list print.tcl opt.tcl] | 
 | 7 |  | 
 | 8 | longoptions test_mode:=0 quiet:=0 | 
 | 9 | pos_parms | 
 | 10 |  | 
 | 11 |  | 
 | 12 | # Create help dictionary for call to gen_print_help. | 
 | 13 | set help_dict [dict create\ | 
 | 14 |   ${program_name} [list "${program_name} will..."]\ | 
 | 15 | ] | 
 | 16 |  | 
 | 17 |  | 
 | 18 | proc help {} { | 
 | 19 |  | 
 | 20 |   gen_print_help | 
 | 21 |  | 
 | 22 | } | 
 | 23 |  | 
 | 24 |  | 
 | 25 | proc exit_proc { {ret_code 0} } { | 
 | 26 |  | 
| Michael Walsh | 410b178 | 2019-10-22 15:56:18 -0500 | [diff] [blame] | 27 |   # Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). | 
| Michael Walsh | 24f9183 | 2018-02-15 17:19:54 -0600 | [diff] [blame] | 28 |  | 
 | 29 |   dprint_executing | 
 | 30 |   dprint_var ret_code | 
 | 31 |  | 
 | 32 |   # Your code here. | 
 | 33 |  | 
 | 34 |   qprint_pgm_footer | 
 | 35 |  | 
 | 36 |   exit $ret_code | 
 | 37 |  | 
 | 38 | } | 
 | 39 |  | 
 | 40 |  | 
 | 41 | proc validate_parms {} { | 
 | 42 |  | 
 | 43 |   trap { exit_proc } [list SIGTERM SIGINT] | 
 | 44 |  | 
 | 45 |   # Your code here. | 
 | 46 |  | 
 | 47 | } | 
 | 48 |  | 
 | 49 |  | 
 | 50 | # Main | 
 | 51 |  | 
 | 52 |   gen_get_options $argv | 
 | 53 |  | 
 | 54 |   validate_parms | 
 | 55 |  | 
 | 56 |   qprint_pgm_header | 
 | 57 |  | 
 | 58 |   exit_proc |