diff options
author | Ian Lynagh <igloo@earth.li> | 2009-05-05 22:34:32 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-05-05 22:34:32 +0000 |
commit | 9000c679a8904a398022b96e01649120e024c615 (patch) | |
tree | a4e67df97e816e0cbf93b07c9c5e122635db056e | |
parent | 1e9af42caa0949ae05e5e2db5250227e86196e19 (diff) | |
download | haskell-9000c679a8904a398022b96e01649120e024c615.tar.gz |
Simplify utils/pwd
We only need the forwardslash mode now, so always use that mode and
don't accept any arguments.
-rw-r--r-- | aclocal.m4 | 2 | ||||
-rw-r--r-- | utils/pwd/pwd.hs | 28 | ||||
-rw-r--r-- | validate | 2 |
3 files changed, 11 insertions, 21 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 013f7ff76b..b43d7f5e27 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1255,7 +1255,7 @@ if test ! -f utils/pwd/pwd && test ! -f utils/pwd/pwd.exe; then cd ../.. fi -hardtop=`utils/pwd/pwd forwardslash` +hardtop=`utils/pwd/pwd` if ! test -d "$hardtop"; then AC_MSG_ERROR([cannot determine current directory]) diff --git a/utils/pwd/pwd.hs b/utils/pwd/pwd.hs index 45a2d46270..694941643d 100644 --- a/utils/pwd/pwd.hs +++ b/utils/pwd/pwd.hs @@ -9,24 +9,14 @@ import System.IO main :: IO () 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 + case args of + [] -> do d <- getCurrentDirectory + putStr $ map forwardifySlashes d + _ -> do hPutStrLn stderr ("Bad args: " ++ show args) + hPutStrLn stderr "Usage: pwd" + exitFailure --- In prog006 we have to escape \ twice, once to get through sed and --- again to get through parsing pkg.conf -escape_quadruple_backslash :: Char -> String -escape_quadruple_backslash '\\' = "\\\\\\\\" -escape_quadruple_backslash c = [c] - --- Normally we can get away with just replacing backslashes with forwardslashes -escape_forwardslash :: Char -> String -escape_forwardslash '\\' = "/" -escape_forwardslash c = [c] +forwardifySlashes :: Char -> Char +forwardifySlashes '\\' = '/' +forwardifySlashes c = c @@ -80,7 +80,7 @@ if [ $no_clean -eq 0 ]; then ./configure --prefix="$INSTDIR" $config_args fi -thisdir=`utils/pwd/pwd forwardslash` +thisdir=`utils/pwd/pwd` echo "Validating=YES" > mk/are-validating.mk |