#include "file.h"#include "magic.h"#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <errno.h>#include <sys/types.h>#include <sys/wait.h>Go to the source code of this file.
Functions | |
| FILE_RCSID ("@(#)$Id: compress.c,v 1.42 2005/03/06 05:58:22 christos Exp $") private struct | |
| private ssize_t | swrite (int fd, const void *buf, size_t n) |
| private ssize_t | sread (int fd, void *buf, size_t n) |
| private size_t | uncompressbuf (struct magic_set *ms, int fd, size_t method, const unsigned char *old, unsigned char **newch, size_t n) |
| protected int | file_zmagic (struct magic_set *ms, int fd, const unsigned char *buf, size_t nbytes) |
| protected int | file_pipe2file (struct magic_set *ms, int fd, const void *startbuf, size_t nbytes) |
Variables | |
| compr [] | |
| private int | ncompr = sizeof(compr) / sizeof(compr[0]) |
| protected int file_pipe2file | ( | struct magic_set * | ms, | |
| int | fd, | |||
| const void * | startbuf, | |||
| size_t | nbytes | |||
| ) |
Definition at line 190 of file compress.c.
References errno, file_badseek(), file_error(), SEEK_SET, sread(), and swrite().
| FILE_RCSID | ( | "@(#)$Id: compress. | c, | |
| v 1.42 2005/03/06 05:58:22 christos Exp $" | ||||
| ) |
Definition at line 53 of file compress.c.
| protected int file_zmagic | ( | struct magic_set * | ms, | |
| int | fd, | |||
| const unsigned char * | buf, | |||
| size_t | nbytes | |||
| ) |
Definition at line 101 of file compress.c.
References compr, file_buffer(), file_printf(), magic_set::flags, and uncompressbuf().
| private ssize_t sread | ( | int | fd, | |
| void * | buf, | |||
| size_t | n | |||
| ) |
Definition at line 167 of file compress.c.
References errno.
Referenced by file_pipe2file(), and uncompressbuf().
| private ssize_t swrite | ( | int | fd, | |
| const void * | buf, | |||
| size_t | n | |||
| ) |
Definition at line 142 of file compress.c.
References errno.
Referenced by file_pipe2file(), and uncompressbuf().
| private size_t uncompressbuf | ( | struct magic_set * | ms, | |
| int | fd, | |||
| size_t | method, | |||
| const unsigned char * | old, | |||
| unsigned char ** | newch, | |||
| size_t | n | |||
| ) |
Definition at line 326 of file compress.c.
References compr, errno, EXIT_FAILURE, file_error(), HOWMANY, SEEK_SET, sread(), and swrite().
Referenced by file_zmagic().
| compr[] |
{
{ "\037\235", 2, { "gzip", "-cdq", NULL }, 1 },
{ "\037\235", 2, { "uncompress", "-c", NULL }, 1 },
{ "\037\213", 2, { "gzip", "-cdq", NULL }, 1 },
{ "\037\236", 2, { "gzip", "-cdq", NULL }, 1 },
{ "\037\240", 2, { "gzip", "-cdq", NULL }, 1 },
{ "\037\036", 2, { "gzip", "-cdq", NULL }, 0 },
{ "PK\3\4", 4, { "gzip", "-cdq", NULL }, 1 },
{ "BZh", 3, { "bzip2", "-cd", NULL }, 1 },
}
Definition at line 66 of file compress.c.
Referenced by file_zmagic(), and uncompressbuf().
Definition at line 83 of file compress.c.
1.6.1