#include "tar.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: is_tar.c,v 1.25 2004/09/11 19:15:57 christos Exp $")
+FILE_RCSID("@(#)$Id: is_tar.c,v 1.26 2006/05/03 15:19:25 christos Exp $")
#endif
#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
"application/x-tar, POSIX" : "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)
+ return -1;
+ return 1;
default:
return 0;
}
if (sum != recsum)
return 0; /* Not a tar archive */
- if (0==strcmp(header->header.magic, TMAGIC))
+ if (strcmp(header->header.magic, GNUTMAGIC) == 0)
+ return 3; /* GNU Unix Standard tar archive */
+ if (strcmp(header->header.magic, TMAGIC) == 0)
return 2; /* Unix Standard tar archive */
return 1; /* Old fashioned tar archive */
*
* Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
*
- * $Id: tar.h,v 1.8 2004/09/11 19:15:58 christos Exp $ # checkin only
+ * $Id: tar.h,v 1.9 2006/05/03 15:19:25 christos Exp $ # checkin only
*/
/*
#define CHKBLANKS " " /* 8 blanks, no null */
/* The magic field is filled with this if uname and gname are valid. */
-#define TMAGIC "ustar " /* 7 chars and a null */
+#define TMAGIC "ustar" /* 5 chars and a null */
+#define GNUTMAGIC "ustar " /* 7 chars and a null */
/* The linkflag defines the type of file */
#define LF_OLDNORMAL '\0' /* Normal disk file, Unix compat */