Code to identify "compress"ed files for "file"

Guy Harris guy at sun.uucp
Tue Sep 3 18:26:13 AEST 1985


Here's some code to add into "file.c" somewhere before it starts scrabbling
around looking for C/FORTRAN/assembler-language keywords:

	if (buf[0] == '\037' && buf[1] == '\235') {
		printf("compressed data, ");
		if (buf[2]&0x80)
			printf("block compressed, ");
		printf("%d bits\n", buf[2]&0x1f);
		goto out;
	}

If you have "compress" on your system, this will recognize compressed files
and dump some extra information about them.

	Guy Harris



More information about the Net.bugs.v7 mailing list