Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Hostname/00-META.yaml
Normal file
5
Task/Hostname/00-META.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
category:
|
||||
- Networking and Web Interaction
|
||||
from: http://rosettacode.org/wiki/Hostname
|
||||
note: Programming environment operations
|
||||
4
Task/Hostname/00-TASK.txt
Normal file
4
Task/Hostname/00-TASK.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
;Task:
|
||||
Find the name of the host on which the routine is running.
|
||||
<br><br>
|
||||
|
||||
3
Task/Hostname/ALGOL-68/hostname.alg
Normal file
3
Task/Hostname/ALGOL-68/hostname.alg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
STRING hostname;
|
||||
get(read OF execve child pipe("/bin/hostname","hostname",""), hostname);
|
||||
print(("hostname: ", hostname, new line))
|
||||
2
Task/Hostname/AWK/hostname.awk
Normal file
2
Task/Hostname/AWK/hostname.awk
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$ awk 'BEGIN{print ENVIRON["HOST"]}'
|
||||
E51A08ZD
|
||||
7
Task/Hostname/Ada/hostname.ada
Normal file
7
Task/Hostname/Ada/hostname.ada
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with GNAT.Sockets;
|
||||
|
||||
procedure Demo is
|
||||
begin
|
||||
Put_Line (GNAT.Sockets.Host_Name);
|
||||
end Demo;
|
||||
1
Task/Hostname/Aikido/hostname.aikido
Normal file
1
Task/Hostname/Aikido/hostname.aikido
Normal file
|
|
@ -0,0 +1 @@
|
|||
println (System.hostname)
|
||||
1
Task/Hostname/AppleScript/hostname.applescript
Normal file
1
Task/Hostname/AppleScript/hostname.applescript
Normal file
|
|
@ -0,0 +1 @@
|
|||
host name of (system info)
|
||||
1
Task/Hostname/Arc/hostname.arc
Normal file
1
Task/Hostname/Arc/hostname.arc
Normal file
|
|
@ -0,0 +1 @@
|
|||
(system "hostname -f")
|
||||
1
Task/Hostname/Arturo/hostname.arturo
Normal file
1
Task/Hostname/Arturo/hostname.arturo
Normal file
|
|
@ -0,0 +1 @@
|
|||
print sys\hostname
|
||||
1
Task/Hostname/AutoHotkey/hostname-1.ahk
Normal file
1
Task/Hostname/AutoHotkey/hostname-1.ahk
Normal file
|
|
@ -0,0 +1 @@
|
|||
MsgBox % A_ComputerName
|
||||
2
Task/Hostname/AutoHotkey/hostname-2.ahk
Normal file
2
Task/Hostname/AutoHotkey/hostname-2.ahk
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
for objItem in ComObjGet("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_ComputerSystem")
|
||||
MsgBox, % "Hostname:`t" objItem.Name
|
||||
4
Task/Hostname/BBC-BASIC/hostname.basic
Normal file
4
Task/Hostname/BBC-BASIC/hostname.basic
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
INSTALL @lib$+"SOCKLIB"
|
||||
PROC_initsockets
|
||||
PRINT "hostname: " FN_gethostname
|
||||
PROC_exitsockets
|
||||
1
Task/Hostname/BaCon/hostname.bacon
Normal file
1
Task/Hostname/BaCon/hostname.bacon
Normal file
|
|
@ -0,0 +1 @@
|
|||
PRINT "Hostname: ", HOSTNAME$
|
||||
1
Task/Hostname/Batch-File/hostname.bat
Normal file
1
Task/Hostname/Batch-File/hostname.bat
Normal file
|
|
@ -0,0 +1 @@
|
|||
Hostname
|
||||
1
Task/Hostname/C-sharp/hostname.cs
Normal file
1
Task/Hostname/C-sharp/hostname.cs
Normal file
|
|
@ -0,0 +1 @@
|
|||
System.Net.Dns.GetHostName();
|
||||
10
Task/Hostname/C/hostname.c
Normal file
10
Task/Hostname/C/hostname.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char name[_POSIX_HOST_NAME_MAX + 1];
|
||||
return gethostname(name, sizeof name) == -1 || printf("%s\n", name) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
15
Task/Hostname/COBOL/hostname.cobol
Normal file
15
Task/Hostname/COBOL/hostname.cobol
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
identification division.
|
||||
program-id. hostname.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 hostname pic x(256).
|
||||
01 nullpos pic 999 value 1.
|
||||
|
||||
procedure division.
|
||||
call "gethostname" using hostname by value length of hostname
|
||||
string hostname delimited by low-value into hostname
|
||||
with pointer nullpos
|
||||
display "Host: " hostname(1 : nullpos - 1)
|
||||
goback.
|
||||
end program hostname.
|
||||
1
Task/Hostname/Clojure/hostname-1.clj
Normal file
1
Task/Hostname/Clojure/hostname-1.clj
Normal file
|
|
@ -0,0 +1 @@
|
|||
(.. java.net.InetAddress getLocalHost getHostName)
|
||||
1
Task/Hostname/Clojure/hostname-2.clj
Normal file
1
Task/Hostname/Clojure/hostname-2.clj
Normal file
|
|
@ -0,0 +1 @@
|
|||
java -cp clojure.jar clojure.main -e "(.. java.net.InetAddress getLocalHost getHostName)"
|
||||
2
Task/Hostname/CoffeeScript/hostname.coffee
Normal file
2
Task/Hostname/CoffeeScript/hostname.coffee
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
os = require 'os'
|
||||
console.log os.hostname()
|
||||
4
Task/Hostname/Common-Lisp/hostname-1.lisp
Normal file
4
Task/Hostname/Common-Lisp/hostname-1.lisp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(defun get-host-name ()
|
||||
#+(or sbcl ccl) (machine-instance)
|
||||
#+clisp (let ((s (machine-instance))) (subseq s 0 (position #\Space s)))
|
||||
#-(or sbcl ccl clisp) (error "get-host-name not implemented"))
|
||||
8
Task/Hostname/Common-Lisp/hostname-2.lisp
Normal file
8
Task/Hostname/Common-Lisp/hostname-2.lisp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(cffi:defcfun ("gethostname" c-gethostname) :int
|
||||
(buf :pointer) (len :unsigned-long))
|
||||
|
||||
(defun get-hostname ()
|
||||
(cffi:with-foreign-object (buf :char 256)
|
||||
(unless (zerop (c-gethostname buf 256))
|
||||
(error "Can't get hostname"))
|
||||
(values (cffi:foreign-string-to-lisp buf))))
|
||||
2
Task/Hostname/Common-Lisp/hostname-3.lisp
Normal file
2
Task/Hostname/Common-Lisp/hostname-3.lisp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
BOA> (get-hostname)
|
||||
"aurora"
|
||||
1
Task/Hostname/Crystal/hostname.crystal
Normal file
1
Task/Hostname/Crystal/hostname.crystal
Normal file
|
|
@ -0,0 +1 @@
|
|||
hostname = System.hostname
|
||||
5
Task/Hostname/D/hostname.d
Normal file
5
Task/Hostname/D/hostname.d
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import std.stdio, std.socket;
|
||||
|
||||
void main() {
|
||||
writeln(Socket.hostName());
|
||||
}
|
||||
16
Task/Hostname/Delphi/hostname.delphi
Normal file
16
Task/Hostname/Delphi/hostname.delphi
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
program ShowHostName;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses Windows;
|
||||
|
||||
var
|
||||
lHostName: array[0..255] of char;
|
||||
lBufferSize: DWORD;
|
||||
begin
|
||||
lBufferSize := 256;
|
||||
if GetComputerName(lHostName, lBufferSize) then
|
||||
Writeln(lHostName)
|
||||
else
|
||||
Writeln('error getting host name');
|
||||
end.
|
||||
1
Task/Hostname/E/hostname.e
Normal file
1
Task/Hostname/E/hostname.e
Normal file
|
|
@ -0,0 +1 @@
|
|||
makeCommand("hostname")()[0].trim()
|
||||
1
Task/Hostname/Emacs-Lisp/hostname.l
Normal file
1
Task/Hostname/Emacs-Lisp/hostname.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(system-name)
|
||||
1
Task/Hostname/Erlang/hostname.erl
Normal file
1
Task/Hostname/Erlang/hostname.erl
Normal file
|
|
@ -0,0 +1 @@
|
|||
Host = net_adm:localhost().
|
||||
1
Task/Hostname/F-Sharp/hostname.fs
Normal file
1
Task/Hostname/F-Sharp/hostname.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
printfn "%s" (System.Net.Dns.GetHostName())
|
||||
2
Task/Hostname/Factor/hostname.factor
Normal file
2
Task/Hostname/Factor/hostname.factor
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
USE: io.sockets
|
||||
host-name
|
||||
3
Task/Hostname/Forth/hostname.fth
Normal file
3
Task/Hostname/Forth/hostname.fth
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
include unix/socket.fs
|
||||
|
||||
hostname type
|
||||
5
Task/Hostname/Fortran/hostname-1.f
Normal file
5
Task/Hostname/Fortran/hostname-1.f
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
program HostTest
|
||||
character(len=128) :: name
|
||||
call hostnm(name)
|
||||
print *, name
|
||||
end program HostTest
|
||||
38
Task/Hostname/Fortran/hostname-2.f
Normal file
38
Task/Hostname/Fortran/hostname-2.f
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
program test_hostname
|
||||
use, intrinsic :: iso_c_binding
|
||||
implicit none
|
||||
interface !to function: int gethostname(char *name, size_t namelen);
|
||||
integer(c_int) function gethostname(name, namelen) bind(c)
|
||||
use, intrinsic :: iso_c_binding, only: c_char, c_int, c_size_t
|
||||
integer(c_size_t), value, intent(in) :: namelen
|
||||
character(len=1,kind=c_char), dimension(namelen), intent(inout) :: name
|
||||
end function gethostname
|
||||
end interface
|
||||
integer(c_int) :: status
|
||||
integer,parameter :: HOST_NAME_MAX=255
|
||||
character(kind=c_char,len=1),dimension(HOST_NAME_MAX) :: cstr_hostname
|
||||
integer(c_size_t) :: lenstr
|
||||
character(len=:),allocatable :: hostname
|
||||
lenstr = HOST_NAME_MAX
|
||||
status = gethostname(cstr_hostname, lenstr)
|
||||
hostname = c_to_f_string(cstr_hostname)
|
||||
write(*,*) hostname, len(hostname)
|
||||
|
||||
contains
|
||||
! convert c_string to f_string
|
||||
pure function c_to_f_string(c_string) result(f_string)
|
||||
use, intrinsic :: iso_c_binding, only: c_char, c_null_char
|
||||
character(kind=c_char,len=1), intent(in) :: c_string(:)
|
||||
character(len=:), allocatable :: f_string
|
||||
integer i, n
|
||||
i = 1
|
||||
do
|
||||
if (c_string(i) == c_null_char) exit
|
||||
i = i + 1
|
||||
end do
|
||||
n = i - 1 ! exclude c_null_char
|
||||
allocate(character(len=n) :: f_string)
|
||||
f_string = transfer(c_string(1:n), f_string)
|
||||
end function c_to_f_string
|
||||
|
||||
end program test_hostname
|
||||
13
Task/Hostname/FreeBASIC/hostname.basic
Normal file
13
Task/Hostname/FreeBASIC/hostname.basic
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
' On Windows 10, the command line utility HOSTNAME.EXE prints the 'hostname' to the console.
|
||||
' We can execute this remotely and read from its 'stdin' stream as follows:
|
||||
|
||||
Dim As String hostname
|
||||
Open Pipe "hostname" For Input As #1
|
||||
Input #1, hostname
|
||||
Close #1
|
||||
Print hostname
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
1
Task/Hostname/Friendly-interactive-shell/hostname-1.fish
Normal file
1
Task/Hostname/Friendly-interactive-shell/hostname-1.fish
Normal file
|
|
@ -0,0 +1 @@
|
|||
hostname
|
||||
1
Task/Hostname/Friendly-interactive-shell/hostname-2.fish
Normal file
1
Task/Hostname/Friendly-interactive-shell/hostname-2.fish
Normal file
|
|
@ -0,0 +1 @@
|
|||
uname -n
|
||||
1
Task/Hostname/Frink/hostname.frink
Normal file
1
Task/Hostname/Frink/hostname.frink
Normal file
|
|
@ -0,0 +1 @@
|
|||
callJava["java.net.InetAddress", "getLocalHost"].getHostName[]
|
||||
3
Task/Hostname/FutureBasic/hostname.basic
Normal file
3
Task/Hostname/FutureBasic/hostname.basic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
include "NSLog.incl"
|
||||
NSLog( @"%@", fn ProcessInfoHostName )
|
||||
HandleEvents
|
||||
5
Task/Hostname/Gambas/hostname.gambas
Normal file
5
Task/Hostname/Gambas/hostname.gambas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Public Sub Main()
|
||||
|
||||
Print System.Host
|
||||
|
||||
End
|
||||
10
Task/Hostname/Go/hostname.go
Normal file
10
Task/Hostname/Go/hostname.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(os.Hostname())
|
||||
}
|
||||
1
Task/Hostname/Groovy/hostname.groovy
Normal file
1
Task/Hostname/Groovy/hostname.groovy
Normal file
|
|
@ -0,0 +1 @@
|
|||
println InetAddress.localHost.hostName
|
||||
1
Task/Hostname/Harbour/hostname.harbour
Normal file
1
Task/Hostname/Harbour/hostname.harbour
Normal file
|
|
@ -0,0 +1 @@
|
|||
? NetName()
|
||||
3
Task/Hostname/Haskell/hostname-1.hs
Normal file
3
Task/Hostname/Haskell/hostname-1.hs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Network.BSD
|
||||
main = do hostName <- getHostName
|
||||
putStrLn hostName
|
||||
19
Task/Hostname/Haskell/hostname-2.hs
Normal file
19
Task/Hostname/Haskell/hostname-2.hs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module GetHostName where
|
||||
|
||||
import Foreign.Marshal.Array ( allocaArray0, peekArray0 )
|
||||
import Foreign.C.Types ( CInt(..), CSize(..) )
|
||||
import Foreign.C.String ( CString, peekCString )
|
||||
import Foreign.C.Error ( throwErrnoIfMinus1_ )
|
||||
|
||||
getHostName :: IO String
|
||||
getHostName = do
|
||||
let size = 256
|
||||
allocaArray0 size $ \ cstr -> do
|
||||
throwErrnoIfMinus1_ "getHostName" $ c_gethostname cstr (fromIntegral size)
|
||||
peekCString cstr
|
||||
|
||||
foreign import ccall "gethostname"
|
||||
c_gethostname :: CString -> CSize -> IO CInt
|
||||
|
||||
main = do hostName <- getHostName
|
||||
putStrLn hostName
|
||||
1
Task/Hostname/IDL/hostname.idl
Normal file
1
Task/Hostname/IDL/hostname.idl
Normal file
|
|
@ -0,0 +1 @@
|
|||
hostname = GETENV('computername')
|
||||
3
Task/Hostname/Icon/hostname.icon
Normal file
3
Task/Hostname/Icon/hostname.icon
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
procedure main()
|
||||
write(&host)
|
||||
end
|
||||
13
Task/Hostname/J/hostname.j
Normal file
13
Task/Hostname/J/hostname.j
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
NB. Load the socket libraries
|
||||
|
||||
load 'socket'
|
||||
coinsert 'jsocket'
|
||||
|
||||
NB. fetch and implicitly display the hostname
|
||||
|
||||
> {: sdgethostname ''
|
||||
|
||||
NB. If fetching the hostname is the only reason for loading the socket libraries,
|
||||
NB. and the hostname is fetched only once, then use a 'one-liner' to accomplish it:
|
||||
|
||||
> {: sdgethostname coinsert 'jsocket' [ load 'socket'
|
||||
2
Task/Hostname/Java/hostname-1.java
Normal file
2
Task/Hostname/Java/hostname-1.java
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
4
Task/Hostname/Java/hostname-2.java
Normal file
4
Task/Hostname/Java/hostname-2.java
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
void printHostname() throws UnknownHostException {
|
||||
InetAddress localhost = InetAddress.getLocalHost();
|
||||
System.out.println(localhost.getHostName());
|
||||
}
|
||||
3
Task/Hostname/JavaScript/hostname.js
Normal file
3
Task/Hostname/JavaScript/hostname.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
var network = new ActiveXObject('WScript.Network');
|
||||
var hostname = network.computerName;
|
||||
WScript.echo(hostname);
|
||||
1
Task/Hostname/Jsish/hostname.jsish
Normal file
1
Task/Hostname/Jsish/hostname.jsish
Normal file
|
|
@ -0,0 +1 @@
|
|||
var hn = exec("hostname", {retAll:true}).data.trim();
|
||||
1
Task/Hostname/Julia/hostname.julia
Normal file
1
Task/Hostname/Julia/hostname.julia
Normal file
|
|
@ -0,0 +1 @@
|
|||
println(gethostname())
|
||||
1
Task/Hostname/K/hostname.k
Normal file
1
Task/Hostname/K/hostname.k
Normal file
|
|
@ -0,0 +1 @@
|
|||
_h
|
||||
7
Task/Hostname/Kotlin/hostname.kotlin
Normal file
7
Task/Hostname/Kotlin/hostname.kotlin
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// version 1.1.4
|
||||
|
||||
import java.net.InetAddress
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(InetAddress.getLocalHost().hostName)
|
||||
}
|
||||
1
Task/Hostname/LFE/hostname.lfe
Normal file
1
Task/Hostname/LFE/hostname.lfe
Normal file
|
|
@ -0,0 +1 @@
|
|||
(net_adm:localhost)
|
||||
1
Task/Hostname/Lasso/hostname-1.lasso
Normal file
1
Task/Hostname/Lasso/hostname-1.lasso
Normal file
|
|
@ -0,0 +1 @@
|
|||
[web_request->httpHost]
|
||||
35
Task/Hostname/Lasso/hostname-2.lasso
Normal file
35
Task/Hostname/Lasso/hostname-2.lasso
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
define host_name => thread {
|
||||
|
||||
data
|
||||
public initiated::date, // when the thread was initiated. Most likely at Lasso server startup
|
||||
private hostname::string // as reported by the servers hostname
|
||||
|
||||
public onCreate() => {
|
||||
.reset
|
||||
}
|
||||
|
||||
public reset() => {
|
||||
if(lasso_version(-lassoplatform) >> 'Win') => {
|
||||
protect => {
|
||||
local(process = sys_process('cmd',(:'hostname.exe')))
|
||||
#process -> wait
|
||||
.hostname = string(#process -> readstring) -> trim&
|
||||
#process -> close
|
||||
}
|
||||
else
|
||||
protect => {
|
||||
local(process = sys_process('/bin/hostname'))
|
||||
#process -> wait
|
||||
.hostname = string(#process -> readstring) -> trim&
|
||||
#process -> close
|
||||
}
|
||||
}
|
||||
.initiated = date(date -> format(`yyyyMMddHHmmss`)) // need to set format to get rid of nasty hidden fractions of seconds
|
||||
.hostname -> size == 0 ? .hostname = 'undefined'
|
||||
}
|
||||
|
||||
public asString() => .hostname
|
||||
|
||||
}
|
||||
|
||||
host_name
|
||||
8
Task/Hostname/Liberty-BASIC/hostname.basic
Normal file
8
Task/Hostname/Liberty-BASIC/hostname.basic
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
lpBuffer$=Space$(128) + Chr$(0)
|
||||
struct SIZE,sz As Long
|
||||
SIZE.sz.struct=Len(lpBuffer$)
|
||||
|
||||
calldll #kernel32, "GetComputerNameA",lpBuffer$ as ptr, SIZE as struct, result as Long
|
||||
CurrentComputerName$=Trim$(Left$(lpBuffer$, SIZE.sz.struct))
|
||||
|
||||
print CurrentComputerName$
|
||||
31
Task/Hostname/Limbo/hostname.limbo
Normal file
31
Task/Hostname/Limbo/hostname.limbo
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
implement Hostname;
|
||||
|
||||
include "sys.m"; sys: Sys;
|
||||
include "draw.m";
|
||||
|
||||
Hostname: module {
|
||||
init: fn(nil: ref Draw->Context, nil: list of string);
|
||||
};
|
||||
|
||||
init(nil: ref Draw->Context, nil: list of string)
|
||||
{
|
||||
sys = load Sys Sys->PATH;
|
||||
buf := array[Sys->ATOMICIO] of byte;
|
||||
|
||||
fd := sys->open("/dev/sysname", Sys->OREAD);
|
||||
if(fd == nil)
|
||||
die("Couldn't open /dev/sysname");
|
||||
|
||||
n := sys->read(fd, buf, len buf - 1);
|
||||
if(n < 1)
|
||||
die("Couldn't read /dev/sysname");
|
||||
|
||||
buf[n++] = byte '\n';
|
||||
sys->write(sys->fildes(1), buf, n);
|
||||
}
|
||||
|
||||
die(s: string)
|
||||
{
|
||||
sys->fprint(sys->fildes(2), "hostname: %s: %r", s);
|
||||
raise "fail:errors";
|
||||
}
|
||||
6
Task/Hostname/Lingo/hostname.lingo
Normal file
6
Task/Hostname/Lingo/hostname.lingo
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
sx = xtra("Shell").new()
|
||||
if the platform contains "win" then
|
||||
hostname = sx.shell_cmd("hostname", ["eol":RETURN]).line[1] -- win 7 or later
|
||||
else
|
||||
hostname = sx.shell_cmd("hostname", RETURN).line[1]
|
||||
end if
|
||||
1
Task/Hostname/LiveCode/hostname.livecode
Normal file
1
Task/Hostname/LiveCode/hostname.livecode
Normal file
|
|
@ -0,0 +1 @@
|
|||
answer the hostName
|
||||
2
Task/Hostname/Lua/hostname.lua
Normal file
2
Task/Hostname/Lua/hostname.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
socket = require "socket"
|
||||
print( socket.dns.gethostname() )
|
||||
10
Task/Hostname/M2000-Interpreter/hostname.m2000
Normal file
10
Task/Hostname/M2000-Interpreter/hostname.m2000
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Module Host {
|
||||
\\ one way
|
||||
Print computer$
|
||||
\\ second way
|
||||
Declare objNetwork "WScript.Network"
|
||||
With objNetwork, "ComputerName" as cName$
|
||||
Print cName$, cName$=Computer$
|
||||
Declare objNetwork Nothing
|
||||
}
|
||||
Host
|
||||
1
Task/Hostname/MATLAB/hostname.m
Normal file
1
Task/Hostname/MATLAB/hostname.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
[failed,hostname] = system('hostname')
|
||||
1
Task/Hostname/MIRC-Scripting-Language/hostname.mirc
Normal file
1
Task/Hostname/MIRC-Scripting-Language/hostname.mirc
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo -ag $host
|
||||
1
Task/Hostname/MUMPS/hostname.mumps
Normal file
1
Task/Hostname/MUMPS/hostname.mumps
Normal file
|
|
@ -0,0 +1 @@
|
|||
Write $Piece($System,":")
|
||||
1
Task/Hostname/Maple/hostname.maple
Normal file
1
Task/Hostname/Maple/hostname.maple
Normal file
|
|
@ -0,0 +1 @@
|
|||
Sockets:-GetHostName()
|
||||
1
Task/Hostname/Mathematica/hostname.math
Normal file
1
Task/Hostname/Mathematica/hostname.math
Normal file
|
|
@ -0,0 +1 @@
|
|||
$MachineName
|
||||
7
Task/Hostname/Modula-3/hostname.mod3
Normal file
7
Task/Hostname/Modula-3/hostname.mod3
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
MODULE Hostname EXPORTS Main;
|
||||
|
||||
IMPORT IO, OSConfig;
|
||||
|
||||
BEGIN
|
||||
IO.Put(OSConfig.HostName() & "\n");
|
||||
END Hostname.
|
||||
4
Task/Hostname/NetRexx/hostname.netrexx
Normal file
4
Task/Hostname/NetRexx/hostname.netrexx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols binary
|
||||
|
||||
say InetAddress.getLocalHost.getHostName
|
||||
1
Task/Hostname/NewLISP/hostname.l
Normal file
1
Task/Hostname/NewLISP/hostname.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(! "hostname")
|
||||
2
Task/Hostname/Nim/hostname.nim
Normal file
2
Task/Hostname/Nim/hostname.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import nativesockets
|
||||
echo getHostName()
|
||||
1
Task/Hostname/OCaml/hostname.ocaml
Normal file
1
Task/Hostname/OCaml/hostname.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
Unix.gethostname()
|
||||
7
Task/Hostname/Oberon-2/hostname.oberon
Normal file
7
Task/Hostname/Oberon-2/hostname.oberon
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
MODULE HostName;
|
||||
IMPORT
|
||||
OS:ProcessParameters,
|
||||
Out;
|
||||
BEGIN
|
||||
Out.Object("Host: " + ProcessParameters.GetEnv("HOSTNAME"));Out.Ln
|
||||
END HostName.
|
||||
9
Task/Hostname/Objeck/hostname.objeck
Normal file
9
Task/Hostname/Objeck/hostname.objeck
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use Net;
|
||||
|
||||
bundle Default {
|
||||
class Hello {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
TCPSocket->HostName()->PrintLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Task/Hostname/Objective-C/hostname-1.m
Normal file
1
Task/Hostname/Objective-C/hostname-1.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
NSLog(@"%@", [[NSProcessInfo processInfo] hostName]);
|
||||
1
Task/Hostname/Objective-C/hostname-2.m
Normal file
1
Task/Hostname/Objective-C/hostname-2.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
2010-09-16 16:20:00.000 Playground[1319:a0f] sierra117.local // Hostname is sierra117.local.
|
||||
1
Task/Hostname/Octave/hostname.octave
Normal file
1
Task/Hostname/Octave/hostname.octave
Normal file
|
|
@ -0,0 +1 @@
|
|||
uname().nodename
|
||||
1
Task/Hostname/OoRexx/hostname-1.rexx
Normal file
1
Task/Hostname/OoRexx/hostname-1.rexx
Normal file
|
|
@ -0,0 +1 @@
|
|||
say .oleObject~new('WScript.Network')~computerName
|
||||
1
Task/Hostname/OoRexx/hostname-2.rexx
Normal file
1
Task/Hostname/OoRexx/hostname-2.rexx
Normal file
|
|
@ -0,0 +1 @@
|
|||
say value('COMPUTERNAME',,'environment')
|
||||
1
Task/Hostname/OoRexx/hostname-3.rexx
Normal file
1
Task/Hostname/OoRexx/hostname-3.rexx
Normal file
|
|
@ -0,0 +1 @@
|
|||
address command 'hostname -f'
|
||||
1
Task/Hostname/OoRexx/hostname-4.rexx
Normal file
1
Task/Hostname/OoRexx/hostname-4.rexx
Normal file
|
|
@ -0,0 +1 @@
|
|||
address command "echo $HOSTNAME"
|
||||
7
Task/Hostname/OoRexx/hostname-5.rexx
Normal file
7
Task/Hostname/OoRexx/hostname-5.rexx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* Rexx */
|
||||
address command "echo $HOSTNAME | rxqueue"
|
||||
address command "hostname -f | rxqueue"
|
||||
loop q_ = 1 while queued() > 0
|
||||
parse pull hn
|
||||
say q_~right(2)':' hn
|
||||
end q_
|
||||
8
Task/Hostname/OoRexx/hostname-6.rexx
Normal file
8
Task/Hostname/OoRexx/hostname-6.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/* Rexx */
|
||||
qq = .rexxqueue~new()
|
||||
address command "echo $HOSTNAME | rxqueue"
|
||||
address command "hostname -f | rxqueue"
|
||||
loop q_ = 1 while qq~queued() > 0
|
||||
hn = qq~pull()
|
||||
say q_~right(2)':' hn
|
||||
end q_
|
||||
1
Task/Hostname/Oz/hostname.oz
Normal file
1
Task/Hostname/Oz/hostname.oz
Normal file
|
|
@ -0,0 +1 @@
|
|||
{System.showInfo {OS.getHostByName 'localhost'}.name}
|
||||
2
Task/Hostname/PARI-GP/hostname.parigp
Normal file
2
Task/Hostname/PARI-GP/hostname.parigp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
str = externstr("hostname")[1];
|
||||
str = externstr("uname -n")[1];
|
||||
1
Task/Hostname/PHP/hostname-1.php
Normal file
1
Task/Hostname/PHP/hostname-1.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo $_SERVER['HTTP_HOST'];
|
||||
1
Task/Hostname/PHP/hostname-2.php
Normal file
1
Task/Hostname/PHP/hostname-2.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo php_uname('n');
|
||||
1
Task/Hostname/PHP/hostname-3.php
Normal file
1
Task/Hostname/PHP/hostname-3.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo gethostname();
|
||||
4
Task/Hostname/PL-SQL/hostname.sql
Normal file
4
Task/Hostname/PL-SQL/hostname.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
SET serveroutput on
|
||||
BEGIN
|
||||
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME);
|
||||
END;
|
||||
8
Task/Hostname/Pascal/hostname.pas
Normal file
8
Task/Hostname/Pascal/hostname.pas
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Program HostName;
|
||||
|
||||
uses
|
||||
unix;
|
||||
|
||||
begin
|
||||
writeln('The name of this computer is: ', GetHostName);
|
||||
end.
|
||||
3
Task/Hostname/Perl/hostname.pl
Normal file
3
Task/Hostname/Perl/hostname.pl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
use Sys::Hostname;
|
||||
|
||||
$name = hostname;
|
||||
9
Task/Hostname/Phix/hostname.phix
Normal file
9
Task/Hostname/Phix/hostname.phix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(notonline)-->
|
||||
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (system_exec, file i/o)</span>
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">tmp</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"hostname.txt"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #000000;">cmd</span> <span style="color: #0000FF;">=</span> <span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">platform</span><span style="color: #0000FF;">()=</span><span style="color: #004600;">WINDOWS</span><span style="color: #0000FF;">?</span><span style="color: #008000;">"hostname"</span><span style="color: #0000FF;">:</span><span style="color: #008000;">"uname -n"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #0000FF;">{}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">system_exec</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"%s > %s"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">cmd</span><span style="color: #0000FF;">,</span><span style="color: #000000;">tmp</span><span style="color: #0000FF;">}),</span><span style="color: #000000;">4</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">string</span> <span style="color: #000000;">host</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">trim</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">get_text</span><span style="color: #0000FF;">(</span><span style="color: #000000;">tmp</span><span style="color: #0000FF;">))</span>
|
||||
<span style="color: #0000FF;">{}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">delete_file</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"hostname.txt"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #0000FF;">?</span><span style="color: #000000;">host</span>
|
||||
<!--
|
||||
1
Task/Hostname/PicoLisp/hostname-1.l
Normal file
1
Task/Hostname/PicoLisp/hostname-1.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(call 'hostname)
|
||||
1
Task/Hostname/PicoLisp/hostname-2.l
Normal file
1
Task/Hostname/PicoLisp/hostname-2.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(in '(hostname) (line T))
|
||||
5
Task/Hostname/Pike/hostname.pike
Normal file
5
Task/Hostname/Pike/hostname.pike
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import System;
|
||||
|
||||
int main(){
|
||||
write(gethostname() + "\n");
|
||||
}
|
||||
1
Task/Hostname/Pop11/hostname.pop11
Normal file
1
Task/Hostname/Pop11/hostname.pop11
Normal file
|
|
@ -0,0 +1 @@
|
|||
lvars host = sys_host_name();
|
||||
1
Task/Hostname/PowerBASIC/hostname-1.basic
Normal file
1
Task/Hostname/PowerBASIC/hostname-1.basic
Normal file
|
|
@ -0,0 +1 @@
|
|||
HOST NAME TO hostname$
|
||||
1
Task/Hostname/PowerBASIC/hostname-2.basic
Normal file
1
Task/Hostname/PowerBASIC/hostname-2.basic
Normal file
|
|
@ -0,0 +1 @@
|
|||
HOST NAME ipAddress& TO hostname$
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue