file(1) and marshal(1) assign vCards a MIME type of text/x-vcard. This patch changes them to use the IANA assigned type 'text/directory'. Note that with this patch, "file -m vcard-file" will print the string text/directory;profile=vcard I.e. it includes the recommended 'profile' parameter. This could potentially break existing code that naïvely parses the output by assuming everything after the '/' is the subtype. But considering how this output is typically used it shouldn't be an issue. Reference: /n/sources/patch/applied/mime-vcard Date: Tue Jan 18 21:47:31 CET 2011 Signed-off-by: lyndon@orthanc.ca --- /sys/lib/mimetype Tue Jan 18 21:31:10 2011 +++ /sys/lib/mimetype Tue Jan 18 21:31:08 2011 @@ -146,7 +146,7 @@ .txt text plain - y .ucert application x-x509-user-cert - y # DER X.509 user certificate .ustar application x-ustar - m -.vcf text x-vcard - y # vCard +.vcf text directory - y # vCard .wav audio x-wav - y .wbmp image vnd.wap.wbmp - y # wireless bitmap .wml text vnd.wap.wml - m # WML doc --- /sys/src/cmd/file.c Tue Jan 18 21:31:15 2011 +++ /sys/src/cmd/file.c Tue Jan 18 21:31:12 2011 @@ -339,7 +339,7 @@ return; } if(mbuf->type != 'M' && mbuf->type != '|') { - print(mime ? OCTET : "special file #%C/%s\n", + print(mime ? OCTET : "special file #%c/%s\n", mbuf->type, mbuf->name); return; } @@ -586,7 +586,6 @@ /* "pXc2 */ 0x32630070, 0xFFFF00FF, "pac4 audio file\n", OCTET, 0xBA010000, 0xFFFFFFFF, "mpeg system stream\n", OCTET, - 0x43614c66, 0xFFFFFFFF, "FLAC audio file\n", OCTET, 0x30800CC0, 0xFFFFFFFF, "inferno .dis executable\n", OCTET, 0x04034B50, 0xFFFFFFFF, "zip archive\n", "application/zip", 070707, 0xFFFF, "cpio archive\n", OCTET, @@ -596,16 +595,6 @@ 0xfffe, 0xffffffff, "utf-32le\n", "text/plain charset=utf-32le", 0xfeff, 0xffff, "utf-16be\n", "text/plain charset=utf-16be", 0xfffe, 0xffff, "utf-16le\n", "text/plain charset=utf-16le", - /* 0xfeedface: this could alternately be a Next Plan 9 boot image */ - 0xcefaedfe, 0xFFFFFFFF, "32-bit power Mach-O executable\n", OCTET, - /* 0xfeedfacf */ - 0xcffaedfe, 0xFFFFFFFF, "64-bit power Mach-O executable\n", OCTET, - /* 0xcefaedfe */ - 0xfeedface, 0xFFFFFFFF, "386 Mach-O executable\n", OCTET, - /* 0xcffaedfe */ - 0xfeedfacf, 0xFFFFFFFF, "amd64 Mach-O executable\n", OCTET, - /* 0xcafebabe */ - 0xbebafeca, 0xFFFFFFFF, "Mach-O universal executable\n", OCTET, /* * venti & fossil magic numbers are stored big-endian on disk, * thus the numbers appear reversed in this table. @@ -825,6 +814,8 @@ "pem x.509 certificate", -1, "text/plain", "subject=/C=", "pem certificate with header", -1, "text/plain", "process snapshot ", "process snapshot", -1, "application/snapfs", + "BEGIN:VCARD\r\n", "vCard", 13, "text/directory;profile=vcard", + "BEGIN:VCARD\n", "vCard", 12, "text/directory;profile=vcard", 0,0,0,0 };