forked from hummypkg/webif
New versions of {system hostname}, {system ip} using Jim API
This commit is contained in:
parent
2057c7ac75
commit
743ca7b75f
|
@ -30,7 +30,7 @@ proc {system hostname} {} {
|
||||||
proc {system ip} {} {
|
proc {system ip} {} {
|
||||||
# try for a usable IP address of the machine (w/o parsing hosts file)
|
# try for a usable IP address of the machine (w/o parsing hosts file)
|
||||||
set ip "127.0.0.1"
|
set ip "127.0.0.1"
|
||||||
if {![catch {set mysock [socket dgram "[os.gethostname]:0"]]}]} {
|
if {![catch {set mysock [socket dgram "[os.gethostname]:0"]}]} {
|
||||||
set myip ""
|
set myip ""
|
||||||
catch { set myip [lindex [split [$mysock sockname] ":"] 0]
|
catch { set myip [lindex [split [$mysock sockname] ":"] 0]
|
||||||
$mysock close }
|
$mysock close }
|
||||||
|
|
Loading…
Reference in New Issue