A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
1
Task/Hostname/0DESCRIPTION
Normal file
1
Task/Hostname/0DESCRIPTION
Normal file
|
|
@ -0,0 +1 @@
|
|||
Find the name of the host on which the routine is running.
|
||||
4
Task/Hostname/1META.yaml
Normal file
4
Task/Hostname/1META.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
category:
|
||||
- Networking and Web Interaction
|
||||
note: Programming environment operations
|
||||
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/AutoHotkey/hostname.ahk
Normal file
1
Task/Hostname/AutoHotkey/hostname.ahk
Normal file
|
|
@ -0,0 +1 @@
|
|||
MsgBox % A_ComputerName
|
||||
4
Task/Hostname/BBC-BASIC/hostname.bbc
Normal file
4
Task/Hostname/BBC-BASIC/hostname.bbc
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
INSTALL @lib$+"SOCKLIB"
|
||||
PROC_initsockets
|
||||
PRINT "hostname: " FN_gethostname
|
||||
PROC_exitsockets
|
||||
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;
|
||||
}
|
||||
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 ()
|
||||
#+sbcl (machine-instance)
|
||||
#+clisp (let ((s (machine-instance))) (subseq s 0 (position #\Space s)))
|
||||
#-(or sbcl 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"
|
||||
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/Erlang/hostname.erl
Normal file
1
Task/Hostname/Erlang/hostname.erl
Normal file
|
|
@ -0,0 +1 @@
|
|||
Host = net_adm:localhost().
|
||||
1
Task/Hostname/Factor/hostname.factor
Normal file
1
Task/Hostname/Factor/hostname.factor
Normal file
|
|
@ -0,0 +1 @@
|
|||
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.f
Normal file
5
Task/Hostname/Fortran/hostname.f
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
program HostTest
|
||||
character(len=128) :: name
|
||||
call hostnm(name)
|
||||
print *, name
|
||||
end program HostTest
|
||||
11
Task/Hostname/Go/hostname.go
Normal file
11
Task/Hostname/Go/hostname.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
host, _ := os.Hostname()
|
||||
fmt.Printf("hostname: %s\n", host)
|
||||
}
|
||||
1
Task/Hostname/Groovy/hostname.groovy
Normal file
1
Task/Hostname/Groovy/hostname.groovy
Normal file
|
|
@ -0,0 +1 @@
|
|||
println InetAddress.localHost.hostName
|
||||
3
Task/Hostname/Haskell/hostname.hs
Normal file
3
Task/Hostname/Haskell/hostname.hs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Network.BSD
|
||||
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'
|
||||
9
Task/Hostname/Java/hostname.java
Normal file
9
Task/Hostname/Java/hostname.java
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import java.net.*;
|
||||
class DiscoverHostName {
|
||||
public static void main(final String[] args) {
|
||||
try {
|
||||
System.out.println(InetAddress.getLocalHost().getHostName());
|
||||
} catch (UnknownHostException e) { // Doesn't actually happen, but Java requires it be handled.
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
8
Task/Hostname/Liberty-BASIC/hostname.liberty
Normal file
8
Task/Hostname/Liberty-BASIC/hostname.liberty
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$
|
||||
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() )
|
||||
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/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.mathematica
Normal file
1
Task/Hostname/Mathematica/hostname.mathematica
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.
|
||||
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();
|
||||
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;
|
||||
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))
|
||||
2
Task/Hostname/Python/hostname.py
Normal file
2
Task/Hostname/Python/hostname.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import socket
|
||||
host = socket.gethostname()
|
||||
1
Task/Hostname/R/hostname-1.r
Normal file
1
Task/Hostname/R/hostname-1.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
Sys.info()[["nodename"]]
|
||||
1
Task/Hostname/R/hostname-2.r
Normal file
1
Task/Hostname/R/hostname-2.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
system("hostname", intern = TRUE)
|
||||
2
Task/Hostname/R/hostname-3.r
Normal file
2
Task/Hostname/R/hostname-3.r
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
env_var <- ifelse(.Platform$OS.type == "windows", "COMPUTERNAME", "HOSTNAME")
|
||||
Sys.getenv(env_var)
|
||||
2
Task/Hostname/REXX/hostname-1.rexx
Normal file
2
Task/Hostname/REXX/hostname-1.rexx
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
say value('COMPUTERNAME',,"ENVIRONMENT")
|
||||
say value('OS',,"ENVIRONMENT")
|
||||
2
Task/Hostname/REXX/hostname-2.rexx
Normal file
2
Task/Hostname/REXX/hostname-2.rexx
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
say value('COMPUTERNAME',,"SYSTEM")
|
||||
say value('OS',,"SYSTEM")
|
||||
1
Task/Hostname/REXX/hostname-3.rexx
Normal file
1
Task/Hostname/REXX/hostname-3.rexx
Normal file
|
|
@ -0,0 +1 @@
|
|||
say userid()
|
||||
1
Task/Hostname/REXX/hostname-4.rexx
Normal file
1
Task/Hostname/REXX/hostname-4.rexx
Normal file
|
|
@ -0,0 +1 @@
|
|||
'VER' /*this passes the VER command to the MS DOS system. */
|
||||
6
Task/Hostname/REXX/hostname-5.rexx
Normal file
6
Task/Hostname/REXX/hostname-5.rexx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* Rexx */
|
||||
address command "hostname -f" with output stem hn.
|
||||
do q_ = 1 to hn.0
|
||||
say hn.q_
|
||||
end q_
|
||||
exit
|
||||
3
Task/Hostname/Racket/hostname.rkt
Normal file
3
Task/Hostname/Racket/hostname.rkt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
(require mzlib/os)
|
||||
(gethostname)
|
||||
2
Task/Hostname/Ruby/hostname.rb
Normal file
2
Task/Hostname/Ruby/hostname.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require 'socket'
|
||||
host = Socket.gethostname
|
||||
1
Task/Hostname/Scala/hostname.scala
Normal file
1
Task/Hostname/Scala/hostname.scala
Normal file
|
|
@ -0,0 +1 @@
|
|||
println(java.net.InetAddress.getLocalHost.getHostName)
|
||||
2
Task/Hostname/Scheme/hostname-1.ss
Normal file
2
Task/Hostname/Scheme/hostname-1.ss
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(use posix)
|
||||
(get-host-name)
|
||||
1
Task/Hostname/Scheme/hostname-2.ss
Normal file
1
Task/Hostname/Scheme/hostname-2.ss
Normal file
|
|
@ -0,0 +1 @@
|
|||
(gethostname)
|
||||
1
Task/Hostname/Smalltalk/hostname.st
Normal file
1
Task/Hostname/Smalltalk/hostname.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
OperatingSystem getHostName
|
||||
1
Task/Hostname/Tcl/hostname.tcl
Normal file
1
Task/Hostname/Tcl/hostname.tcl
Normal file
|
|
@ -0,0 +1 @@
|
|||
set hname [info hostname]
|
||||
Loading…
Add table
Add a link
Reference in a new issue