aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <id@joeyh.name>2013-05-10 16:57:21 -0500
committerGravatar Joey Hess <id@joeyh.name>2013-05-10 16:57:21 -0500
commitae6293ae6710b0a7580bc9a0045c92d1d5b87036 (patch)
treefbd105bed124fb698fdc5bbdf4eb2d9ccd086979
parent5d0476bf59674b39fa6bad7e4446b5c741181143 (diff)
fixup #if 0 stubs to use #ifndef mingw32_HOST_OS
That's needed in files used to build the configure program. For the other files, I'm keeping my __WINDOWS__ define, as I find that much easier to type. I may search and replace it to use the mingw32_HOST_OS thing later.
-rwxr-xr-xAnnex/Branch.hs2
-rwxr-xr-xAnnex/Environment.hs2
-rwxr-xr-xAnnex/Ssh.hs2
-rwxr-xr-xBuild/DesktopFile.hs4
-rwxr-xr-xCmdLine.hs2
-rwxr-xr-xCommand/Fsck.hs2
-rwxr-xr-xCommon.hs2
-rwxr-xr-xCreds.hs2
-rwxr-xr-xGit.hs2
-rwxr-xr-xGit/Construct.hs2
-rwxr-xr-xGit/CurrentRepo.hs2
-rwxr-xr-xGitAnnexShell.hs2
-rwxr-xr-xRemote/Rsync.hs2
-rwxr-xr-xTest.hs2
-rwxr-xr-xUtility/Daemon.hs2
-rwxr-xr-xUtility/Directory.hs4
-rwxr-xr-xUtility/FileMode.hs30
-rwxr-xr-xUtility/Gpg.hs4
-rwxr-xr-xUtility/LogFile.hs2
-rwxr-xr-xUtility/Misc.hs4
-rwxr-xr-xUtility/Process.hs4
-rwxr-xr-xUtility/TempFile.hs6
-rwxr-xr-xUtility/UserInfo.hs10
23 files changed, 48 insertions, 48 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index 2304a3e49..3788358f2 100755
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -24,7 +24,7 @@ module Annex.Branch (
) where
import qualified Data.ByteString.Lazy.Char8 as L
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Env
#endif
diff --git a/Annex/Environment.hs b/Annex/Environment.hs
index d6755e287..fef6989ee 100755
--- a/Annex/Environment.hs
+++ b/Annex/Environment.hs
@@ -13,7 +13,7 @@ import Common.Annex
import Utility.UserInfo
import qualified Git.Config
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Env
#endif
import Network.BSD
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index f71d389c7..1846fd342 100755
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -14,7 +14,7 @@ module Annex.Ssh (
) where
import qualified Data.Map as M
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Env
#endif
diff --git a/Build/DesktopFile.hs b/Build/DesktopFile.hs
index 35d5362bd..3c6816e60 100755
--- a/Build/DesktopFile.hs
+++ b/Build/DesktopFile.hs
@@ -22,7 +22,7 @@ import Assistant.Install.Menu
import Control.Applicative
import System.Directory
import System.Environment
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.User
import System.Posix.Files
#endif
@@ -30,7 +30,7 @@ import System.FilePath
import Data.Maybe
systemwideInstall :: IO Bool
-#if 0
+#ifndef mingw32_HOST_OS
systemwideInstall = isroot <||> destdirset
where
isroot = do
diff --git a/CmdLine.hs b/CmdLine.hs
index d6e54fded..b7b8b70f2 100755
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -17,7 +17,7 @@ import qualified Control.Exception as E
import qualified Data.Map as M
import Control.Exception (throw)
import System.Console.GetOpt
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Signals
#endif
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 625867a46..c63bc3ea0 100755
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -30,7 +30,7 @@ import qualified Option
import Types.Key
import Utility.HumanTime
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Process (getProcessID)
#endif
import Data.Time.Clock.POSIX
diff --git a/Common.hs b/Common.hs
index 6f59acc76..8dce23330 100755
--- a/Common.hs
+++ b/Common.hs
@@ -16,7 +16,7 @@ import "MissingH" System.Path as X
import System.FilePath as X
import System.Directory as X
import System.IO as X hiding (FilePath)
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Files as X
import System.Posix.IO as X
#endif
diff --git a/Creds.hs b/Creds.hs
index bcfca420d..44954d7d6 100755
--- a/Creds.hs
+++ b/Creds.hs
@@ -17,7 +17,7 @@ import Types.Remote (RemoteConfig, RemoteConfigKey)
import Remote.Helper.Encryptable (remoteCipher, embedCreds)
import System.Environment
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Env (setEnv)
#endif
import qualified Data.ByteString.Lazy.Char8 as L
diff --git a/Git.hs b/Git.hs
index c7c82ee93..c3705b1c5 100755
--- a/Git.hs
+++ b/Git.hs
@@ -32,7 +32,7 @@ module Git (
) where
import Network.URI (uriPath, uriScheme, unEscapeString)
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Files
#endif
diff --git a/Git/Construct.hs b/Git/Construct.hs
index 2d00f18a1..f7aca6130 100755
--- a/Git/Construct.hs
+++ b/Git/Construct.hs
@@ -23,7 +23,7 @@ module Git.Construct (
checkForRepo,
) where
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.User
#endif
import qualified Data.Map as M hiding (map, split)
diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs
index 785542663..b2c15c23f 100755
--- a/Git/CurrentRepo.hs
+++ b/Git/CurrentRepo.hs
@@ -9,7 +9,7 @@
module Git.CurrentRepo where
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Directory (changeWorkingDirectory)
import System.Posix.Env (getEnv, unsetEnv)
#endif
diff --git a/GitAnnexShell.hs b/GitAnnexShell.hs
index 6ce377896..df0bf4c5d 100755
--- a/GitAnnexShell.hs
+++ b/GitAnnexShell.hs
@@ -9,7 +9,7 @@
module GitAnnexShell where
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Env
#endif
import System.Console.GetOpt
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 63e514199..1c4b1d112 100755
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -11,7 +11,7 @@ module Remote.Rsync (remote) where
import qualified Data.ByteString.Lazy as L
import qualified Data.Map as M
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Process (getProcessID)
#endif
diff --git a/Test.hs b/Test.hs
index 6dbc89d90..06d186514 100755
--- a/Test.hs
+++ b/Test.hs
@@ -13,7 +13,7 @@ import Test.HUnit
import Test.QuickCheck
import Test.QuickCheck.Test
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Directory (changeWorkingDirectory)
import System.Posix.Files
import System.Posix.Env
diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs
index 835b8f149..fb8c61f75 100755
--- a/Utility/Daemon.hs
+++ b/Utility/Daemon.hs
@@ -12,7 +12,7 @@ module Utility.Daemon where
import Common
import Utility.LogFile
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix
#endif
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index 55d79a825..0dbba0584 100755
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -10,7 +10,7 @@
module Utility.Directory where
import System.IO.Error
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Files
#endif
import System.Directory
@@ -61,7 +61,7 @@ dirContentsRecursive' (dir:dirs) = unsafeInterleaveIO $ do
{- Moves one filename to another.
- First tries a rename, but falls back to moving across devices if needed. -}
moveFile :: FilePath -> FilePath -> IO ()
-#if 0
+#ifndef mingw32_HOST_OS
moveFile src dest = tryIO (rename src dest) >>= onrename
where
onrename (Right _) = noop
diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs
index cf9ec45a2..b4132f2ad 100755
--- a/Utility/FileMode.hs
+++ b/Utility/FileMode.hs
@@ -19,7 +19,7 @@ import Foreign (complement)
{- Applies a conversion function to a file's mode. -}
modifyFileMode :: FilePath -> (FileMode -> FileMode) -> IO ()
modifyFileMode f convert = void $ modifyFileMode' f convert
-#if 0
+#ifndef __WINDOWS__
modifyFileMode' :: FilePath -> (FileMode -> FileMode) -> IO FileMode
modifyFileMode' f convert = do
s <- getFileStatus f
@@ -39,7 +39,7 @@ addModes ms m = combineModes (m:ms)
{- Removes the specified FileModes from the input mode. -}
removeModes :: [FileMode] -> FileMode -> FileMode
-#if 0
+#ifndef __WINDOWS__
removeModes ms m = m `intersectFileModes` complement (combineModes ms)
#else
removeModes = error "removeModes TODO"
@@ -54,21 +54,21 @@ withModifiedFileMode file convert a = bracket setup cleanup go
go _ = a
writeModes :: [FileMode]
-#if 0
+#ifndef __WINDOWS__
writeModes = [ownerWriteMode, groupWriteMode, otherWriteMode]
#else
writeModes = []
#endif
readModes :: [FileMode]
-#if 0
+#ifndef __WINDOWS__
readModes = [ownerReadMode, groupReadMode, otherReadMode]
#else
readModes = []
#endif
executeModes :: [FileMode]
-#if 0
+#ifndef __WINDOWS__
executeModes = [ownerExecuteMode, groupExecuteMode, otherExecuteMode]
#else
executeModes = []
@@ -76,7 +76,7 @@ executeModes = []
{- Removes the write bits from a file. -}
preventWrite :: FilePath -> IO ()
-#if 0
+#ifndef __WINDOWS__
preventWrite f = modifyFileMode f $ removeModes writeModes
#else
preventWrite _ = return ()
@@ -84,7 +84,7 @@ preventWrite _ = return ()
{- Turns a file's owner write bit back on. -}
allowWrite :: FilePath -> IO ()
-#if 0
+#ifndef __WINDOWS__
allowWrite f = modifyFileMode f $ addModes [ownerWriteMode]
#else
allowWrite _ = return ()
@@ -92,7 +92,7 @@ allowWrite _ = return ()
{- Allows owner and group to read and write to a file. -}
groupWriteRead :: FilePath -> IO ()
-#if 0
+#ifndef __WINDOWS__
groupWriteRead f = modifyFileMode f $ addModes
[ ownerWriteMode, groupWriteMode
, ownerReadMode, groupReadMode
@@ -101,14 +101,14 @@ groupWriteRead f = modifyFileMode f $ addModes
groupWriteRead _ = return ()
#endif
-#if 0
+#ifndef __WINDOWS__
checkMode :: FileMode -> FileMode -> Bool
checkMode checkfor mode = checkfor `intersectFileModes` mode == checkfor
#endif
{- Checks if a file mode indicates it's a symlink. -}
isSymLink :: FileMode -> Bool
-#if 0
+#ifndef __WINDOWS__
isSymLink = checkMode symbolicLinkMode
#else
isSymLink _ = False
@@ -116,7 +116,7 @@ isSymLink _ = False
{- Checks if a file has any executable bits set. -}
isExecutable :: FileMode -> Bool
-#if 0
+#ifndef __WINDOWS__
isExecutable mode = combineModes executeModes `intersectFileModes` mode /= 0
#else
isExecutable _ = False
@@ -125,7 +125,7 @@ isExecutable _ = False
{- Runs an action without that pesky umask influencing it, unless the
- passed FileMode is the standard one. -}
noUmask :: FileMode -> IO a -> IO a
-#if 0
+#ifndef __WINDOWS__
noUmask mode a
| mode == stdFileMode = a
| otherwise = bracket setup cleanup go
@@ -138,7 +138,7 @@ noUmask _ a = a
#endif
combineModes :: [FileMode] -> FileMode
-#if 0
+#ifndef __WINDOWS__
combineModes [] = undefined
combineModes [m] = m
combineModes (m:ms) = foldl unionFileModes m ms
@@ -150,7 +150,7 @@ stickyMode :: FileMode
stickyMode = 512
isSticky :: FileMode -> Bool
-#if 0
+#ifndef __WINDOWS__
isSticky = checkMode stickyMode
#else
isSticky _ = False
@@ -166,7 +166,7 @@ setSticky f = modifyFileMode f $ addModes [stickyMode]
- as writeFile.
-}
writeFileProtected :: FilePath -> String -> IO ()
-#if 0
+#ifndef __WINDOWS__
writeFileProtected file content = do
h <- openFile file WriteMode
void $ tryIO $
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs
index 6fcf173b1..0ed4b85da 100755
--- a/Utility/Gpg.hs
+++ b/Utility/Gpg.hs
@@ -13,7 +13,7 @@ import System.Posix.Types
import Control.Applicative
import Control.Concurrent
import Control.Exception (bracket)
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Env (setEnv, unsetEnv, getEnv)
#endif
@@ -216,7 +216,7 @@ keyBlock public ls = unlines
| public = "PUBLIC"
| otherwise = "PRIVATE"
-#if 0
+#ifndef mingw32_HOST_OS
{- Runs an action using gpg in a test harness, in which gpg does
- not use ~/.gpg/, but a directory with the test key set up to be used. -}
testHarness :: IO a -> IO a
diff --git a/Utility/LogFile.hs b/Utility/LogFile.hs
index d608cd798..c6faee028 100755
--- a/Utility/LogFile.hs
+++ b/Utility/LogFile.hs
@@ -11,7 +11,7 @@ module Utility.LogFile where
import Common
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix
#endif
diff --git a/Utility/Misc.hs b/Utility/Misc.hs
index 576a6ddbf..da4da0a60 100755
--- a/Utility/Misc.hs
+++ b/Utility/Misc.hs
@@ -15,7 +15,7 @@ import Foreign
import Data.Char
import Data.List
import Control.Applicative
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Process (getAnyProcessStatus)
#endif
@@ -122,7 +122,7 @@ hGetSomeString h sz = do
peekbytes :: Int -> Ptr Word8 -> IO [Word8]
peekbytes len buf = mapM (peekElemOff buf) [0..pred len]
-#if 0
+#ifndef mingw32_HOST_OS
{- Reaps any zombie git processes.
-
- Warning: Not thread safe. Anything that was expecting to wait
diff --git a/Utility/Process.hs b/Utility/Process.hs
index 381a14983..6e0aef21c 100755
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -42,7 +42,7 @@ import Control.Concurrent
import qualified Control.Exception as E
import Control.Monad
import Data.Maybe
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.IO
#endif
@@ -158,7 +158,7 @@ createBackgroundProcess p a = a =<< createProcess p
- returns a transcript combining its stdout and stderr, and
- whether it succeeded or failed. -}
processTranscript :: String -> [String] -> (Maybe String) -> IO (String, Bool)
-#if 0
+#ifndef mingw32_HOST_OS
processTranscript cmd opts input = do
(readf, writef) <- createPipe
readh <- fdToHandle readf
diff --git a/Utility/TempFile.hs b/Utility/TempFile.hs
index e5617d48b..ba7449ba2 100755
--- a/Utility/TempFile.hs
+++ b/Utility/TempFile.hs
@@ -11,7 +11,7 @@ module Utility.TempFile where
import Control.Exception (bracket)
import System.IO
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.Process
#endif
import System.Directory
@@ -24,7 +24,7 @@ import System.FilePath
- then moving it into place. The temp file is stored in the same
- directory as the final file to avoid cross-device renames. -}
viaTmp :: (FilePath -> String -> IO ()) -> FilePath -> String -> IO ()
-#if 0
+#ifndef mingw32_HOST_OS
viaTmp a file content = do
pid <- getProcessID
let tmpfile = file ++ ".tmp" ++ show pid
@@ -52,7 +52,7 @@ withTempFile template a = bracket create remove use
{- Runs an action with a temp directory, then removes the directory and
- all its contents. -}
withTempDir :: Template -> (FilePath -> IO a) -> IO a
-#if 0
+#ifndef mingw32_HOST_OS
withTempDir template = bracket create remove
where
remove = removeDirectoryRecursive
diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs
index 6fad3d7b4..c0925ecb8 100755
--- a/Utility/UserInfo.hs
+++ b/Utility/UserInfo.hs
@@ -14,7 +14,7 @@ module Utility.UserInfo (
) where
import Control.Applicative
-#if 0
+#ifndef mingw32_HOST_OS
import System.Posix.User
import System.Posix.Env
#endif
@@ -23,7 +23,7 @@ import System.Posix.Env
-
- getpwent will fail on LDAP or NIS, so use HOME if set. -}
myHomeDir :: IO FilePath
-#if 0
+#ifndef mingw32_HOST_OS
myHomeDir = myVal ["HOME"] homeDirectory
#else
myHomeDir = error "myHomeDir TODO"
@@ -31,7 +31,7 @@ myHomeDir = error "myHomeDir TODO"
{- Current user's user name. -}
myUserName :: IO String
-#if 0
+#ifndef mingw32_HOST_OS
myUserName = myVal ["USER", "LOGNAME"] userName
#else
myUserName = error "myUserName TODO"
@@ -41,14 +41,14 @@ myUserGecos :: IO String
#ifdef __ANDROID__
myUserGecos = return "" -- userGecos crashes on Android
#else
-#if 0
+#ifndef mingw32_HOST_OS
myUserGecos = myVal [] userGecos
#else
myUserGecos = error "myUserGecos TODO"
#endif
#endif
-#if 0
+#ifndef mingw32_HOST_OS
myVal :: [String] -> (UserEntry -> String) -> IO String
myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars
where