OSF DCE Administration Guide--Core Components
Writing Scripts and dcecp Objects
parseargs "" local_args -no_leftovers
if { [info local help_prose]>0}{return }
if { [llength $local_args]>1}{
error "Unrecognized argument [lindex $local_args 1]."
} elseif { [llength $local_args] ==0}{error "No user name."
} else { set account_name $local_args }
# Take the first element of the account_name in order to
# eliminate list nesting.
set account_name [lindex $account_name 0]
set _dcp_principals [principal catalog -simplename]
# Show each account that has been requested.
foreach element $account_name {
if { [lsearch $_dcp_principals $element] == -1 } {
error "User \"$element\" does not exist."
} else {
set _dcp_user_attributes [principal show $element]
}
set _dcp_accounts [account catalog -simplename]
if { [lsearch $_dcp_accounts $element] == -1 } {
error "User \"$element\" does not exist."
} else {
set _dcp_user_attributes [format "%s\n%s" \
$_dcp_user_attributes [account show $element -all]]
}
}
return $_dcp_user_attributes
}
3.2.2 Usingthe parseargs Procedure
Task objects and scripts that take arguments or options can call the parseargs procedure
to parse arguments passed along with the object or script invocation. The parseargs
procedure is a script in a separate file that provides a convenient and reusable method for
argument parsing within a dcecp script. The basic syntax is
parseargs parse_options local_args args
124243 Tandem Computers Incorporated 3− 11