compression itself.
+
+2015-06-03 14:30 Christos Zoulas <christos@zoulas.com>
+
+ * PR/455: Implement -Z, look inside, but don't report on compression
+ * PR/454: Fix allocation error on bad magic.
+
2015-05-29 10:30 Christos Zoulas <christos@zoulas.com>
* handle MAGIC_CONTINUE everywhere, not just in softmagic
-.\" $File: file.man,v 1.115 2015/05/29 14:27:31 christos Exp $
-.Dd May 29, 2015
+.\" $File: file.man,v 1.116 2015/06/03 18:21:24 christos Exp $
+.Dd June 3, 2015
.Dt FILE __CSECTION__
.Os
.Sh NAME
.Sh SYNOPSIS
.Nm
.Bk -words
-.Op Fl bcEhiklLNnprsvz0
+.Op Fl bcEhiklLNnprsvzZ0
.Op Fl Fl apple
.Op Fl Fl extension
.Op Fl Fl mime-encoding
Print the version of the program and exit.
.It Fl z , Fl Fl uncompress
Try to look inside compressed files.
+.It Fl Z , Fl Fl uncompress-noreport
+Try to look inside compressed files, but report information about the contents
+only not the compression.
.It Fl 0 , Fl Fl print0
Output a null character
.Sq \e0
-.\" $File: libmagic.man,v 1.36 2015/04/10 15:36:01 christos Exp $
+.\" $File: libmagic.man,v 1.37 2015/06/03 18:21:24 christos Exp $
.\"
.\" Copyright (c) Christos Zoulas 2003.
.\" All Rights Reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 9, 2015
+.Dd June 3, 2015
.Dt LIBMAGIC 3
.Os
.Sh NAME
Return the Apple creator and type.
.It Dv MAGIC_EXTENSION
Return a slash-separated list of extensions for this file type.
+.It Dv MAGIC_COMPRESS_TRANSP
+Don't report on compression, only report about the uncompressed data.
.It Dv MAGIC_NO_CHECK_APPTYPE
Don't check for
.Dv EMX
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.79 2015/03/27 17:35:39 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.80 2015/06/03 18:21:24 christos Exp $")
#endif
#include "magic.h"
if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
goto error;
- if (mime == MAGIC_MIME || mime == 0) {
+ if ((ms->flags & MAGIC_COMPRESS_TRANSP) == 0 &&
+ (mime == MAGIC_MIME || mime == 0)) {
if (file_printf(ms, mime ?
" compressed-encoding=" : " (") == -1)
goto error;
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.163 2015/04/09 20:01:41 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.164 2015/06/03 18:21:24 christos Exp $")
#endif /* lint */
#include "magic.h"
#endif
#ifdef S_IFLNK
-#define FILE_FLAGS "-bcEhikLlNnprsvz0"
+#define FILE_FLAGS "-bcEhikLlNnprsvzZ0"
#else
-#define FILE_FLAGS "-bcEiklNnprsvz0"
+#define FILE_FLAGS "-bcEiklNnprsvzZ0"
#endif
# define USAGE \
#undef OPT_LONGONLY
{0, 0, NULL, 0}
};
-#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvz0"
+#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvzZ0"
private const struct {
const char *name;
case 'z':
flags |= MAGIC_COMPRESS;
break;
+
+ case 'Z':
+ flags |= MAGIC_COMPRESS|MAGIC_COMPRESS_TRANSP;
+ break;
#ifdef S_IFLNK
case 'L':
flags |= MAGIC_SYMLINK;
OPT('m', "magic-file", 1, " LIST use LIST as a colon-separated list of magic\n"
" number files\n")
OPT('z', "uncompress", 0, " try to look inside compressed files\n")
+OPT('Z', "uncompress-noreport", 0, " only print the contents of compressed files\n")
OPT('b', "brief", 0, " do not prepend filenames to output lines\n")
OPT('c', "checking-printout", 0, " print the parsed form of the magic file, use in\n"
" conjunction with -m to debug a new magic file\n"
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
#define MAGIC_APPLE 0x0000800 /* Return the Apple creator/type */
#define MAGIC_EXTENSION 0x1000000 /* Return a /-separated list of
- * extensions */
+ * extensions */
+#define MAGIC_COMPRESS_TRANSP 0x2000000 /* Check inside compressed files
+ * but not report compression */
#define MAGIC_NODESC (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
#define MAGIC_NO_CHECK_COMPRESS 0x0001000 /* Don't check for compressed files */