#
# printAttributes - prints the attributes for any objects specified or 
# for all objects if no objects are specified.
#
# Arguments:
# 
# options - a list of options to control the types of attributes printed. 
# Every option in the list of option names must be a valid option to the 
# wscp attributes command (for example, -required or -cloneOnly)
# AND the option name must begin with a "-".
#
# objects - a list of objects whose attributes are to be printed.
# 
# The file init.tcl must be loaded prior to using this procedure.
#

proc printAttributes {{options all} {objects all} args} {
    global OBJECTS
    if {[string first "-" $options] != 0} {
	set objects $options
	set options ""
    }
    if {[string compare $objects "all"] == 0} {set objects $OBJECTS}
    if {$args != ""} {
	foreach arg $args {
	    lappend objects $arg
	}
    }

    foreach o $objects { 
	set cmd [concat $o attributes $options]
	puts "# $cmd"
	set result [eval $cmd]
	puts $result
	
    }
}
printAttributes