Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/pax/pax-compress.c
1808 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1987-2012 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#pragma prototyped
21
22
/*
23
* pax compress format
24
*/
25
26
#include "format.h"
27
28
static int
29
compress_getprologue(Pax_t* pax, Format_t* fp, Archive_t* ap, File_t* f, unsigned char* buf, size_t size)
30
{
31
if (size < 2 || buf[0] != 0x1f || buf[1] != 0x9d)
32
return 0;
33
ap->uncompressed = ap->io->size * 3;
34
return 1;
35
}
36
37
static Compress_format_t pax_compress_data =
38
{
39
0,
40
{ 0 },
41
{ "zcat" },
42
};
43
44
Format_t pax_compress_format =
45
{
46
"compress",
47
"lz",
48
"Lempel-Ziv compression",
49
0,
50
COMPRESS|IN|OUT,
51
0,
52
0,
53
0,
54
PAXNEXT(compress),
55
&pax_compress_data,
56
0,
57
compress_getprologue,
58
};
59
60
PAXLIB(compress)
61
62