Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1 @@
host name of (system info)

View file

@ -0,0 +1 @@
hostname

View file

@ -1 +1,2 @@
USE: io.sockets
host-name

View 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

View file

@ -0,0 +1,7 @@
MODULE HostName;
IMPORT
OS:ProcessParameters,
Out;
BEGIN
Out.Object("Host: " + ProcessParameters.GetEnv("HOSTNAME"));Out.Ln
END HostName.

View file

@ -0,0 +1 @@
echo hostname()