+2007-08-19 6:30 Christos Zoulas <christos@zoulas.com>
+
+ * Make mime format consistent so that it can
+ be easily parsed:
+ mimetype [charset=character-set] [encoding=encoding-mime-type]
+
+ Remove spurious extra text from some MIME type printouts
+ (mostly in is_tar).
+
+ Fix one case where -i produced nothing at all (for a 1-byte file,
+ which is now classed as application/octet-stream).
+
+ Remove 7/8bit classifications, since they were arbitrary
+ and not based on the file data.
+
+ This work was done by Reuben Thomas
+
2007-05-24 10:00 Christos Zoulas <christos@zoulas.com>
* Fix another integer overflow (Colin Percival)
AC_CHECK_TYPE_STDC(int32_t, int)
AC_C_LONG_LONG
if test $ac_cv_c_long_long = yes; then
- long64='unsigned long long';
+ ulong64='unsigned long long';
+ long64='long long';
else
- long64='unsigned long';
+ ulong64='unsigned long';
+ long64='long';
fi
dnl This needs a patch to autoconf 2.13 acgeneral.m4
-AC_CHECK_TYPE2_STDC(uint64_t, $long64)
+AC_CHECK_TYPE2_STDC(uint64_t, $ulong64)
+AC_CHECK_TYPE2_STDC(int64_t, $long64)
AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0)
AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0)
# XPM icons (Greg Roelofs, newt@uchicago.edu)
# ideally should go into "images", but entries below would tag XPM as C source
-0 string /*\ XPM image/x-xpmi 7bit
+0 string /*\ XPM image/x-xpmi
# 3DS (3d Studio files) Conflicts with diff output 0x3d '='
#16 beshort 0x3d3d image/x-3ds
# PBMPLUS
# PBM file
-0 string P1 image/x-portable-bitmap 7bit
+0 string P1 image/x-portable-bitmap
# PGM file
-0 string P2 image/x-portable-greymap 7bit
+0 string P2 image/x-portable-greymap
# PPM file
-0 string P3 image/x-portable-pixmap 7bit
+0 string P3 image/x-portable-pixmap
# PBM "rawbits" file
0 string P4 image/x-portable-bitmap
# PGM "rawbits" file
# lisp: file(1) magic for lisp programs
#
# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
-0 string ;; text/plain 8bit
+0 string ;; text/plain
# Emacs 18 - this is always correct, but not very magical.
0 string \012( application/x-elc
# Emacs 19
# mail.news: file(1) magic for mail and news
#
# There are tests to ascmagic.c to cope with mail and news.
-0 string Relay-Version: message/rfc822 7bit
-0 string #!\ rnews message/rfc822 7bit
-0 string N#!\ rnews message/rfc822 7bit
-0 string Forward\ to message/rfc822 7bit
-0 string Pipe\ to message/rfc822 7bit
-0 string Return-Path: message/rfc822 7bit
+0 string Relay-Version: message/rfc822
+0 string #!\ rnews message/rfc822
+0 string N#!\ rnews message/rfc822
+0 string Forward\ to message/rfc822
+0 string Pipe\ to message/rfc822
+0 string Return-Path: message/rfc822
0 string Received: message/rfc822
-0 string Path: message/news 8bit
-0 string Xref: message/news 8bit
-0 string From: message/rfc822 7bit
-0 string Article message/news 8bit
+0 string Path: message/news
+0 string Xref: message/news
+0 string From: message/rfc822
+0 string Article message/news
#------------------------------------------------------------------------------
# msword: file(1) magic for MS Word files
#
#include "names.h"
#ifndef lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.50 2007/03/15 14:51:00 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.51 2007/08/19 03:45:07 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
}
if (code_mime) {
- if (file_printf(ms, "; charset=") == -1)
+ if (file_printf(ms, " charset=") == -1)
goto done;
if (file_printf(ms, code_mime) == -1)
goto done;
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.51 2007/03/05 02:41:29 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.52 2007/08/19 03:45:08 christos Exp $")
#endif
private struct {
rv = -1;
if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
goto error;
- if (file_printf(ms, " (") == -1)
+ if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
+ " compressed-encoding=" : " (") == -1)
goto error;
if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
goto error;
- if (file_printf(ms, ")") == -1)
+ if (!(ms->flags & MAGIC_MIME) &&
+ file_printf(ms, ")") == -1)
goto error;
rv = 1;
break;
#include "tar.h"
#ifndef lint
-FILE_RCSID("@(#)$File: is_tar.c,v 1.27 2007/01/12 17:38:28 christos Exp $")
+FILE_RCSID("@(#)$File: is_tar.c,v 1.28 2007/08/19 03:45:08 christos Exp $")
#endif
#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
return 1;
case 2:
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
- "application/x-tar, POSIX" : "POSIX tar archive") == -1)
+ "application/x-tar" : "POSIX tar archive") == -1)
return -1;
return 1;
case 3:
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
- "application/x-tar, POSIX (GNU)" :
- "POSIX tar archive (GNU)") == -1)
+ "application/x-tar" : "POSIX tar archive (GNU)") == -1)
return -1;
return 1;
default:
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.41 2007/03/26 17:59:50 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.42 2007/08/19 03:45:08 christos Exp $")
#endif /* lint */
#ifdef __EMX__
"application/x-empty" : "empty") == -1)
goto done;
} else if (nbytes == 1) {
- if (file_printf(ms, "very short file (no magic)") == -1)
+ if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
+ "application/octet-stream" : "very short file (no magic)") == -1)
goto done;
} else {
(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */