diff options
author | Andrew Cady <d@jerkface.net> | 2016-02-22 14:08:03 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-02-22 14:17:15 -0500 |
commit | 9b20bfd7d598a6649a931d81d5a9251e82206507 (patch) | |
tree | 28cade76302c1f50d9ef4d519263ede9a94b80b1 | |
parent | e26cc8382ba1e2f798d7ba2c418e896e06c739a1 (diff) |
compile "whosocket" via cabal
-rw-r--r-- | presence.cabal | 108 | ||||
-rw-r--r-- | whosocket.hs | 3 |
2 files changed, 96 insertions, 15 deletions
diff --git a/presence.cabal b/presence.cabal index ee6704a3..e75c1b0e 100644 --- a/presence.cabal +++ b/presence.cabal | |||
@@ -13,24 +13,104 @@ author: Joe Crayne | |||
13 | data-dir: "" | 13 | data-dir: "" |
14 | 14 | ||
15 | executable presence | 15 | executable presence |
16 | build-depends: base -any, stm -any, text (>=0.11.2.0), xml-types -any, containers -any, | ||
17 | network -any, time -any, transformers -any, resourcet -any, bytestring -any, | ||
18 | mtl -any, mmorph -any, conduit (>=1.0.4), void -any, random -any, | ||
19 | data-default -any, blaze-builder -any, unix -any, conduit-extra -any, | ||
20 | binary -any, directory -any, cpu -any, template-haskell -any, deepseq -any, | ||
21 | filepath -any, hinotify -any, process -any, xml-conduit -any | ||
22 | main-is: xmppServer.hs | ||
23 | other-modules: ByteStringOperators, ClientState, ConfigFiles, ConnectionKey, | ||
24 | ConsoleWriter, Control.Concurrent.STM.StatusCache, | ||
25 | Control.Concurrent.STM.UpdateStream, ControlMaybe, DNSCache, | ||
26 | Data.BitSyntax, EventUtil, FGConsole, GetHostByAddr, | ||
27 | LocalPeerCred, LockedChan, Logging, Nesting, Paths, | ||
28 | PeerResolve, Server, SockAddr, SocketLike, TraversableT, | ||
29 | UTmp, XMPPServer | ||
30 | buildable: True | 16 | buildable: True |
31 | cpp-options: -DRENDERFLUSH | 17 | cpp-options: -DRENDERFLUSH |
32 | c-sources: Presence/monitortty.c | 18 | c-sources: Presence/monitortty.c |
33 | hs-source-dirs: . Presence | 19 | hs-source-dirs: . Presence |
34 | ghc-prof-options: -DNOUTMP | 20 | ghc-prof-options: -DNOUTMP |
35 | ghc-options: -O2 -fwarn-unused-binds -threaded | 21 | ghc-options: -O2 -fwarn-unused-binds -threaded |
22 | build-depends: base, | ||
23 | binary, | ||
24 | blaze-builder, | ||
25 | bytestring, | ||
26 | conduit (>=1.0.4), | ||
27 | conduit-extra, | ||
28 | containers, | ||
29 | cpu, | ||
30 | data-default, | ||
31 | deepseq, | ||
32 | directory, | ||
33 | filepath, | ||
34 | hinotify, | ||
35 | mmorph, | ||
36 | mtl, | ||
37 | network, | ||
38 | process, | ||
39 | random, | ||
40 | resourcet, | ||
41 | stm, | ||
42 | template-haskell, | ||
43 | text (>=0.11.2.0), | ||
44 | time, | ||
45 | transformers, | ||
46 | unix, | ||
47 | void, | ||
48 | xml-conduit, | ||
49 | xml-types | ||
50 | main-is: xmppServer.hs | ||
51 | other-modules: ByteStringOperators, | ||
52 | ClientState, | ||
53 | ConfigFiles, | ||
54 | ConnectionKey, | ||
55 | ConsoleWriter, | ||
56 | Control.Concurrent.STM.StatusCache, | ||
57 | Control.Concurrent.STM.UpdateStream, | ||
58 | ControlMaybe, | ||
59 | Data.BitSyntax, | ||
60 | DNSCache, | ||
61 | EventUtil, | ||
62 | FGConsole, | ||
63 | GetHostByAddr, | ||
64 | LocalPeerCred, | ||
65 | LockedChan, | ||
66 | Logging, | ||
67 | Nesting, | ||
68 | Paths, | ||
69 | PeerResolve, | ||
70 | Server, | ||
71 | SockAddr, | ||
72 | SocketLike, | ||
73 | TraversableT, | ||
74 | UTmp, | ||
75 | XMPPServer | ||
36 | 76 | ||
77 | executable whosocket | ||
78 | main-is: whosocket.hs | ||
79 | hs-source-dirs: . Presence | ||
80 | cpp-options: -DRENDERFLUSH | ||
81 | ghc-options: -O2 -fwarn-unused-binds -threaded | ||
82 | build-depends: base, | ||
83 | binary, | ||
84 | bytestring, | ||
85 | containers, | ||
86 | cpu, | ||
87 | deepseq, | ||
88 | directory, | ||
89 | mtl, | ||
90 | network, | ||
91 | template-haskell, | ||
92 | text (>=0.11.2.0), | ||
93 | unix | ||
94 | other-modules: ByteStringOperators, | ||
95 | ControlMaybe, | ||
96 | Data.BitSyntax, | ||
97 | LocalPeerCred, | ||
98 | Logging, | ||
99 | Paths, | ||
100 | SockAddr, | ||
101 | SocketLike, | ||
102 | UTmp | ||
103 | |||
104 | -- ConduitServer.hs:main = mainC | ||
105 | -- Control/Concurrent/STM/StatusCache.hs:-- > main = do q <- atomically $ Cache.new (== '(') (==')') | ||
106 | -- Control/Concurrent/STM/UpdateStream.hs:-- > main = do | ||
107 | -- Presence/Server.hs:-- > main = runResourceT $ do | ||
108 | -- Presence/main.hs:main = do | ||
109 | -- consolation.hs:main = do | ||
110 | -- nalias.hs:main = do | ||
111 | -- nalias2.hs:main = do | ||
112 | -- pwrite.hs:main = do | ||
113 | -- simplechat.hs:main = do | ||
114 | -- test-server.hs:main = do | ||
115 | -- whosocket.hs:main = do | ||
116 | -- xmppServer.hs:main = runResourceT $ do | ||
diff --git a/whosocket.hs b/whosocket.hs index 44926797..f84e3178 100644 --- a/whosocket.hs +++ b/whosocket.hs | |||
@@ -34,6 +34,7 @@ main = do | |||
34 | (Just addr_str,Just port_str) -> whosocket addr_str port_str | 34 | (Just addr_str,Just port_str) -> whosocket addr_str port_str |
35 | _ -> usage | 35 | _ -> usage |
36 | 36 | ||
37 | whosocket :: HostName -> ServiceName -> IO () | ||
37 | whosocket addr_str port_str = do | 38 | whosocket addr_str port_str = do |
38 | info <- getAddrInfo (Just $ defaultHints { addrFlags = [ AI_NUMERICHOST ] }) | 39 | info <- getAddrInfo (Just $ defaultHints { addrFlags = [ AI_NUMERICHOST ] }) |
39 | (Just addr_str) | 40 | (Just addr_str) |
@@ -50,7 +51,7 @@ whosocket addr_str port_str = do | |||
50 | tty_pids = mapMaybe filterTTYs us | 51 | tty_pids = mapMaybe filterTTYs us |
51 | 52 | ||
52 | tty <- maybe (return Nothing) | 53 | tty <- maybe (return Nothing) |
53 | (uncurry $ identifyTTY tty_pids) | 54 | (fmap fst . uncurry (identifyTTY tty_pids)) |
54 | r | 55 | r |
55 | putStrLn $ "uid = " ++ show (fmap fst r) | 56 | putStrLn $ "uid = " ++ show (fmap fst r) |
56 | L.putStrLn $ "tty = " <++?> tty | 57 | L.putStrLn $ "tty = " <++?> tty |