Hostname: Difference between revisions
m
→{{header|Wren}}: Minor tidy
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 38:
=={{header|Arc}}==
<syntaxhighlight lang="arc">(system "hostname -f")</syntaxhighlight>
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">print sys\hostname</syntaxhighlight>
{{out}}
<pre>drkameleons-Mac.home</pre>
=={{header|AutoHotkey}}==
Line 274 ⟶ 282:
=={{header|Frink}}==
<syntaxhighlight lang="frink">callJava["java.net.InetAddress", "getLocalHost"].getHostName[]</syntaxhighlight>
=={{header|FutureBasic}}==
include "NSLog.incl"
NSLog( @"%@", fn ProcessInfoHostName )
HandleEvents
</syntaxhighlight>
=={{header|Gambas}}==
Line 360 ⟶ 377:
=={{header|Java}}==
<syntaxhighlight lang="java">
import java.net.InetAddress;
import java.net.UnknownHostException;
</syntaxhighlight>
<syntaxhighlight lang="java">
System.out.println(InetAddress.getLocalHost().getHostName());▼
void printHostname()
InetAddress localhost = InetAddress.getLocalHost();
▲}</syntaxhighlight>
</syntaxhighlight>
<pre>
penguin
</pre>
=={{header|JavaScript}}==
Line 904 ⟶ 925:
=={{header|Slate}}==
<syntaxhighlight lang="slate">Platform current nodeName</syntaxhighlight>
=={{header|Slope}}==
<syntaxhighlight lang="slope">(hostname)</syntaxhighlight>
=={{header|Smalltalk}}==
Line 1,015 ⟶ 1,039:
End Sub</syntaxhighlight>
=={{header|V (Vlang)}}==
In Vlang, the "main()" entry point and declaration can be skipped in one file programs and when used like a script.
<syntaxhighlight lang="v (vlang)">import os
println(os.hostname())</syntaxhighlight>
Line 1,026 ⟶ 1,050:
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to get it for us.
<syntaxhighlight lang="
class Host {
foreign static name() // the code for this is provided by Go
Line 1,035 ⟶ 1,059:
which we embed in the following Go program and run it.
{{libheader|WrenGo}}
<syntaxhighlight lang="go">/*
package main
Line 1,052 ⟶ 1,076:
func main() {
vm := wren.NewVM()
fileName := "
methodMap := wren.MethodMap{"static name()": hostname}
classMap := wren.ClassMap{"Host": wren.NewClass(nil, nil, methodMap)}
|