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