00001 /******************************************************************************* 00002 This file is part of mDictionary 00003 00004 mDictionary is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 mDictionary is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with WhiteStork; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 00018 Copyright 2006-2008 ComArch S.A. 00019 *******************************************************************************/ 00026 #ifndef _WS_UNTAR 00027 #define _WS_UNTAR 00028 00029 #include <glib.h> 00030 #include <untar.h> 00031 #include <stdio.h> 00032 #include <stdlib.h> 00033 #include <string.h> 00034 #include <bzlib.h> 00035 #include <sys/stat.h> 00036 00044 00047 #define BLOCK_SIZE 512 00048 00051 #define BUFFER_SIZE BLOCK_SIZE*32 00052 00055 #define ASCII_NR(NR) (NR + 0x30) 00056 00061 typedef struct _TarHeader 00062 { 00063 gchar name[100]; 00064 gchar mode[8]; 00065 gchar uid[8]; 00066 gchar gid[8]; 00067 gchar size[12]; 00068 gchar mtime[12]; 00069 gchar chksum[8]; 00070 gchar typeflag; 00071 gchar linkname[100]; 00072 gchar magic[6]; 00073 gchar version[2]; 00074 gchar uname[32]; 00075 gchar gname[32]; 00076 gchar devmajor[8]; 00077 gchar devminor[8]; 00078 gchar prefix[155]; 00079 gchar padding[12]; 00080 gchar *gnu_longname; 00081 gchar *gnu_longlink; 00082 } TarHeader; 00083 00091 typedef enum _RecordType 00092 { 00093 File = ASCII_NR (0), 00094 ARCHLINK = ASCII_NR (1), 00095 SYMLINK = ASCII_NR (2), 00096 CHARDEV = ASCII_NR (3), 00097 BLOCKDEV = ASCII_NR (4), 00098 Dir = ASCII_NR (5), 00099 FIFO = ASCII_NR (6), 00100 RESERVED = ASCII_NR (7) 00101 } RecordType; 00102 00106 gint decompress_file(gchar *in_file, gchar **out_path); 00107 00110 #endif /*_WS_UNTAR*/ 00111