Commit ec05d3bb authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Improve error messages from pwd

parent d5962639
......@@ -3,15 +3,21 @@ module Main where
import System.Directory
import System.Environment
import System.Exit
import System.IO
main :: IO ()
main = do args <- getArgs
let escape = case args of
["quadruple-backslash"] -> escape_quadruple_backslash
["forwardslash"] -> escape_forwardslash
_ -> error ("pwd: Bad args: " ++ show args)
d <- getCurrentDirectory
putStr $ concatMap escape d
main = do
args <- getArgs
escape <- case args of
["quadruple-backslash"] -> return escape_quadruple_backslash
["forwardslash"] -> return escape_forwardslash
_ -> do hPutStrLn stderr ("Bad args: " ++ show args)
hPutStrLn stderr
"Usage: pwd {forwardslash|quadruple-backslash}"
exitFailure
d <- getCurrentDirectory
putStr $ concatMap escape d
-- In prog006 we have to escape \ twice, once to get through sed and
-- again to get through parsing pkg.conf
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment