extern.h revision 1.41
1102644Snectar/*	$NetBSD: extern.h,v 1.41 2004/02/13 23:10:14 matt Exp $	*/
255682Smarkm
355682Smarkm/*-
455682Smarkm * Copyright (c) 1992 Keith Muller.
5127808Snectar * Copyright (c) 1992, 1993
6127808Snectar *	The Regents of the University of California.  All rights reserved.
7127808Snectar *
8102644Snectar * This code is derived from software contributed to Berkeley by
9127808Snectar * Keith Muller of the University of California, San Diego.
10102644Snectar *
11127808Snectar * Redistribution and use in source and binary forms, with or without
12127808Snectar * modification, are permitted provided that the following conditions
13127808Snectar * are met:
14127808Snectar * 1. Redistributions of source code must retain the above copyright
15127808Snectar *    notice, this list of conditions and the following disclaimer.
16127808Snectar * 2. Redistributions in binary form must reproduce the above copyright
17127808Snectar *    notice, this list of conditions and the following disclaimer in the
18127808Snectar *    documentation and/or other materials provided with the distribution.
19127808Snectar * 3. Neither the name of the University nor the names of its contributors
20127808Snectar *    may be used to endorse or promote products derived from this software
21127808Snectar *    without specific prior written permission.
22127808Snectar *
23127808Snectar * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24127808Snectar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25127808Snectar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26127808Snectar * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27127808Snectar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28127808Snectar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29127808Snectar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30127808Snectar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31127808Snectar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32127808Snectar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33127808Snectar * SUCH DAMAGE.
34127808Snectar *
35127808Snectar *	@(#)extern.h	8.2 (Berkeley) 4/18/94
3655682Smarkm */
3755682Smarkm
3855682Smarkm/*
3955682Smarkm * External references from each source file
4055682Smarkm */
41102644Snectar
42102644Snectar#include <sys/cdefs.h>
4355682Smarkm#include <err.h>
4455682Smarkm
4555682Smarkm/*
4655682Smarkm * ar_io.c
4755682Smarkm */
4855682Smarkmextern const char *arcname;
4955682Smarkmextern int curdirfd;
5055682Smarkmextern const char *gzip_program;
5155682Smarkmextern time_t starttime;
5255682Smarkmextern int force_one_volume;
5355682Smarkmextern char *chdname;
5455682Smarkmextern int forcelocal;
5555682Smarkmextern int secure;
5655682Smarkm
5755682Smarkmint ar_open(const char *);
5855682Smarkmvoid ar_close(void);
5955682Smarkmvoid ar_drain(void);
6055682Smarkmint ar_set_wr(void);
6155682Smarkmint ar_app_ok(void);
62102644Snectar#ifdef SYS_NO_RESTART
6355682Smarkmint read_with_restart(int, void *, int);
6455682Smarkmint write_with_restart(int, void *, int);
6555682Smarkm#else
6655682Smarkm#define read_with_restart	read
6755682Smarkm#define write_with_restart	write
6855682Smarkm#endif
6955682Smarkmint xread(int, void *, int);
7055682Smarkmint xwrite(int, void *, int);
7155682Smarkmint ar_read(char *, int);
7255682Smarkmint ar_write(char *, int);
7355682Smarkmint ar_rdsync(void);
7455682Smarkmint ar_fow(off_t, off_t *);
7555682Smarkmint ar_rev(off_t );
7655682Smarkmint ar_next(void);
77127808Snectarvoid ar_summary(int);
7855682Smarkmint ar_dochdir(char *);
7955682Smarkm
8055682Smarkm/*
8155682Smarkm * ar_subs.c
8255682Smarkm */
8355682Smarkmextern u_long flcnt;
8455682Smarkmextern ARCHD archd;
8555682Smarkmvoid list(void);
8655682Smarkmvoid extract(void);
8755682Smarkmvoid append(void);
8855682Smarkmvoid archive(void);
8955682Smarkmvoid copy(void);
9055682Smarkm
9155682Smarkm/*
9255682Smarkm * buf_subs.c
9355682Smarkm */
9455682Smarkmextern int blksz;
9555682Smarkmextern int wrblksz;
9655682Smarkmextern int maxflt;
9755682Smarkmextern int rdblksz;
9855682Smarkmextern off_t wrlimit;
9955682Smarkmextern off_t rdcnt;
100127808Snectarextern off_t wrcnt;
10155682Smarkmint wr_start(void);
10255682Smarkmint rd_start(void);
10355682Smarkmvoid cp_start(void);
10455682Smarkmint appnd_start(off_t);
10555682Smarkmint rd_sync(void);
10655682Smarkmvoid pback(char *, int);
10755682Smarkmint rd_skip(off_t);
10855682Smarkmvoid wr_fin(void);
10955682Smarkmint wr_rdbuf(char *, int);
11055682Smarkmint rd_wrbuf(char *, int);
11155682Smarkmint wr_skip(off_t);
11255682Smarkmint wr_rdfile(ARCHD *, int, off_t *);
11355682Smarkmint rd_wrfile(ARCHD *, int, off_t *);
11455682Smarkmvoid cp_file(ARCHD *, int, int);
11555682Smarkmint buf_fill(void);
11655682Smarkmint buf_flush(int);
11755682Smarkm
11855682Smarkm/*
11955682Smarkm * cpio.c
12055682Smarkm */
12155682Smarkmextern int cpio_swp_head;
12255682Smarkmint cpio_strd(void);
12355682Smarkmint cpio_subtrail(ARCHD *);
12455682Smarkmint cpio_endwr(void);
12555682Smarkmint cpio_id(char *, int);
12655682Smarkmint cpio_rd(ARCHD *, char *);
127127808Snectaroff_t cpio_endrd(void);
12855682Smarkmint cpio_stwr(void);
12955682Smarkmint cpio_wr(ARCHD *);
130102644Snectarint vcpio_id(char *, int);
13155682Smarkmint crc_id(char *, int);
13255682Smarkmint crc_strd(void);
13355682Smarkmint vcpio_rd(ARCHD *, char *);
13455682Smarkmoff_t vcpio_endrd(void);
13555682Smarkmint crc_stwr(void);
136127808Snectarint vcpio_wr(ARCHD *);
137127808Snectarint bcpio_id(char *, int);
13855682Smarkmint bcpio_rd(ARCHD *, char *);
139102644Snectaroff_t bcpio_endrd(void);
14055682Smarkmint bcpio_wr(ARCHD *);
141102644Snectar
14255682Smarkm/*
14355682Smarkm * file_subs.c
14455682Smarkm */
14555682Smarkmextern char *gnu_name_string, *gnu_link_string;
146127808Snectarextern char *xtmp_name;
14755682Smarkmint file_creat(ARCHD *);
14855682Smarkmvoid file_close(ARCHD *, int);
149127808Snectarint lnk_creat(ARCHD *);
15055682Smarkmint cross_lnk(ARCHD *);
151102644Snectarint chk_same(ARCHD *);
15255682Smarkmint node_creat(ARCHD *);
153127808Snectarint unlnk_exist(char *, int);
15455682Smarkmint chk_path(char *, uid_t, gid_t);
15555682Smarkmvoid set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
156127808Snectarint set_ids(char *, uid_t, gid_t);
15755682Smarkmvoid set_pmode(char *, mode_t);
15855682Smarkmvoid set_chflags(char *fnm, u_int32_t flags);
159127808Snectarint file_write(int, char *, int, int *, int *, int, char *);
16055682Smarkmvoid file_flush(int, char *, int);
16155682Smarkmvoid rdfile_close(ARCHD *, int *);
162102644Snectarint set_crc(ARCHD *, int);
16355682Smarkm
16455682Smarkm/*
16555682Smarkm * ftree.c
16655682Smarkm */
16755682Smarkmint ftree_start(void);
168127808Snectarint ftree_add(char *, int);
16955682Smarkmvoid ftree_sel(ARCHD *);
170127808Snectarvoid ftree_chk(void);
17155682Smarkmint next_file(ARCHD *);
172102644Snectar
17355682Smarkm/*
17455682Smarkm * gen_subs.c
17555682Smarkm */
17655682Smarkmvoid ls_list(ARCHD *, time_t, FILE *);
177127808Snectarvoid ls_tty(ARCHD *);
17855682Smarkmvoid safe_print(const char *, FILE *);
17955682Smarkmu_long asc_ul(char *, int, int);
18055682Smarkmint ul_asc(u_long, char *, int, int);
18155682Smarkm#if !defined(NET2_STAT) && !defined(_LP64)
18255682Smarkmunsigned long long asc_ull(char *, int, int);
18355682Smarkmint ull_asc(unsigned long long, char *, int, int);
184102644Snectar#endif
185102644Snectarint check_Aflag(void);
186127808Snectar
18755682Smarkm/*
188127808Snectar * getoldopt.c
18955682Smarkm */
19055682Smarkmstruct option;
191127808Snectarint getoldopt(int, char **, const char *, struct option *, int *);
192127808Snectar
19355682Smarkm/*
19455682Smarkm * options.c
19555682Smarkm */
19655682Smarkmextern FSUB fsub[];
197127808Snectarextern int ford[];
19855682Smarkmvoid options(int, char **);
19955682SmarkmOPLIST * opt_next(void);
200127808Snectarint opt_add(const char *);
20155682Smarkmint bad_opt(void);
202127808Snectarint mkpath(char *);
20355682Smarkmchar *chdname;
204102644Snectar
20555682Smarkm/*
20655682Smarkm * pat_rep.c
207127808Snectar */
20855682Smarkmint rep_add(char *);
20955682Smarkmint pat_add(char *, char *);
21055682Smarkmvoid pat_chk(void);
21155682Smarkmint pat_sel(ARCHD *);
21255682Smarkmint pat_match(ARCHD *);
213127808Snectarint mod_name(ARCHD *);
21455682Smarkmint set_dest(ARCHD *, char *, int);
215127808Snectar
216127808Snectar/*
217127808Snectar * pax.c
218127808Snectar */
21955682Smarkmextern int act;
22055682Smarkmextern FSUB *frmt;
22155682Smarkmextern int Aflag;
22255682Smarkmextern int cflag;
223127808Snectarextern int cwdfd;
22455682Smarkmextern int dflag;
225127808Snectarextern int iflag;
22655682Smarkmextern int jflag;
227127808Snectarextern int kflag;
22855682Smarkmextern int lflag;
22955682Smarkmextern int nflag;
23055682Smarkmextern int tflag;
23155682Smarkmextern int uflag;
23255682Smarkmextern int vflag;
233127808Snectarextern int zflag;
23455682Smarkmextern int Dflag;
235127808Snectarextern int Hflag;
23655682Smarkmextern int Lflag;
237102644Snectarextern int Mflag;
23855682Smarkmextern int Xflag;
23955682Smarkmextern int Yflag;
240127808Snectarextern int Zflag;
24155682Smarkmextern int vfpart;
242127808Snectarextern int patime;
243127808Snectarextern int pmtime;
24455682Smarkmextern int nodirs;
245127808Snectarextern int pfflags;
246127808Snectarextern int pmode;
247127808Snectarextern int pids;
248127808Snectarextern int rmleadslash;
249127808Snectarextern int exit_val;
25055682Smarkmextern int docrc;
25155682Smarkmextern int to_stdout;
252127808Snectarextern char *dirptr;
25355682Smarkmextern char *ltmfrmt;
25455682Smarkmextern char *argv0;
25555682Smarkmextern FILE *listf;
25655682Smarkmextern char *tempfile;
25755682Smarkmextern char *tempbase;
25855682Smarkm
25955682Smarkmint main(int, char **);
260127808Snectarvoid sig_cleanup(int);
261127808Snectar
262127808Snectar/*
263127808Snectar * sel_subs.c
26455682Smarkm */
265127808Snectarint sel_chk(ARCHD *);
266127808Snectarint grp_add(char *);
267127808Snectarint usr_add(char *);
268127808Snectarint trng_add(char *);
269127808Snectar
270127808Snectar/*
271127808Snectar * tables.c
272127808Snectar */
273127808Snectarint lnk_start(void);
274127808Snectarint chk_lnk(ARCHD *);
275127808Snectarvoid purg_lnk(ARCHD *);
276127808Snectarvoid lnk_end(void);
277127808Snectarint ftime_start(void);
278127808Snectarint chk_ftime(ARCHD *);
279127808Snectarint name_start(void);
280127808Snectarint add_name(char *, int, char *);
281127808Snectarvoid sub_name(char *, int *, size_t);
282127808Snectarint dev_start(void);
283127808Snectarint add_dev(ARCHD *);
28455682Smarkmint map_dev(ARCHD *, u_long, u_long);
28555682Smarkmint atdir_start(void);
286127808Snectarvoid atdir_end(void);
28755682Smarkmvoid add_atdir(char *, dev_t, ino_t, time_t, time_t);
28855682Smarkmint get_atdir(dev_t, ino_t, time_t *, time_t *);
28955682Smarkmint dir_start(void);
290127808Snectarvoid add_dir(char *, int, struct stat *, int);
29155682Smarkmvoid proc_dir(void);
292127808Snectaru_int st_hash(char *, int, int);
293127808Snectar
294127808Snectar/*
295 * tar.c
296 */
297extern int is_gnutar;
298int tar_endwr(void);
299off_t tar_endrd(void);
300int tar_trail(char *, int, int *);
301int tar_id(char *, int);
302int tar_opt(void);
303int tar_rd(ARCHD *, char *);
304int tar_wr(ARCHD *);
305int ustar_strd(void);
306int ustar_stwr(void);
307int ustar_id(char *, int);
308int ustar_rd(ARCHD *, char *);
309int ustar_wr(ARCHD *);
310int tar_gnutar_X_compat(const char *);
311int tar_gnutar_minus_minus_exclude(const char *);
312
313/*
314 * tty_subs.c
315 */
316int tty_init(void);
317void tty_prnt(const char *, ...)
318    __attribute__((format (printf, 1, 2)));
319int tty_read(char *, int);
320void tty_warn(int, const char *, ...)
321    __attribute__((format (printf, 2, 3)));
322void syswarn(int, int, const char *, ...)
323    __attribute__((format (printf, 3, 4)));
324