Created
May 17, 2014 06:46
-
-
Save trojanfoe/aa70d56e14d26036a634 to your computer and use it in GitHub Desktop.
Print the meaning of an OSX OSStatus code value
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 <Foundation/Foundation.h> | |
#import <CoreServices/CoreServices.h> | |
int main(int argc, const char **argv) | |
{ | |
@autoreleasepool { | |
for (int i = 1; i < argc; i++) { | |
char *endp; | |
long value = strtol(argv[i], &endp, 10); | |
if (*endp == '\0') { | |
printf("%10ld: %s (%s)\n", value, GetMacOSStatusCommentString((OSStatus)value), GetMacOSStatusErrorString((OSStatus)value)); | |
} else { | |
fprintf(stderr, "Invalid OSStatus code '%s' ignored\n", argv[i]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile with:
clang -fobjc-arc -o osstatus osstatus.m -framework Foundation -framework CoreServices