extern.h revision 114583
1/*-
2 * Copyright (c) 1992 Keith Muller.
3 * Copyright (c) 1992, 1993
4 *	The Regents of the University of California.  All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Keith Muller of the University of California, San Diego.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 *    must display the following acknowledgement:
19 *	This product includes software developed by the University of
20 *	California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 *    may be used to endorse or promote products derived from this software
23 *    without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 *	@(#)extern.h	8.2 (Berkeley) 4/18/94
38 * $FreeBSD: head/bin/pax/extern.h 114583 2003-05-03 16:39:34Z markm $
39 */
40
41/*
42 * External references from each source file
43 */
44
45#include <sys/cdefs.h>
46
47/*
48 * ar_io.c
49 */
50extern const char *arcname;
51extern const char *gzip_program;
52int ar_open(const char *);
53void ar_close(void);
54void ar_drain(void);
55int ar_set_wr(void);
56int ar_app_ok(void);
57int ar_read(char *, int);
58int ar_write(char *, int);
59int ar_rdsync(void);
60int ar_fow(off_t, off_t *);
61int ar_rev(off_t );
62int ar_next(void);
63
64/*
65 * ar_subs.c
66 */
67extern u_long flcnt;
68void list(void);
69void extract(void);
70void append(void);
71void archive(void);
72void copy(void);
73
74/*
75 * buf_subs.c
76 */
77extern int blksz;
78extern int wrblksz;
79extern int maxflt;
80extern int rdblksz;
81extern off_t wrlimit;
82extern off_t rdcnt;
83extern off_t wrcnt;
84int wr_start(void);
85int rd_start(void);
86void cp_start(void);
87int appnd_start(off_t);
88int rd_sync(void);
89void pback(char *, int);
90int rd_skip(off_t);
91void wr_fin(void);
92int wr_rdbuf(char *, int);
93int rd_wrbuf(char *, int);
94int wr_skip(off_t);
95int wr_rdfile(ARCHD *, int, off_t *);
96int rd_wrfile(ARCHD *, int, off_t *);
97void cp_file(ARCHD *, int, int);
98int buf_fill(void);
99int buf_flush(int);
100
101/*
102 * cache.c
103 */
104int uidtb_start(void);
105int gidtb_start(void);
106int usrtb_start(void);
107int grptb_start(void);
108const char * name_uid(uid_t, int);
109const char * name_gid(gid_t, int);
110int uid_name(char *, uid_t *);
111int gid_name(char *, gid_t *);
112
113/*
114 * cpio.c
115 */
116int cpio_strd(void);
117int cpio_trail(ARCHD *);
118int cpio_endwr(void);
119int cpio_id(char *, int);
120int cpio_rd(ARCHD *, char *);
121off_t cpio_endrd(void);
122int cpio_stwr(void);
123int cpio_wr(ARCHD *);
124int vcpio_id(char *, int);
125int crc_id(char *, int);
126int crc_strd(void);
127int vcpio_rd(ARCHD *, char *);
128off_t vcpio_endrd(void);
129int crc_stwr(void);
130int vcpio_wr(ARCHD *);
131int bcpio_id(char *, int);
132int bcpio_rd(ARCHD *, char *);
133off_t bcpio_endrd(void);
134int bcpio_wr(ARCHD *);
135
136/*
137 * file_subs.c
138 */
139int file_creat(ARCHD *);
140void file_close(ARCHD *, int);
141int lnk_creat(ARCHD *);
142int cross_lnk(ARCHD *);
143int chk_same(ARCHD *);
144int node_creat(ARCHD *);
145int unlnk_exist(char *, int);
146int chk_path(char *, uid_t, gid_t);
147void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
148int set_ids(char *, uid_t, gid_t);
149int set_lids(char *, uid_t, gid_t);
150void set_pmode(char *, mode_t);
151int file_write(int, char *, int, int *, int *, int, char *);
152void file_flush(int, char *, int);
153void rdfile_close(ARCHD *, int *);
154int set_crc(ARCHD *, int);
155
156/*
157 * ftree.c
158 */
159int ftree_start(void);
160int ftree_add(char *, int);
161void ftree_sel(ARCHD *);
162void ftree_chk(void);
163int next_file(ARCHD *);
164
165/*
166 * gen_subs.c
167 */
168void ls_list(ARCHD *, time_t, FILE *);
169void ls_tty(ARCHD *);
170int l_strncpy(char *, const char *, int);
171u_long asc_ul(char *, int, int);
172int ul_asc(u_long, char *, int, int);
173#ifndef NET2_STAT
174u_quad_t asc_uqd(char *, int, int);
175int uqd_asc(u_quad_t, char *, int, int);
176#endif
177
178/*
179 * getoldopt.c
180 */
181int getoldopt(int, char **, const char *);
182
183/*
184 * options.c
185 */
186extern FSUB fsub[];
187extern int ford[];
188void options(int, char **);
189OPLIST * opt_next(void);
190int opt_add(const char *);
191int bad_opt(void);
192char *chdname;
193
194/*
195 * pat_rep.c
196 */
197int rep_add(char *);
198int pat_add(char *, char *);
199void pat_chk(void);
200int pat_sel(ARCHD *);
201int pat_match(ARCHD *);
202int mod_name(ARCHD *);
203int set_dest(ARCHD *, char *, int);
204
205/*
206 * pax.c
207 */
208extern int act;
209extern FSUB *frmt;
210extern int cflag;
211extern int cwdfd;
212extern int dflag;
213extern int iflag;
214extern int kflag;
215extern int lflag;
216extern int nflag;
217extern int tflag;
218extern int uflag;
219extern int vflag;
220extern int Dflag;
221extern int Hflag;
222extern int Lflag;
223extern int Xflag;
224extern int Yflag;
225extern int Zflag;
226extern int vfpart;
227extern int patime;
228extern int pmtime;
229extern int nodirs;
230extern int pmode;
231extern int pids;
232extern int rmleadslash;
233extern int exit_val;
234extern int docrc;
235extern char *dirptr;
236extern const char *argv0;
237extern FILE *listf;
238extern char *tempfile;
239extern char *tempbase;
240
241void sig_cleanup(int);
242
243/*
244 * sel_subs.c
245 */
246int sel_chk(ARCHD *);
247int grp_add(char *);
248int usr_add(char *);
249int trng_add(char *);
250
251/*
252 * tables.c
253 */
254int lnk_start(void);
255int chk_lnk(ARCHD *);
256void purg_lnk(ARCHD *);
257void lnk_end(void);
258int ftime_start(void);
259int chk_ftime(ARCHD *);
260int name_start(void);
261int add_name(char *, int, char *);
262void sub_name(char *, int *, size_t);
263int dev_start(void);
264int add_dev(ARCHD *);
265int map_dev(ARCHD *, u_long, u_long);
266int atdir_start(void);
267void atdir_end(void);
268void add_atdir(char *, dev_t, ino_t, time_t, time_t);
269int get_atdir(dev_t, ino_t, time_t *, time_t *);
270int dir_start(void);
271void add_dir(char *, int, struct stat *, int);
272void proc_dir(void);
273u_int st_hash(char *, int, int);
274
275/*
276 * tar.c
277 */
278int tar_endwr(void);
279off_t tar_endrd(void);
280int tar_trail(char *, int, int *);
281int tar_id(char *, int);
282int tar_opt(void);
283int tar_rd(ARCHD *, char *);
284int tar_wr(ARCHD *);
285int ustar_strd(void);
286int ustar_stwr(void);
287int ustar_id(char *, int);
288int ustar_rd(ARCHD *, char *);
289int ustar_wr(ARCHD *);
290
291/*
292 * tty_subs.c
293 */
294int tty_init(void);
295void tty_prnt(const char *, ...) __printflike(1, 2);
296int tty_read(char *, int);
297void paxwarn(int, const char *, ...) __printflike(2, 3);
298void syswarn(int, int, const char *, ...) __printflike(3, 4);
299