Automatic registration for parms ending in "_password".
All program parms whose names end in "_password" will have their values
registered so that they won't be printed out by print.tcl functions.
Change-Id: I86f9c5971954c840e4bf7606a06c54beb07d5c9b
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/opt.tcl b/lib/opt.tcl
index b9b10f9..0c2a76e 100755
--- a/lib/opt.tcl
+++ b/lib/opt.tcl
@@ -272,6 +272,16 @@
if { $_opt_debug_ } { printn }
}
+ # Automatically register any parameter whose name ends in "_password" to
+ # prevent printing of password.
+ regsub -all ":" "${longoptions} ${pos_parms}" {} parm_names
+ foreach parm_name $parm_names {
+ if { [string match *password $parm_name] } {
+ global $parm_name
+ register_passwords [set $parm_name]
+ }
+ }
+
if { $h || $help } {
if { [info proc help] != "" } {
help