Skip to content

Instantly share code, notes, and snippets.

@tempelmann
Created March 29, 2026 20:13
Show Gist options
  • Select an option

  • Save tempelmann/0567400bfaceb424c893259a130ade60 to your computer and use it in GitHub Desktop.

Select an option

Save tempelmann/0567400bfaceb424c893259a130ade60 to your computer and use it in GitHub Desktop.
UTI conforms to
//
// 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