1/* 2 * compress routines: 3 * zmagic() - returns 0 if not recognized, uncompresses and prints 4 * information if recognized 5 * uncompress(method, old, n, newch) - uncompress old into new, 6 * using method, return sizeof new 7 */ 8#include "file.h" 9#include <stdio.h> 10#include <stdlib.h> 11#ifdef HAVE_UNISTD_H 12#include <unistd.h> 13#endif 14#include <string.h> 15#ifdef HAVE_SYS_WAIT_H 16#include <sys/wait.h> 17#endif 18#ifndef lint
| 1/* 2 * compress routines: 3 * zmagic() - returns 0 if not recognized, uncompresses and prints 4 * information if recognized 5 * uncompress(method, old, n, newch) - uncompress old into new, 6 * using method, return sizeof new 7 */ 8#include "file.h" 9#include <stdio.h> 10#include <stdlib.h> 11#ifdef HAVE_UNISTD_H 12#include <unistd.h> 13#endif 14#include <string.h> 15#ifdef HAVE_SYS_WAIT_H 16#include <sys/wait.h> 17#endif 18#ifndef lint
|
20#endif 21 22 23static struct { 24 const char *magic; 25 int maglen; 26 const char *const argv[3]; 27 int silent; 28} compr[] = { 29 { "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */ 30 /* Uncompress can get stuck; so use gzip first if we have it 31 * Idea from Damien Clark, thanks! */ 32 { "\037\235", 2, { "uncompress", "-c", NULL }, 1 }, /* compressed */ 33 { "\037\213", 2, { "gzip", "-cdq", NULL }, 1 }, /* gzipped */ 34 { "\037\236", 2, { "gzip", "-cdq", NULL }, 1 }, /* frozen */ 35 { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */ 36 /* the standard pack utilities do not accept standard input */ 37 { "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */
| 20#endif 21 22 23static struct { 24 const char *magic; 25 int maglen; 26 const char *const argv[3]; 27 int silent; 28} compr[] = { 29 { "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */ 30 /* Uncompress can get stuck; so use gzip first if we have it 31 * Idea from Damien Clark, thanks! */ 32 { "\037\235", 2, { "uncompress", "-c", NULL }, 1 }, /* compressed */ 33 { "\037\213", 2, { "gzip", "-cdq", NULL }, 1 }, /* gzipped */ 34 { "\037\236", 2, { "gzip", "-cdq", NULL }, 1 }, /* frozen */ 35 { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */ 36 /* the standard pack utilities do not accept standard input */ 37 { "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */
|
38 { "BZh", 3, { "bzip2", "-d", NULL }, 1 }, /* bzip2-ed */
| 38 { "BZh", 3, { "bzip2", "-cd", NULL }, 1 }, /* bzip2-ed */
|
39}; 40 41static int ncompr = sizeof(compr) / sizeof(compr[0]); 42 43 44static int uncompress __P((int, const unsigned char *, unsigned char **, int)); 45static int swrite __P((int, const void *, size_t)); 46static int sread __P((int, void *, size_t));
--- 146 unchanged lines hidden --- | 39}; 40 41static int ncompr = sizeof(compr) / sizeof(compr[0]); 42 43 44static int uncompress __P((int, const unsigned char *, unsigned char **, int)); 45static int swrite __P((int, const void *, size_t)); 46static int sread __P((int, void *, size_t));
--- 146 unchanged lines hidden --- |