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