 }
 
 func checkKey(key: String) {
-    if smc.isKeyValid(key).valid { println("VALID")   }
-    else                         { println("INVALID") }
+    if smc.isKeyValid(key).valid { print("VALID")   }
+    else                         { print("INVALID") }
 }
 
 func setMinFanSpeed(fanNumber: Int, fanSpeed: Int) {
     let result = smc.setFanMinRPM(UInt(fanNumber), RPM: UInt(fanSpeed))
 
-    if result.result { println("SUCCESS") }
+    if result.result { print("SUCCESS") }
     else if result.IOReturn == kIOReturnNotPrivileged {
-        println("This operation must be invoked as the superuser")
+        print("This operation must be invoked as the superuser")
     }
     else if result.IOReturn == kIOReturnBadArgument {
         let maxSpeed = smc.getFanMaxRPM(UInt(fanNumber)).rpm
-        println("Invalid fan speed. Must be <= max fan speed (\(maxSpeed))")
+        print("Invalid fan speed. Must be <= max fan speed (\(maxSpeed))")
     }
     else if result.kSMC == SMC.kSMC.kSMCKeyNotFound.rawValue {
-        println("This machine has no fan #\(fanNumber)")
+        print("This machine has no fan #\(fanNumber)")
     }
     else {
-        println("FAILED: IOKit(\(result.IOReturn)), SMC(\(result.kSMC))")
+        print("FAILED: IOKit(\(result.IOReturn)), SMC(\(result.kSMC))")
     }
 }
 


var smc = SMC()
if smc.open() != kIOReturnSuccess {
    println("ERROR: Failed to open connection to SMC")
    exit(EX_UNAVAILABLE)
}




if CLIFanIdOption.isSet && CLIFanSpeedOption.isSet {
    setMinFanSpeed(CLIFanIdOption.value!, fanSpeed: CLIFanSpeedOption.value!)
}
else if CLIFanSpeedOption.isSet != CLIFanIdOption.isSet {   // XOR
    print("Usage: Must set fan number (-n) AND fan speed (-s)")
}

if let key = CLICheckKeyOption.value { checkKey(key) }
