summaryrefslogtreecommitdiff
path: root/bin/pax/extern.h
blob: 405db1954603dcb6cdbc82c29cc7b6ae31ce29f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/*	$OpenBSD: extern.h,v 1.21 2002/02/16 21:27:07 millert Exp $	*/
/*	$NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $	*/

/*-
 * Copyright (c) 1992 Keith Muller.
 * Copyright (c) 1992, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Keith Muller of the University of California, San Diego.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	@(#)extern.h	8.2 (Berkeley) 4/18/94
 */

/*
 * External references from each source file
 */

#include <sys/cdefs.h>

/*
 * ar_io.c
 */
extern char *arcname;
extern const char *gzip_program;
int ar_open(char *);
void ar_close(void);
void ar_drain(void);
int ar_set_wr(void);
int ar_app_ok(void);
int ar_read(register char *, register int);
int ar_write(register char *, register int);
int ar_rdsync(void);
int ar_fow(off_t, off_t *);
int ar_rev(off_t );
int ar_next(void);

/*
 * ar_subs.c
 */
extern u_long flcnt;
void list(void);
void extract(void);
void append(void);
void archive(void);
void copy(void);

/*
 * buf_subs.c
 */
extern int blksz;
extern int wrblksz;
extern int maxflt;
extern int rdblksz;
extern off_t wrlimit;
extern off_t rdcnt;
extern off_t wrcnt;
int wr_start(void);
int rd_start(void);
void cp_start(void);
int appnd_start(off_t);
int rd_sync(void);
void pback(char *, int);
int rd_skip(off_t);
void wr_fin(void);
int wr_rdbuf(register char *, register int);
int rd_wrbuf(register char *, register int);
int wr_skip(off_t);
int wr_rdfile(ARCHD *, int, off_t *);
int rd_wrfile(ARCHD *, int, off_t *);
void cp_file(ARCHD *, int, int);
int buf_fill(void);
int buf_flush(register int);

/*
 * cache.c
 */
int uidtb_start(void);
int gidtb_start(void);
int usrtb_start(void);
int grptb_start(void);
char * name_uid(uid_t, int);
char * name_gid(gid_t, int);
int uid_name(char *, uid_t *);
int gid_name(char *, gid_t *);

/*
 * cpio.c
 */
int cpio_strd(void);
int cpio_trail(register ARCHD *);
int cpio_endwr(void);
int cpio_id(char *, int);
int cpio_rd(register ARCHD *, register char *);
off_t cpio_endrd(void);
int cpio_stwr(void);
int cpio_wr(register ARCHD *);
int vcpio_id(char *, int);
int crc_id(char *, int);
int crc_strd(void);
int vcpio_rd(register ARCHD *, register char *);
off_t vcpio_endrd(void);
int crc_stwr(void);
int vcpio_wr(register ARCHD *);
int bcpio_id(char *, int);
int bcpio_rd(register ARCHD *, register char *);
off_t bcpio_endrd(void);
int bcpio_wr(register ARCHD *);

/*
 * file_subs.c
 */
int file_creat(register ARCHD *);
void file_close(register ARCHD *, int);
int lnk_creat(register ARCHD *);
int cross_lnk(register ARCHD *);
int chk_same(register ARCHD *);
int node_creat(register ARCHD *);
int unlnk_exist(register char *, register int);
int chk_path(register char *, uid_t, gid_t);
void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
int set_ids(char *, uid_t, gid_t);
int set_lids(char *, uid_t, gid_t);
void set_pmode(char *, mode_t);
int file_write(int, char *, register int, int *, int *, int, char *);
void file_flush(int, char *, int);
void rdfile_close(register ARCHD *, register int *);
int set_crc(register ARCHD *, register int);

/*
 * ftree.c
 */
int ftree_start(void);
int ftree_add(register char *, int);
void ftree_sel(register ARCHD *);
void ftree_chk(void);
int next_file(register ARCHD *);

/*
 * gen_subs.c
 */
void ls_list(register ARCHD *, time_t, FILE *);
void ls_tty(register ARCHD *);
void safe_print(char *, FILE *);
u_long asc_ul(register char *, int, register int);
int ul_asc(u_long, register char *, register int, register int);
#ifndef LONG_OFF_T
u_quad_t asc_uqd(register char *, int, register int);
int uqd_asc(u_quad_t, register char *, register int, register int);
#endif

/*
 * getoldopt.c
 */
int getoldopt(int, char **, char *);

/*
 * options.c
 */
extern FSUB fsub[];
extern int ford[];
void options(register int, register char **);
OPLIST * opt_next(void);
int opt_add(register char *);
int bad_opt(void);
char *chdname;

/*
 * pat_rep.c
 */
int rep_add(register char *);
int pat_add(char *, char *);
void pat_chk(void);
int pat_sel(register ARCHD *);
int pat_match(register ARCHD *);
int mod_name(register ARCHD *);
int set_dest(register ARCHD *, char *, int);

/*
 * pax.c
 */
extern int act;
extern FSUB *frmt;
extern int cflag;
extern int cwdfd;
extern int dflag;
extern int iflag;
extern int kflag;
extern int lflag;
extern int nflag;
extern int tflag;
extern int uflag;
extern int vflag;
extern int Dflag;
extern int Hflag;
extern int Lflag;
extern int Xflag;
extern int Yflag;
extern int Zflag;
extern int vfpart;
extern int patime;
extern int pmtime;
extern int nodirs;
extern int pmode;
extern int pids;
extern int rmleadslash;
extern int exit_val;
extern int docrc;
extern char *dirptr;
extern char *ltmfrmt;
extern char *argv0;
extern FILE *listf;
extern char *tempfile;
extern char *tempbase;

int main(int, char **);
void sig_cleanup(int);

/*
 * sel_subs.c
 */
int sel_chk(register ARCHD *);
int grp_add(register char *);
int usr_add(register char *);
int trng_add(register char *);

/*
 * tables.c
 */
int lnk_start(void);
int chk_lnk(register ARCHD *);
void purg_lnk(register ARCHD *);
void lnk_end(void);
int ftime_start(void);
int chk_ftime(register ARCHD *);
int name_start(void);
int add_name(register char *, int, char *);
void sub_name(register char *, int *, size_t);
int dev_start(void);
int add_dev(register ARCHD *);
int map_dev(register ARCHD *, u_long, u_long);
int atdir_start(void);
void atdir_end(void);
void add_atdir(char *, dev_t, ino_t, time_t, time_t);
int get_atdir(dev_t, ino_t, time_t *, time_t *);
int dir_start(void);
void add_dir(char *, int, struct stat *, int);
void proc_dir(void);
u_int st_hash(char *, int, int);

/*
 * tar.c
 */
int tar_endwr(void);
off_t tar_endrd(void);
int tar_trail(register char *, register int, register int *);
int tar_id(register char *, int);
int tar_opt(void);
int tar_rd(register ARCHD *, register char *);
int tar_wr(register ARCHD *);
int ustar_strd(void);
int ustar_stwr(void);
int ustar_id(char *, int);
int ustar_rd(register ARCHD *, register char *);
int ustar_wr(register ARCHD *);

/*
 * tty_subs.c
 */
int tty_init(void);
void tty_prnt(char *, ...);
int tty_read(char *, int);
void paxwarn(int, char *, ...);
void syswarn(int, int, char *, ...);