September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
6
Task/Hostname/Phix/hostname.phix
Normal file
6
Task/Hostname/Phix/hostname.phix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
constant tmp = "hostname.txt",
|
||||
cmd = iff(platform()=WINDOWS?"hostname":"uname -n")
|
||||
{} = system_exec(sprintf("%s > %s",{cmd,tmp}),4)
|
||||
string host = trim(get_text(tmp))
|
||||
{} = delete_file("hostname.txt")
|
||||
?host
|
||||
6
Task/Hostname/Rust/hostname.rust
Normal file
6
Task/Hostname/Rust/hostname.rust
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
match hostname::get_hostname() {
|
||||
Some(host) => println!("hostname: {}", host),
|
||||
None => eprintln!("Could not get hostname!"),
|
||||
}
|
||||
}
|
||||
21
Task/Hostname/Visual-Basic/hostname.vb
Normal file
21
Task/Hostname/Visual-Basic/hostname.vb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Option Explicit
|
||||
|
||||
Private Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameW" _
|
||||
(ByVal lpBuffer As Long, ByRef nSize As Long) As Long
|
||||
|
||||
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
|
||||
Private Const NO_ERR As Long = 0
|
||||
|
||||
Private Function Hostname() As String
|
||||
Dim i As Long, l As Long, s As String
|
||||
s = Space$(MAX_COMPUTERNAME_LENGTH)
|
||||
l = Len(s) + 1
|
||||
i = GetComputerName(StrPtr(s), l)
|
||||
Debug.Assert i <> 0
|
||||
Debug.Assert l <> 0
|
||||
Hostname = Left$(s, l)
|
||||
End Function
|
||||
|
||||
Sub Main()
|
||||
Debug.Assert Hostname() = Environ$("COMPUTERNAME")
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue