Created
March 29, 2026 20:13
-
-
Save tempelmann/0567400bfaceb424c893259a130ade60 to your computer and use it in GitHub Desktop.
UTI conforms to
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
| // | |
| // main.m | |
| // uti-conforms-to | |
| // | |
| // Created by Thomas Tempelmann on 29.03.26. | |
| // | |
| #import <Foundation/Foundation.h> | |
| #include <libgen.h> | |
| int main(int argc, const char * argv[]) { | |
| if (argc != 3) { | |
| printf("Usage: %s uti1 uti2\n", dirname((char*)argv[0])); | |
| return 2; | |
| } | |
| int conforms = UTTypeConformsTo ( | |
| CFStringCreateWithCString (NULL, argv[1], kCFStringEncodingUTF8), | |
| CFStringCreateWithCString (NULL, argv[2], kCFStringEncodingUTF8) | |
| ); | |
| if (conforms) { | |
| printf("%s conforms to %s\n", argv[1], argv[2]); | |
| return 0; | |
| } else { | |
| printf("%s does not conform to %s\n", argv[1], argv[2]); | |
| return 1; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment