|
|
As with most managers that support network operations,
the template manager accepts a single command line argument:
the host name.
getopt(TCL_ADM)
is used to parse command line options of UNIX utilities.
Template procedure: ParseCommandLine
proc ParseCommandLine {} {
global argv argc opterr optind appvals
# scan for commandline flags
set optString ""
set argc [llength $argv]
set opterr 0
while {[set opt [getopt $argc $argv $optString]] != -1} {
case $opt {
{?} {
Usage; Exit 1
}
}
}
# process commandline arguments
set optCount [expr "$argc - $optind"]
# take managed host name as a command line argument
if {$appvals(openhost)} {
if {$optCount} {
set appvals(managedhost) [lindex $argv $optind]
incr optCount -1
}
}
if {$optCount > 0} {
Usage; Exit 1
}
}
See also: