| 1 | 1 patch for repository darcs.haskell.org:/srv/darcs/packages/unix: |
|---|
| 2 | |
|---|
| 3 | Fri Apr 1 13:19:08 BST 2011 Max Bolingbroke <batterseapower@hotmail.com> |
|---|
| 4 | * Use NSGetEnviron on OS X |
|---|
| 5 | |
|---|
| 6 | New patches: |
|---|
| 7 | |
|---|
| 8 | [Use NSGetEnviron on OS X |
|---|
| 9 | Max Bolingbroke <batterseapower@hotmail.com>**20110401121908 |
|---|
| 10 | Ignore-this: e8582c3df56bce3aecdcad08592a82f9 |
|---|
| 11 | ] { |
|---|
| 12 | hunk ./System/Posix/Env.hsc 58 |
|---|
| 13 | |
|---|
| 14 | getEnvironmentPrim :: IO [String] |
|---|
| 15 | getEnvironmentPrim = do |
|---|
| 16 | - c_environ <- peek c_environ_p |
|---|
| 17 | + c_environ <- getCEnviron |
|---|
| 18 | arr <- peekArray0 nullPtr c_environ |
|---|
| 19 | mapM peekCString arr |
|---|
| 20 | |
|---|
| 21 | hunk ./System/Posix/Env.hsc 62 |
|---|
| 22 | +getCEnviron :: IO (Ptr CString) |
|---|
| 23 | +#if darwin_HOST_OS |
|---|
| 24 | +-- You should not access _environ directly on Darwin in a bundle/shared library. |
|---|
| 25 | +-- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html |
|---|
| 26 | +getCEnviron = nsGetEnviron >>= peek |
|---|
| 27 | + |
|---|
| 28 | +foreign import ccall unsafe "_NSGetEnviron" |
|---|
| 29 | + nsGetEnviron :: IO (Ptr (Ptr CString)) |
|---|
| 30 | +#else |
|---|
| 31 | +getCEnviron = peek c_environ_p |
|---|
| 32 | + |
|---|
| 33 | foreign import ccall unsafe "&environ" |
|---|
| 34 | c_environ_p :: Ptr (Ptr CString) |
|---|
| 35 | hunk ./System/Posix/Env.hsc 75 |
|---|
| 36 | +#endif |
|---|
| 37 | |
|---|
| 38 | -- |'getEnvironment' retrieves the entire environment as a |
|---|
| 39 | -- list of @(key,value)@ pairs. |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | Context: |
|---|
| 43 | |
|---|
| 44 | [TAG git migration |
|---|
| 45 | Ian Lynagh <igloo@earth.li>**20110331135044 |
|---|
| 46 | Ignore-this: f484f990e0824737ad31333d2252c29d |
|---|
| 47 | ] |
|---|
| 48 | Patch bundle hash: |
|---|
| 49 | eb19ad610639cddb9ddcbcfdc977d64171f83ffe |
|---|