#! /bin/sh # # Copyright 1999 Illinois Institute of Technology # # See the file "LICENSE" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # # Look for tclsh in the user's PATH. \ exec tclsh "$0" ${1+"$@"} global env if [ catch { set mxtclnet_dir [ file join $env(MXDIR) lib mxtclnet ] } ] { set mxtclnet_dir [ pwd ] } source [ file join $mxtclnet_dir mxnet.tcl ] set argv1 [ lindex $argv 0 ] if { $argv1 == "" } { puts "" puts "Usage: mxput record_name.field values ..." puts " mxput hostname:record_name.field values ..." puts " mxput hostname@port:record_name.field values ..." puts "" exit 100 } set status [ catch { MxNet::parse_address $argv1 } address_list ] if { $status != 0 } { puts "MXE_ILLEGAL_ARGUMENT: '$argv1' is not a valid address." exit 1 } set server_hostname [ lindex $address_list 0 ] set server_port [ lindex $address_list 1 ] set record_field_name [ lindex $address_list 2 ] set put_argument_list [ lrange $argv 1 end ] set status \ [ catch { MxNet::connect_to_server $server_hostname $server_port } server ] if { $status != 0 } { set t "MXE_NETWORK_IO_ERROR: Unable to connect to server " append t "'$server_hostname@$server_port'." puts $t exit 2 } set status \ [ catch { MxNet::put $server $record_field_name $put_argument_list } response ] if { $status != 0 } { puts "$response" exit 3 } if { $response != "" } { puts $response exit 4 } exit 0