2020-04-03 19:13:32 +03:00
|
|
|
/* $NetBSD: extern.h,v 1.60 2020/04/03 16:13:32 joerg Exp $ */
|
1995-03-21 12:01:59 +03:00
|
|
|
|
1994-06-13 20:13:35 +04:00
|
|
|
/*-
|
2003-10-13 11:41:22 +04:00
|
|
|
* Copyright (c) 1992 Keith Muller.
|
1994-06-13 20:13:35 +04:00
|
|
|
* 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.
|
2003-08-07 13:05:01 +04:00
|
|
|
* 3. 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
|
1994-06-13 20:13:35 +04:00
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1995-03-21 12:01:59 +03:00
|
|
|
* @(#)extern.h 8.2 (Berkeley) 4/18/94
|
1994-06-13 20:13:35 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* External references from each source file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2002-02-01 01:43:33 +03:00
|
|
|
#include <err.h>
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ar_io.c
|
|
|
|
*/
|
1998-07-27 20:43:25 +04:00
|
|
|
extern const char *arcname;
|
1999-10-23 00:59:08 +04:00
|
|
|
extern int curdirfd;
|
1998-07-27 20:43:25 +04:00
|
|
|
extern const char *gzip_program;
|
1999-03-03 21:06:52 +03:00
|
|
|
extern time_t starttime;
|
2000-03-30 21:53:04 +04:00
|
|
|
extern int force_one_volume;
|
2002-10-12 19:39:29 +04:00
|
|
|
extern char *chdname;
|
|
|
|
extern int forcelocal;
|
2002-10-15 20:16:29 +04:00
|
|
|
extern int secure;
|
2002-10-12 19:39:29 +04:00
|
|
|
|
2001-10-25 09:33:32 +04:00
|
|
|
int ar_open(const char *);
|
|
|
|
void ar_close(void);
|
|
|
|
void ar_drain(void);
|
|
|
|
int ar_set_wr(void);
|
|
|
|
int ar_app_ok(void);
|
2000-02-17 06:06:12 +03:00
|
|
|
#ifdef SYS_NO_RESTART
|
2001-10-25 09:33:32 +04:00
|
|
|
int read_with_restart(int, void *, int);
|
|
|
|
int write_with_restart(int, void *, int);
|
2000-02-17 06:06:12 +03:00
|
|
|
#else
|
|
|
|
#define read_with_restart read
|
|
|
|
#define write_with_restart write
|
|
|
|
#endif
|
2001-10-25 09:33:32 +04:00
|
|
|
int xread(int, void *, int);
|
|
|
|
int xwrite(int, void *, int);
|
|
|
|
int ar_read(char *, int);
|
|
|
|
int ar_write(char *, int);
|
|
|
|
int ar_rdsync(void);
|
|
|
|
int ar_fow(off_t, off_t *);
|
|
|
|
int ar_rev(off_t );
|
|
|
|
int ar_next(void);
|
|
|
|
void ar_summary(int);
|
2005-04-24 05:45:03 +04:00
|
|
|
int ar_dochdir(const char *);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ar_subs.c
|
|
|
|
*/
|
|
|
|
extern u_long flcnt;
|
1999-03-03 21:06:52 +03:00
|
|
|
extern ARCHD archd;
|
2005-04-24 05:45:03 +04:00
|
|
|
int updatepath(void);
|
|
|
|
int dochdir(const char *);
|
|
|
|
int fdochdir(int);
|
2005-09-16 20:48:18 +04:00
|
|
|
int domkdir(const char *, mode_t);
|
2006-02-11 14:04:57 +03:00
|
|
|
int list(void);
|
|
|
|
int extract(void);
|
|
|
|
int append(void);
|
|
|
|
int archive(void);
|
|
|
|
int copy(void);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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;
|
2001-10-25 09:33:32 +04:00
|
|
|
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(char *, int);
|
|
|
|
int rd_wrbuf(char *, 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(int);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* cpio.c
|
|
|
|
*/
|
1998-02-28 18:53:00 +03:00
|
|
|
extern int cpio_swp_head;
|
2001-10-25 09:33:32 +04:00
|
|
|
int cpio_strd(void);
|
|
|
|
int cpio_subtrail(ARCHD *);
|
|
|
|
int cpio_endwr(void);
|
|
|
|
int cpio_id(char *, int);
|
|
|
|
int cpio_rd(ARCHD *, char *);
|
|
|
|
off_t cpio_endrd(void);
|
|
|
|
int cpio_stwr(void);
|
|
|
|
int cpio_wr(ARCHD *);
|
|
|
|
int vcpio_id(char *, int);
|
|
|
|
int crc_id(char *, int);
|
|
|
|
int crc_strd(void);
|
|
|
|
int vcpio_rd(ARCHD *, char *);
|
|
|
|
off_t vcpio_endrd(void);
|
|
|
|
int crc_stwr(void);
|
|
|
|
int vcpio_wr(ARCHD *);
|
|
|
|
int bcpio_id(char *, int);
|
|
|
|
int bcpio_rd(ARCHD *, char *);
|
|
|
|
off_t bcpio_endrd(void);
|
|
|
|
int bcpio_wr(ARCHD *);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* file_subs.c
|
|
|
|
*/
|
2002-10-17 04:32:36 +04:00
|
|
|
extern char *gnu_name_string, *gnu_link_string;
|
2004-09-22 19:03:18 +04:00
|
|
|
extern size_t gnu_name_length, gnu_link_length;
|
2004-02-14 02:10:14 +03:00
|
|
|
extern char *xtmp_name;
|
2004-08-22 20:46:18 +04:00
|
|
|
int file_creat(ARCHD *, int);
|
2001-10-25 09:33:32 +04:00
|
|
|
void file_close(ARCHD *, int);
|
2004-08-22 20:46:18 +04:00
|
|
|
int lnk_creat(ARCHD *, int *);
|
2001-10-25 09:33:32 +04:00
|
|
|
int cross_lnk(ARCHD *);
|
|
|
|
int chk_same(ARCHD *);
|
|
|
|
int node_creat(ARCHD *);
|
|
|
|
int unlnk_exist(char *, int);
|
|
|
|
int chk_path(char *, uid_t, gid_t);
|
2008-01-10 07:24:51 +03:00
|
|
|
void set_ftime(char *fnm, time_t mtime, time_t atime, int frc, int slk);
|
2001-10-25 09:33:32 +04:00
|
|
|
int set_ids(char *, uid_t, gid_t);
|
|
|
|
void set_pmode(char *, mode_t);
|
|
|
|
void set_chflags(char *fnm, u_int32_t flags);
|
|
|
|
int file_write(int, char *, int, int *, int *, int, char *);
|
|
|
|
void file_flush(int, char *, int);
|
|
|
|
void rdfile_close(ARCHD *, int *);
|
|
|
|
int set_crc(ARCHD *, int);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ftree.c
|
|
|
|
*/
|
2001-10-25 09:33:32 +04:00
|
|
|
int ftree_start(void);
|
|
|
|
int ftree_add(char *, int);
|
|
|
|
void ftree_sel(ARCHD *);
|
|
|
|
void ftree_chk(void);
|
|
|
|
int next_file(ARCHD *);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* gen_subs.c
|
|
|
|
*/
|
2002-10-12 19:39:29 +04:00
|
|
|
void ls_list(ARCHD *, time_t, FILE *);
|
2001-10-25 09:33:32 +04:00
|
|
|
void ls_tty(ARCHD *);
|
2002-10-12 19:39:29 +04:00
|
|
|
void safe_print(const char *, FILE *);
|
2012-08-09 12:09:21 +04:00
|
|
|
uint32_t asc_u32(char *, int, int);
|
|
|
|
int u32_asc(uintmax_t, char *, int, int);
|
|
|
|
uintmax_t asc_umax(char *, int, int);
|
|
|
|
int umax_asc(uintmax_t, char *, int, int);
|
2001-10-25 09:33:32 +04:00
|
|
|
int check_Aflag(void);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
2000-02-17 06:12:22 +03:00
|
|
|
/*
|
1994-12-04 10:11:37 +03:00
|
|
|
* getoldopt.c
|
|
|
|
*/
|
2000-07-04 21:17:49 +04:00
|
|
|
struct option;
|
2001-10-25 09:33:32 +04:00
|
|
|
int getoldopt(int, char **, const char *, struct option *, int *);
|
1994-12-04 10:11:37 +03:00
|
|
|
|
1994-06-13 20:13:35 +04:00
|
|
|
/*
|
|
|
|
* options.c
|
|
|
|
*/
|
|
|
|
extern FSUB fsub[];
|
|
|
|
extern int ford[];
|
2004-06-19 06:27:00 +04:00
|
|
|
extern int sep;
|
2006-04-16 20:20:21 +04:00
|
|
|
extern int havechd;
|
2001-10-25 09:33:32 +04:00
|
|
|
void options(int, char **);
|
|
|
|
OPLIST * opt_next(void);
|
|
|
|
int bad_opt(void);
|
2002-10-12 19:39:29 +04:00
|
|
|
int mkpath(char *);
|
2004-10-23 01:00:18 +04:00
|
|
|
#if !HAVE_NBTOOL_CONFIG_H
|
2020-04-03 19:13:32 +03:00
|
|
|
extern int do_chroot;
|
2004-10-23 01:00:18 +04:00
|
|
|
#endif
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* pat_rep.c
|
|
|
|
*/
|
2001-10-25 09:33:32 +04:00
|
|
|
int rep_add(char *);
|
2009-04-07 23:52:35 +04:00
|
|
|
int pat_add(char *, char *, int);
|
2001-10-25 09:33:32 +04:00
|
|
|
void pat_chk(void);
|
|
|
|
int pat_sel(ARCHD *);
|
|
|
|
int pat_match(ARCHD *);
|
2007-05-05 01:19:36 +04:00
|
|
|
int mod_name(ARCHD *, int);
|
2001-10-25 09:33:32 +04:00
|
|
|
int set_dest(ARCHD *, char *, int);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* pax.c
|
|
|
|
*/
|
|
|
|
extern int act;
|
|
|
|
extern FSUB *frmt;
|
1999-08-24 11:57:06 +04:00
|
|
|
extern int Aflag;
|
1994-06-13 20:13:35 +04:00
|
|
|
extern int cflag;
|
2002-10-12 19:39:29 +04:00
|
|
|
extern int cwdfd;
|
1994-06-13 20:13:35 +04:00
|
|
|
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;
|
Implement -M flag: During a write or copy operation, treat the list of
files on standard input as an mtree(8) `specfile' specification, and
write or copy only those items in the specfile.
If the file exists in the underlying file system, its permissions and
modification time will be used unless specifically overridden by the
specfile. An error will be raised if the type of entry in the specfile
conflicts with that of an existing file.
Otherwise, it is necessary to specify at least the following parameters
in the specfile: type, mode, gname or gid, and uname or uid, device
(in the case of block or character devices), and link (in the case of
symbolic links). If time isn't provided, the current time will be used.
2001-10-25 12:51:50 +04:00
|
|
|
extern int Mflag;
|
2007-04-23 22:40:22 +04:00
|
|
|
extern int Vflag;
|
1994-06-13 20:13:35 +04:00
|
|
|
extern int Xflag;
|
|
|
|
extern int Yflag;
|
|
|
|
extern int Zflag;
|
|
|
|
extern int vfpart;
|
|
|
|
extern int patime;
|
|
|
|
extern int pmtime;
|
2002-10-12 19:39:29 +04:00
|
|
|
extern int nodirs;
|
1999-11-01 04:35:58 +03:00
|
|
|
extern int pfflags;
|
1994-06-13 20:13:35 +04:00
|
|
|
extern int pmode;
|
|
|
|
extern int pids;
|
2002-10-12 19:39:29 +04:00
|
|
|
extern int rmleadslash;
|
1994-06-13 20:13:35 +04:00
|
|
|
extern int exit_val;
|
|
|
|
extern int docrc;
|
2003-07-08 10:00:48 +04:00
|
|
|
extern int to_stdout;
|
1994-06-13 20:13:35 +04:00
|
|
|
extern char *dirptr;
|
2002-10-12 19:39:29 +04:00
|
|
|
extern char *ltmfrmt;
|
2004-05-11 21:12:26 +04:00
|
|
|
extern const char *argv0;
|
2002-10-12 19:39:29 +04:00
|
|
|
extern FILE *listf;
|
|
|
|
extern char *tempfile;
|
|
|
|
extern char *tempbase;
|
|
|
|
|
1994-06-13 20:13:35 +04:00
|
|
|
/*
|
|
|
|
* sel_subs.c
|
|
|
|
*/
|
2001-10-25 09:33:32 +04:00
|
|
|
int sel_chk(ARCHD *);
|
|
|
|
int grp_add(char *);
|
|
|
|
int usr_add(char *);
|
|
|
|
int trng_add(char *);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tables.c
|
|
|
|
*/
|
2001-10-25 09:33:32 +04:00
|
|
|
int lnk_start(void);
|
|
|
|
int chk_lnk(ARCHD *);
|
|
|
|
void purg_lnk(ARCHD *);
|
|
|
|
void lnk_end(void);
|
|
|
|
int ftime_start(void);
|
|
|
|
int chk_ftime(ARCHD *);
|
|
|
|
int name_start(void);
|
|
|
|
int add_name(char *, int, char *);
|
2002-10-12 19:39:29 +04:00
|
|
|
void sub_name(char *, int *, size_t);
|
2001-10-25 09:33:32 +04:00
|
|
|
int dev_start(void);
|
|
|
|
int add_dev(ARCHD *);
|
|
|
|
int map_dev(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);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tar.c
|
|
|
|
*/
|
2002-10-16 07:46:07 +04:00
|
|
|
extern int is_gnutar;
|
2001-10-25 09:33:32 +04:00
|
|
|
int tar_endwr(void);
|
|
|
|
off_t tar_endrd(void);
|
|
|
|
int tar_trail(char *, int, int *);
|
|
|
|
int tar_id(char *, int);
|
|
|
|
int tar_opt(void);
|
|
|
|
int tar_rd(ARCHD *, char *);
|
|
|
|
int tar_wr(ARCHD *);
|
|
|
|
int ustar_strd(void);
|
|
|
|
int ustar_stwr(void);
|
|
|
|
int ustar_id(char *, int);
|
|
|
|
int ustar_rd(ARCHD *, char *);
|
|
|
|
int ustar_wr(ARCHD *);
|
|
|
|
int tar_gnutar_X_compat(const char *);
|
2002-12-08 04:35:12 +03:00
|
|
|
int tar_gnutar_minus_minus_exclude(const char *);
|
1994-06-13 20:13:35 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tty_subs.c
|
|
|
|
*/
|
2001-10-25 09:33:32 +04:00
|
|
|
int tty_init(void);
|
|
|
|
void tty_prnt(const char *, ...)
|
1997-07-21 00:32:15 +04:00
|
|
|
__attribute__((format (printf, 1, 2)));
|
2001-10-25 09:33:32 +04:00
|
|
|
int tty_read(char *, int);
|
|
|
|
void tty_warn(int, const char *, ...)
|
1997-07-21 00:32:15 +04:00
|
|
|
__attribute__((format (printf, 2, 3)));
|
2001-10-25 09:33:32 +04:00
|
|
|
void syswarn(int, int, const char *, ...)
|
1997-07-21 00:32:15 +04:00
|
|
|
__attribute__((format (printf, 3, 4)));
|