summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib/libposix/posix010.hs
blob: 83d5f27ee023f8b0ed7bf13c147e8824380596eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import Posix

main =
    getUserEntryForName "sof"     >>= \ sof ->
    getUserEntryForName "partain" >>= \ partain ->
    putStr (ue2String sof) >>
    putChar '\n' >>    
    putStr (ue2String partain) >>
    putChar '\n' >>    
    getUserEntryForID (userID sof) >>= \ muid ->
    getUserEntryForID (userID partain) >>= \ puid ->
    putStr (ue2String muid) >>
    putChar '\n' >>    
    putStr (ue2String puid) >>
    putChar '\n'

ue2String ue =
    name ++ (':' : (show uid) ++ (':' : (show gid) ++ (':' : home ++ (':' : shell))))
  where
    name = userName ue
    uid = userID ue
    gid = userGroupID ue
    home = homeDirectory ue
    shell = userShell ue