/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1987-2012 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#pragma prototyped2021/*22* pax xz format23*/2425#include "format.h"2627static int28xz_getprologue(Pax_t* pax, Format_t* fp, Archive_t* ap, File_t* f, unsigned char* buf, size_t size)29{30off_t pos;31unsigned char foot[6];3233if (size < 5 || buf[0] != 0xfd || buf[1] != '7' || buf[2] != 'z' || buf[3] != 'X' || buf[4] != 'Z')34return 0;35if ((pos = lseek(ap->io->fd, (off_t)0, SEEK_CUR)) < 0 || lseek(ap->io->fd, (off_t)-sizeof(foot), SEEK_END) <= 0 || read(ap->io->fd, foot, sizeof(foot)) != sizeof(foot) || foot[4] != 0x59 || foot[5] != 0x5A)36return 0;37else38ap->uncompressed = (foot[0]) |39(foot[1] << 8) |40(foot[2] << 16) |41(foot[3] << 24);42lseek(ap->io->fd, pos, SEEK_SET);43return 1;44}4546static Compress_format_t pax_xz_data =47{480,49{ "xz", "--decompress" },50{ 0 },51};5253Format_t pax_xz_format =54{55"xz",560,57"xz compression",580,59COMPRESS|IN|OUT,600,610,620,63PAXNEXT(xz),64&pax_xz_data,650,66xz_getprologue,67};6869PAXLIB(xz)707172