From 42aba8dcc8026a99e16290ad4e37e462656ccf4b Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 12 Jul 2011 11:31:59 +0000 Subject: [PATCH] Rename file system object MIME types for consistency with xdg-utils. --- src/fsmagic.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/fsmagic.c b/src/fsmagic.c index 8532d089..b8ea0715 100644 --- a/src/fsmagic.c +++ b/src/fsmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: fsmagic.c,v 1.61 2010/07/21 16:47:17 christos Exp $") +FILE_RCSID("@(#)$File: fsmagic.c,v 1.62 2010/09/20 20:16:08 rrt Exp $") #endif /* lint */ #include "magic.h" @@ -66,7 +66,7 @@ bad_link(struct magic_set *ms, int err, char *buf) const char *errfmt; int mime = ms->flags & MAGIC_MIME; if ((mime & MAGIC_MIME_TYPE) && - file_printf(ms, "application/x-symlink") + file_printf(ms, "inode/symlink") == -1) return -1; else if (!mime) { @@ -88,7 +88,7 @@ private int handle_mime(struct magic_set *ms, int mime, const char *str) { if ((mime & MAGIC_MIME_TYPE)) { - if (file_printf(ms, "application/%s", str) == -1) + if (file_printf(ms, "inode/%s", str) == -1) return -1; if ((mime & MAGIC_MIME_ENCODING) && file_printf(ms, "; charset=") == -1) @@ -159,7 +159,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) switch (sb->st_mode & S_IFMT) { case S_IFDIR: if (mime) { - if (handle_mime(ms, mime, "x-directory") == -1) + if (handle_mime(ms, mime, "directory") == -1) return -1; } else if (file_printf(ms, "directory") == -1) return -1; @@ -174,7 +174,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) if ((ms->flags & MAGIC_DEVICES) != 0) break; if (mime) { - if (handle_mime(ms, mime, "x-character-device") == -1) + if (handle_mime(ms, mime, "chardevice") == -1) return -1; } else { #ifdef HAVE_STAT_ST_RDEV @@ -206,7 +206,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) if ((ms->flags & MAGIC_DEVICES) != 0) break; if (mime) { - if (handle_mime(ms, mime, "x-block-device") == -1) + if (handle_mime(ms, mime, "blockdevice") == -1) return -1; } else { #ifdef HAVE_STAT_ST_RDEV @@ -233,7 +233,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) if((ms->flags & MAGIC_DEVICES) != 0) break; if (mime) { - if (handle_mime(ms, mime, "x-fifo") == -1) + if (handle_mime(ms, mime, "fifo") == -1) return -1; } else if (file_printf(ms, "fifo (named pipe)") == -1) return -1; @@ -242,7 +242,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) #ifdef S_IFDOOR case S_IFDOOR: if (mime) { - if (handle_mime(ms, mime, "x-door") == -1) + if (handle_mime(ms, mime, "door") == -1) return -1; } else if (file_printf(ms, "door") == -1) return -1; @@ -257,7 +257,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) return -1; } if (mime) { - if (handle_mime(ms, mime, "x-symlink") == -1) + if (handle_mime(ms, mime, "symlink") == -1) return -1; } else if (file_printf(ms, "unreadable symlink `%s' (%s)", fn, @@ -313,7 +313,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) return p != NULL ? 1 : -1; } else { /* just print what it points to */ if (mime) { - if (handle_mime(ms, mime, "x-symlink") == -1) + if (handle_mime(ms, mime, "symlink") == -1) return -1; } else if (file_printf(ms, "symbolic link to `%s'", buf) == -1) @@ -325,7 +325,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) #ifndef __COHERENT__ case S_IFSOCK: if (mime) { - if (handle_mime(ms, mime, "x-socket") == -1) + if (handle_mime(ms, mime, "socket") == -1) return -1; } else if (file_printf(ms, "socket") == -1) return -1; -- 2.40.0