Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libardir/ardir.h
1808 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2002-2011 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
* David Korn <[email protected]> *
19
* *
20
***********************************************************************/
21
#pragma prototyped
22
23
/*
24
* archive scan/touch/extract interface
25
*/
26
27
#ifndef _ARDIR_H
28
#define _ARDIR_H 1
29
30
#include <ast.h>
31
#include <ls.h>
32
33
#define ARDIR_VERSION 20020501L
34
35
/*
36
* retain this order!
37
*/
38
39
#define ARDIR_CREATE 0x0001
40
#define ARDIR_DELETE 0x0002
41
#define ARDIR_REPLACE (ARDIR_CREATE|ARDIR_DELETE)
42
43
#define ARDIR_FORCE 0x0004
44
#define ARDIR_LOCAL 0x0008
45
#define ARDIR_NEWER 0x0010
46
#define ARDIR_OUTOFDATE 0x0020
47
#define ARDIR_RANLIB 0x0040
48
#define ARDIR_SEQUENTIAL 0x0080
49
#define ARDIR_UPDATE 0x0100
50
51
struct Ardir_s; typedef struct Ardir_s Ardir_t;
52
struct Ardirent_s; typedef struct Ardirent_s Ardirent_t;
53
struct Ardirmeth_s; typedef struct Ardirmeth_s Ardirmeth_t;
54
55
struct Ardirmeth_s
56
{
57
const char* name;
58
const char* description;
59
int (*openf)(Ardir_t*, char*, size_t);
60
Ardirent_t* (*nextf)(Ardir_t*);
61
int (*changef)(Ardir_t*, Ardirent_t*);
62
int (*insertf)(Ardir_t*, const char*, int);
63
const char* (*specialf)(Ardir_t*);
64
int (*closef)(Ardir_t*);
65
Ardirmeth_t* next;
66
};
67
68
struct Ardirent_s
69
{
70
char* name;
71
time_t mtime;
72
off_t offset;
73
off_t size;
74
uid_t uid;
75
gid_t gid;
76
mode_t mode;
77
#ifdef _ARDIRENT_PRIVATE_
78
_ARDIRENT_PRIVATE_
79
#endif
80
};
81
82
struct Ardir_s
83
{
84
unsigned long version;
85
char* path;
86
struct stat st;
87
unsigned long symtime;
88
Ardirmeth_t* meth;
89
void* data;
90
unsigned int flags;
91
int error;
92
int fd;
93
int truncate;
94
Ardirent_t dirent;
95
#ifdef _ARDIR_PRIVATE_
96
_ARDIR_PRIVATE_
97
#endif
98
};
99
100
extern Ardirmeth_t* ardirmeth(const char*);
101
extern Ardirmeth_t* ardirlist(Ardirmeth_t*);
102
extern Ardir_t* ardiropen(const char*, Ardirmeth_t*, int);
103
extern Ardirent_t* ardirnext(Ardir_t*);
104
extern off_t ardircopy(Ardir_t*, Ardirent_t*, int);
105
extern int ardirchange(Ardir_t*, Ardirent_t*);
106
extern int ardirinsert(Ardir_t*, const char*, int);
107
extern const char* ardirspecial(Ardir_t*);
108
extern int ardirclose(Ardir_t*);
109
110
#endif
111
112