1994-05-26 06:18:55 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1992 Keith Muller.
|
|
|
|
* 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.
|
2017-02-28 23:42:47 +00:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1994-05-26 06:18:55 +00:00
|
|
|
* 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
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)extern.h 8.2 (Berkeley) 4/18/94
|
1999-08-27 23:15:48 +00:00
|
|
|
* $FreeBSD$
|
1994-05-26 06:18:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* External references from each source file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ar_io.c
|
|
|
|
*/
|
2003-05-03 16:39:34 +00:00
|
|
|
extern const char *arcname;
|
2001-05-05 01:10:13 +00:00
|
|
|
extern const char *gzip_program;
|
2003-05-03 16:39:34 +00:00
|
|
|
int ar_open(const char *);
|
2002-02-02 06:48:10 +00:00
|
|
|
void ar_close(void);
|
|
|
|
void ar_drain(void);
|
|
|
|
int ar_set_wr(void);
|
|
|
|
int ar_app_ok(void);
|
|
|
|
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);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ar_subs.c
|
|
|
|
*/
|
|
|
|
extern u_long flcnt;
|
2002-02-02 06:48:10 +00:00
|
|
|
void list(void);
|
|
|
|
void extract(void);
|
|
|
|
void append(void);
|
|
|
|
void archive(void);
|
|
|
|
void copy(void);
|
1994-05-26 06:18:55 +00: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;
|
2002-02-02 06:48:10 +00: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-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* cache.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int uidtb_start(void);
|
|
|
|
int gidtb_start(void);
|
|
|
|
int usrtb_start(void);
|
|
|
|
int grptb_start(void);
|
2003-05-03 16:39:34 +00:00
|
|
|
const char * name_uid(uid_t, int);
|
|
|
|
const char * name_gid(gid_t, int);
|
2002-02-02 06:48:10 +00:00
|
|
|
int uid_name(char *, uid_t *);
|
|
|
|
int gid_name(char *, gid_t *);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* cpio.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int cpio_strd(void);
|
|
|
|
int cpio_trail(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-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* file_subs.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int file_creat(ARCHD *);
|
|
|
|
void file_close(ARCHD *, int);
|
|
|
|
int lnk_creat(ARCHD *);
|
|
|
|
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);
|
|
|
|
void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
|
|
|
|
int set_ids(char *, uid_t, gid_t);
|
|
|
|
int set_lids(char *, uid_t, gid_t);
|
|
|
|
void set_pmode(char *, mode_t);
|
|
|
|
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-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ftree.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int ftree_start(void);
|
|
|
|
int ftree_add(char *, int);
|
|
|
|
void ftree_sel(ARCHD *);
|
2005-01-12 03:25:55 +00:00
|
|
|
void ftree_notsel(void);
|
2002-02-02 06:48:10 +00:00
|
|
|
void ftree_chk(void);
|
|
|
|
int next_file(ARCHD *);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* gen_subs.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
void ls_list(ARCHD *, time_t, FILE *);
|
|
|
|
void ls_tty(ARCHD *);
|
2003-05-03 16:39:34 +00:00
|
|
|
int l_strncpy(char *, const char *, int);
|
2002-02-02 06:48:10 +00:00
|
|
|
u_long asc_ul(char *, int, int);
|
|
|
|
int ul_asc(u_long, char *, int, int);
|
1994-05-26 06:18:55 +00:00
|
|
|
#ifndef NET2_STAT
|
2002-02-02 06:48:10 +00:00
|
|
|
u_quad_t asc_uqd(char *, int, int);
|
|
|
|
int uqd_asc(u_quad_t, char *, int, int);
|
1994-05-26 06:18:55 +00:00
|
|
|
#endif
|
|
|
|
|
2001-05-08 06:19:06 +00:00
|
|
|
/*
|
|
|
|
* getoldopt.c
|
|
|
|
*/
|
2003-05-03 16:39:34 +00:00
|
|
|
int getoldopt(int, char **, const char *);
|
2001-05-08 06:19:06 +00:00
|
|
|
|
1994-05-26 06:18:55 +00:00
|
|
|
/*
|
|
|
|
* options.c
|
|
|
|
*/
|
|
|
|
extern FSUB fsub[];
|
|
|
|
extern int ford[];
|
2002-02-02 06:48:10 +00:00
|
|
|
void options(int, char **);
|
|
|
|
OPLIST * opt_next(void);
|
2003-05-03 16:39:34 +00:00
|
|
|
int opt_add(const char *);
|
2002-02-02 06:48:10 +00:00
|
|
|
int bad_opt(void);
|
2012-10-19 05:43:38 +00:00
|
|
|
extern char *chdname;
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* pat_rep.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int rep_add(char *);
|
|
|
|
int pat_add(char *, char *);
|
|
|
|
void pat_chk(void);
|
|
|
|
int pat_sel(ARCHD *);
|
|
|
|
int pat_match(ARCHD *);
|
|
|
|
int mod_name(ARCHD *);
|
|
|
|
int set_dest(ARCHD *, char *, int);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* pax.c
|
|
|
|
*/
|
|
|
|
extern int act;
|
|
|
|
extern FSUB *frmt;
|
|
|
|
extern int cflag;
|
2001-05-08 06:19:06 +00:00
|
|
|
extern int cwdfd;
|
1994-05-26 06:18:55 +00: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;
|
2015-03-18 05:48:05 +00:00
|
|
|
extern int Oflag;
|
1994-05-26 06:18:55 +00:00
|
|
|
extern int Xflag;
|
|
|
|
extern int Yflag;
|
|
|
|
extern int Zflag;
|
|
|
|
extern int vfpart;
|
|
|
|
extern int patime;
|
|
|
|
extern int pmtime;
|
2001-05-08 06:19:06 +00:00
|
|
|
extern int nodirs;
|
1994-05-26 06:18:55 +00:00
|
|
|
extern int pmode;
|
|
|
|
extern int pids;
|
2001-05-08 06:19:06 +00:00
|
|
|
extern int rmleadslash;
|
1994-05-26 06:18:55 +00:00
|
|
|
extern int exit_val;
|
|
|
|
extern int docrc;
|
|
|
|
extern char *dirptr;
|
2003-05-03 16:39:34 +00:00
|
|
|
extern const char *argv0;
|
2012-10-19 05:43:38 +00:00
|
|
|
extern sigset_t s_mask;
|
2001-05-08 06:19:06 +00:00
|
|
|
extern FILE *listf;
|
2001-04-26 07:32:27 +00:00
|
|
|
extern char *tempfile;
|
|
|
|
extern char *tempbase;
|
|
|
|
|
2002-02-02 06:48:10 +00:00
|
|
|
void sig_cleanup(int);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* sel_subs.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int sel_chk(ARCHD *);
|
|
|
|
int grp_add(char *);
|
|
|
|
int usr_add(char *);
|
|
|
|
int trng_add(char *);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tables.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00: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 *);
|
|
|
|
void sub_name(char *, int *, size_t);
|
|
|
|
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-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tar.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00: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 *);
|
1994-05-26 06:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tty_subs.c
|
|
|
|
*/
|
2002-02-02 06:48:10 +00:00
|
|
|
int tty_init(void);
|
|
|
|
void tty_prnt(const char *, ...) __printflike(1, 2);
|
|
|
|
int tty_read(char *, int);
|
|
|
|
void paxwarn(int, const char *, ...) __printflike(2, 3);
|
|
|
|
void syswarn(int, int, const char *, ...) __printflike(3, 4);
|