# TWAPI example
# Show the services that depend on the specified service
# Usage example: tclsh showservicedependents.example SERVICENAME

package require twapi

if {$argc != 1} {
    puts stderr "Usage: [info nameofexecutable] $argv0 SERVICENAME"
    exit 1
}

# Convert the service name to the internal name
set svcname [twapi::get_service_internal_name [lindex $argv 0]]

set services [list ]
array set dependents [twapi::get_dependent_service_status $svcname]
if {[array size dependents]} {
   puts "Dependents:"
   puts [join [array names dependents] \n]
} else {
    puts "Service has no dependents."
}
   
