/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1987-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* pax common definitions
*/
#ifndef _PAX_H
#include <ast.h>
#include <ls.h>
#include <sig.h>
#include <ftwalk.h>
#include <ctype.h>
#include <ccode.h>
#include <hash.h>
#include <proc.h>
#include <regex.h>
#include <error.h>
#include <times.h>
#include <swap.h>
#include <align.h>
#include <debug.h>
#include <stdarg.h>
#include <sum.h>
#include <tv.h>
#include <fnv.h>
#include <tar.h>
#define bsave(ap) (state.backup=(*(ap)->io),error(-7, "bsave(%s,@%I*d)", ap->name, sizeof(ap->io->count), ap->io->count))
#define getbuffer(n) (((n)>=BUFFER_FD_MIN&&(n)<=BUFFER_FD_MAX)?&state.buffer[BUFFER_FD_MAX-(n)]:(Buffer_t*)0)
#define holedone(fd) do if(state.hole){lseek(fd,state.hole-1,SEEK_CUR);state.hole=0;write(fd,"",1);} while(0)
#define ropath(p) (p[0]=='.'&&(p[1]==0||p[1]=='.'&&(p[2]==0||p[2]=='.'&&p[3]==0))||p[0]=='-'&&p[1]==0)
/*
* format generic definitions
*/
typedef int (*Link_f)(const char*, const char*);
#define _PAX_IO_PRIVATE_ \
char* next; /* next char pointer */ \
char* last; /* last char+1 pointer */ \
char* buffer; /* io buffer */ \
unsigned int fill; /* bsave fill serial */ \
int skip; /* volume skip */ \
int keep; /* volume keep after skip */ \
int mode; /* open() O_* mode */ \
int unread; /* max unread size */ \
{
} Buffer_t;
{
} Fileid_t;
{
} Link_t;
#define _PAX_FILE_PRIVATE_ \
unsigned long checksum; /* data checksum */ \
struct \
{ \
int op; /* op */ \
int same; /* SRC and TAR same */ \
unsigned long checksum; /* data checksum */ \
unsigned long index; /* index */ \
} delta; /* delta info */ \
int extended; /* extended header file */ \
int fd; /* >=0 read fd */ \
char* id; /* archive file id */ \
char* intermediate; /* intermediate output name */ \
int linkpathsize; /* linkname size with null byte */ \
int magic; /* header magic number */ \
int namesize; /* name size with null byte */ \
int perm; /* original st_mode perm */ \
int type; /* st_mode type */ \
char* uidname; /* user id name */ \
char* gidname; /* group id name */ \
struct \
{ \
char* partial; /* partial record buffer */ \
int blocks; /* io block count */ \
int format; /* format */ \
int section; /* file section number */ \
} record; /* record format info */ \
{
};
{
{
{
};
{
};
{
} Post_t;
{
uint32_t l;
uint16_t s[2];
uint8_t c[4];
} Integral_t;
{
} Convert_t;
{
} Delta_t;
typedef struct Part_s
{
off_t n;
} Part_t;
struct Filter_s
{
};
typedef struct Pattern_s
{
char* pattern;
unsigned char directory;
unsigned char matched;
} Pattern_t;
#define _PAX_ARCHIVE_PRIVATE_ \
unsigned long checksum; /* running checksum */ \
int checkdelta; /* getprologue delta check */ \
int errors; /* intermediate error count */ \
int locked; /* newio() recursion lock */ \
unsigned long memsum; /* member checksum */ \
int ordered; /* archive members ordered */ \
struct \
{ \
unsigned long checksum; /* old running checksum */ \
unsigned long memsum; /* old checksum */ \
int warned; /* old checksum warning */ \
} old; \
char* package; /* package id */ \
int part; /* media change count */ \
struct /* stash() values */ \
{ \
} path; \
int peek; /* already peeked at file entry */ \
int raw; /* don't convert sections */ \
int section; /* current archive section */ \
int sum; /* collect running checksum */ \
int swap; /* swap operation */ \
int swapio; /* io swap operation */ \
struct \
{ \
} tmp; /* temporary stuff */ \
char* type; /* archive type */ \
int warnlinkhead; /* invalid hard link header */
#define _PAX_PRIVATE_ \
int acctime; /* preserve member access times */ \
int append; /* append -- must be 0 or 1 !!! */ \
long blocksize; /* explicit buffer size */ \
struct \
{ \
char* name; /* archive member name */ \
char* path; /* local file path */ \
} checksum; /* --checksum state */ \
int chmod; /* must preserve mode */ \
int clobber; /* overwrite output files */ \
int complete; /* files completely in volume */ \
int current; /* current file[] index */ \
struct \
{ \
int bufferindex; /* delta buffer index */ \
int buffersize; /* delta buffer size */ \
int update; /* update only delta members */ \
} delta; /* delta info */ \
int delta2delta; /* -rz- -wz- : retain delta info*/ \
int descend; /* dir names self+descendents */ \
char* destination; /* pass mode destination dir */ \
unsigned short devcnt; /* dev assignment count */ \
int drop; /* drop a `.' for each file */ \
int dropcount; /* current line drop count */ \
int exact; /* exact archive read */ \
char** files; /* alternate file name list */ \
struct \
{ \
char* options; /* line mode options */ \
char* command; /* line mode command */ \
char* path; /* line mode physical path */ \
char* name; /* line mode logical path */ \
int line; /* line mode */ \
} filter; /* file output filter state */ \
int forceconvert; /* force binary conversion */ \
int ftwflags; /* ftwalk() flags */ \
struct \
{ \
char* comment; /* comment text */ \
int invalid; /* invalid path INVALID_ action */ \
int linkdata; /* data with each hard link */ \
char* listformat; /* verbose listing format */ \
char* global; /* global header name format */ \
char* extended; /* extended name format */ \
} header; /* header specific options */ \
unsigned short inocnt; /* ino assignment count */ \
struct \
{ \
char* name; /* archive member name */ \
char* path; /* local file path */ \
} install; /* --install state */ \
int intermediate; /* intermediate ouput - rename */ \
int interrupt; /* this signal caused exit */ \
char* listformat; /* verbose listing format */ \
struct \
{ \
unsigned char* a2n; /* CC_ASCII=>CC_NATIVE */ \
unsigned char* e2n; /* CC_EBCDIC=>CC_NATIVE */ \
unsigned char* n2e; /* CC_NATIVE=>CC_EBCDIC */ \
} map; /* ccode maps */ \
int matchsense; /* pattern match sense */ \
struct \
{ \
int fancy; /* fancy display */ \
int last; /* length of last display path */ \
int on; /* meter progress */ \
int width; /* display line width */ \
} meter; /* meter state */ \
int mkdir; /* make intermediate dirs */ \
struct \
{ \
char* magic; /* separator magic */ \
} mime; \
char* mode; /* output chmod(1) mode */ \
int modtime; /* retain mtime */ \
char* mtime; /* output date(1) mtime */ \
int newer; /* append only if newer */ \
int operation; /* IN|OUT operation mode */ \
int ordered; /* sorted base and file list */ \
int owner; /* set owner info */ \
int pass; /* archive to archive */ \
char* peekfile; /* stdin file list peek */ \
int peeklen; /* peekfile length */ \
int pwdlen; /* pwd length sans null */ \
struct \
{ \
int charset; /* convert record charset */ \
int delimiter; /* directory delimiter */ \
int format; /* record format */ \
char* header; /* file header */ \
int headerlen; /* file header length */ \
int line; /* convert records<->lines */ \
int pad; /* pad output record blocks */ \
char* pattern; /* format match pattern */ \
int offset; /* data buffer offset */ \
long size; /* io size */ \
char* trailer; /* file trailer */ \
int trailerlen; /* file trailer length */ \
} record; /* record info */ \
int resetacctime; /* reset input file access times*/ \
int scanned; /* scanned for format libs */ \
int setgid; /* set file gid to this value */ \
int setuid; /* set file uid to this value */ \
int sync; /* fsync() each file after copy */ \
unsigned long testdate; /* listformat test date */ \
struct \
{ \
char* buffer; /* temporary buffer */ \
long buffersize; /* temporary buffer size */ \
char* delta; /* tmp delta file name */ \
char* file; /* tmp file name */ \
} tmp; /* temporary stuff */ \
int update; /* copy file only if newer */ \
char* usage; /* optget() usage string */ \
int warnmkdir; /* --mkdir hint issued */ \
int warnlinknum; /* too many hard links */ \
#include "paxlib.h"
#include "options.h"
extern char* definput;
extern char* defoutput;
extern char* eomprompt;
extern long asc_checksum(char*, int, unsigned long);
extern long bblock(int);
extern void deltadelete(Archive_t*);
extern void deltaverify(Archive_t*);
extern int dirprefix(char*, char*, int);
extern void finish(int);
extern Archive_t* getarchive(int);
extern int getepilogue(Archive_t*);
extern void getidnames(File_t*);
extern int getprologue(Archive_t*);
extern Archive_t* initarchive(const char*, int);
extern void initmatch(char**);
extern void interactive(void);
extern int match(char*);
extern void nospace(void);
extern unsigned long omemsum(const void*, int, unsigned long);
extern void putepilogue(Archive_t*);
extern void putprologue(Archive_t*, int);
extern char* release(void);
extern int restore(const char*, char*, void*);
extern void setidnames(File_t*);
extern char* strlower(char*);
extern char* strupper(char*);
#endif