summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--whosocket.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/whosocket.hs b/whosocket.hs
index 14d2a708..a8dcdff9 100644
--- a/whosocket.hs
+++ b/whosocket.hs
@@ -39,10 +39,8 @@ whosocket addr_str port_str = do
39 (Just addr_str) 39 (Just addr_str)
40 (Just port_str) 40 (Just port_str)
41 let addr = head $ map addrAddress info 41 let addr = head $ map addrAddress info
42 putStrLn $ "addr = "++show addr
43 putStrLn $ "unmap6mapped4 addr = "++show (unmap6mapped4 addr)
44 r <- getLocalPeerCred' addr 42 r <- getLocalPeerCred' addr
45 -- putStrLn $ "r{"++show addr++"} = " ++ show r 43 putStrLn $ "r{"++show addr++"} = " ++ show r
46 44
47 us <- UTmp.users 45 us <- UTmp.users
48 let filterTTYs (_,tty,pid) = 46 let filterTTYs (_,tty,pid) =
@@ -144,16 +142,18 @@ ttyToXorgs tty_pids = do
144 142
145identifyTTY tty_pids uid inode = do 143identifyTTY tty_pids uid inode = do
146 pid <- scanProc (show uid) (L.unpack inode) 144 pid <- scanProc (show uid) (L.unpack inode)
147 -- putStrLn $ "scanProc --> "++show pid 145 putStrLn $ "scanProc --> "++show pid
148 flip (maybe (return Nothing)) pid $ \(pid,ttydev) -> do 146 flip (maybe (return Nothing)) pid $ \(pid,ttydev) -> do
149 tty <- ttyOrDisplay pid ttydev 147 tty <- ttyOrDisplay pid ttydev
150 -- putStrLn $ "users = " ++ show tty_pids 148 putStrLn $ "users = " ++ show tty_pids
151 dts <- ttyToXorgs tty_pids 149 dts <- ttyToXorgs tty_pids
152 150
153 -- putStrLn $ "displays = " ++ show dts 151 putStrLn $ "displays = " ++ show dts
152 putStrLn $ "tty = " ++ show tty
154 -- -- displays = [(":5",Chunk "tty7" Empty)] 153 -- -- displays = [(":5",Chunk "tty7" Empty)]
155 154
156 let tty' = if take 3 tty=="tty" then Just (L.pack tty) else lookup tty dts 155 let tty' = if take 3 tty=="tty" then Just (L.pack tty) else lookup (parseTty tty) (map (first parseTty) dts)
157 return tty' 156 return tty'
158 157 where
159 158 parseTty :: String -> Float
159 parseTty = read . tail . dropWhile (/=':')