Created
January 26, 2016 19:31
-
-
Save aciidgh/fa769704997055d54a5e to your computer and use it in GitHub Desktop.
environ using dlsym
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Darwin | |
import Foundation | |
let environ: UnsafePointer<UnsafePointer<CChar>> = UnsafePointer(dlsym(UnsafeMutablePointer(bitPattern: Int(-2)), "environ"))[0] | |
var iterator = environ | |
while iterator.memory != nil { | |
print(String.fromCString(iterator.memory)) | |
iterator = iterator.successor() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment