diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dht.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/dht.hs b/examples/dht.hs index 534a319b..3e1b1656 100644 --- a/examples/dht.hs +++ b/examples/dht.hs | |||
@@ -4,6 +4,7 @@ import Control.Monad | |||
4 | import Data.Function | 4 | import Data.Function |
5 | import Control.Monad.IO.Class | 5 | import Control.Monad.IO.Class |
6 | import Data.Char | 6 | import Data.Char |
7 | import Data.List | ||
7 | import Network.Socket as Socket | 8 | import Network.Socket as Socket |
8 | import System.Console.Haskeline | 9 | import System.Console.Haskeline |
9 | import System.Environment | 10 | import System.Environment |
@@ -82,5 +83,8 @@ main = do | |||
82 | -- or else we enter an interactive shell. | 83 | -- or else we enter an interactive shell. |
83 | args <- dropWhile isSpace . unwords <$> liftIO getArgs | 84 | args <- dropWhile isSpace . unwords <$> liftIO getArgs |
84 | case args of | 85 | case args of |
85 | (_:_) -> sendCommand h args >> sendCommand h "quit" | 86 | (_:_) -> do |
87 | let cs = filter (not . null) $ map (drop 1) $ groupBy (\_ c -> (c/=';')) (';':args) | ||
88 | forM_ cs $ \cmd -> sendCommand h cmd | ||
89 | sendCommand h "quit" | ||
86 | _ -> fix $ interactiveMode h | 90 | _ -> fix $ interactiveMode h |