summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/libposix/posix011.hs
blob: f8baf1cbc235a6bc7d567705fc0a3afc6f742a43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Posix

main =
    getGroupEntryForName "grasp" >>= \ grasp ->
    getGroupEntryForName "staff" >>= \ staff ->
    putStr (ge2String grasp) >>
    putChar '\n' >>    
    putStr (ge2String staff) >>
    putChar '\n' >>    
    getGroupEntryForID (groupID grasp) >>= \ guid ->
    getGroupEntryForID (groupID staff) >>= \ suid ->
    putStr (ge2String guid) >>
    putChar '\n' >>    
    putStr (ge2String suid) >>
    putChar '\n'

ge2String ge =
    name ++ (':' : (show gid) ++ (':' : members))
  where
    name = groupName ge
    gid = groupID ge
    members = foldr (\x y -> x ++ (',' : y)) "" (groupMembers ge)