Added archiver tests for gzip, compress, bzip

This commit is contained in:
Michiel Broek 2002-06-26 21:45:46 +00:00
parent 4ae500914c
commit 676d1948e5
2 changed files with 23 additions and 6 deletions

View File

@ -14,6 +14,7 @@ v0.35.02 22-Jun-2002
common.a: common.a:
Added debug nodelist IFT flag for logging. Added debug nodelist IFT flag for logging.
Added archive detection for tar, gzip and compress.
mbsetup: mbsetup:
Changed node records layout into 8 screens to be able to add Changed node records layout into 8 screens to be able to add

View File

@ -56,12 +56,28 @@ char *unpacker(char *fn)
fclose(fp); fclose(fp);
if (memcmp(buf,"PK",2) == 0) return (char *)"ZIP"; if (memcmp(buf,"PK\003\004",4) == 0) return (char *)"ZIP";
if (*buf == 0x1a) return (char *)"ARC"; if (*buf == 0x1a) return (char *)"ARC";
if (memcmp(buf+2,"-l",2) == 0) return (char *)"LHA"; if (memcmp(buf+2,"-l",2) == 0) return (char *)"LHA";
if (memcmp(buf,"ZOO",3) == 0) return (char *)"ZOO"; if (memcmp(buf,"ZOO",3) == 0) return (char *)"ZOO";
if (memcmp(buf,"`\352",2) == 0) return (char *)"ARJ"; if (memcmp(buf,"`\352",2) == 0) return (char *)"ARJ";
if (memcmp(buf,"Rar",3) == 0) return (char *)"RAR"; if (memcmp(buf,"Rar!",4) == 0) return (char *)"RAR";
if (memcmp(buf,"UC2\0x1a",4) == 0) return (char *)"UC2";
if (memcmp(buf,"BZ",2) == 0) return (char *)"BZIP";
if (memcmp(buf,"MSCF",4) == 0) return (char *)"CAB"; /* M$ CAB files */
if (memcmp(buf,"\037\213",2) == 0) return (char *)"GZIP"; /* gzip compressed data */
if (memcmp(buf,"\037\235",2) == 0) return (char *)"CMP"; /* unix compressed data */
if ((fp = fopen(fn,"r"))) {
fseek(fp, 257, SEEK_SET);
if (fread(buf,1,sizeof(buf),fp) != sizeof(buf)) {
WriteError("$Could not read position 257 of the file %s", fn);
fclose(fp);
return NULL;
}
fclose(fp);
}
if (memcmp(buf,"ustar",5) == 0) return (char *)"TAR"; /* GNU/Posix tar */
Syslog('p', "Unknown compress scheme in file %s", fn); Syslog('p', "Unknown compress scheme in file %s", fn);
return NULL; return NULL;