blob: 7318cc7ac91f6b48bf77e89128fc427f7447ed4d (
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
25
|
import IO -- 1.3
import System(getArgs)
main = getArgs >>= \ [user,host] ->
let username = (user ++ "@" ++ host) in
openFile username ReadWriteMode >>= \ cd ->
hSetBuffering stdin NoBuffering >>
hSetBuffering stdout NoBuffering >>
hSetBuffering cd NoBuffering >>
hPutStr cd speakString >>
speak cd
speakString = "Someone wants to speak with you\n"
speak cd =
(hReady cd >>= \ ready ->
if ready then (hGetChar cd >>= putChar)
else return () >>
hReady stdin >>= \ ready ->
if ready then (getChar >>= hPutChar cd)
else return ()) >>
speak cd
|