14b88c807SRodney W. Grimes /*- 24b88c807SRodney W. Grimes * Copyright (c) 1992 Keith Muller. 34b88c807SRodney W. Grimes * Copyright (c) 1992, 1993 44b88c807SRodney W. Grimes * The Regents of the University of California. All rights reserved. 54b88c807SRodney W. Grimes * 64b88c807SRodney W. Grimes * This code is derived from software contributed to Berkeley by 74b88c807SRodney W. Grimes * Keith Muller of the University of California, San Diego. 84b88c807SRodney W. Grimes * 94b88c807SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 104b88c807SRodney W. Grimes * modification, are permitted provided that the following conditions 114b88c807SRodney W. Grimes * are met: 124b88c807SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 134b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 144b88c807SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 154b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 164b88c807SRodney W. Grimes * documentation and/or other materials provided with the distribution. 174b88c807SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 184b88c807SRodney W. Grimes * must display the following acknowledgement: 194b88c807SRodney W. Grimes * This product includes software developed by the University of 204b88c807SRodney W. Grimes * California, Berkeley and its contributors. 214b88c807SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 224b88c807SRodney W. Grimes * may be used to endorse or promote products derived from this software 234b88c807SRodney W. Grimes * without specific prior written permission. 244b88c807SRodney W. Grimes * 254b88c807SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 264b88c807SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 274b88c807SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 284b88c807SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 294b88c807SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 304b88c807SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 314b88c807SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 324b88c807SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 334b88c807SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 344b88c807SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 354b88c807SRodney W. Grimes * SUCH DAMAGE. 364b88c807SRodney W. Grimes * 374b88c807SRodney W. Grimes * @(#)extern.h 8.2 (Berkeley) 4/18/94 382a456239SPeter Wemm * $FreeBSD$ 394b88c807SRodney W. Grimes */ 404b88c807SRodney W. Grimes 414b88c807SRodney W. Grimes /* 424b88c807SRodney W. Grimes * External references from each source file 434b88c807SRodney W. Grimes */ 444b88c807SRodney W. Grimes 454b88c807SRodney W. Grimes #include <sys/cdefs.h> 464b88c807SRodney W. Grimes 474b88c807SRodney W. Grimes /* 484b88c807SRodney W. Grimes * ar_io.c 494b88c807SRodney W. Grimes */ 5040feca3aSMark Murray extern const char *arcname; 511192d531SKris Kennaway extern const char *gzip_program; 5240feca3aSMark Murray int ar_open(const char *); 5346251ddeSWarner Losh void ar_close(void); 5446251ddeSWarner Losh void ar_drain(void); 5546251ddeSWarner Losh int ar_set_wr(void); 5646251ddeSWarner Losh int ar_app_ok(void); 5746251ddeSWarner Losh int ar_read(char *, int); 5846251ddeSWarner Losh int ar_write(char *, int); 5946251ddeSWarner Losh int ar_rdsync(void); 6046251ddeSWarner Losh int ar_fow(off_t, off_t *); 6146251ddeSWarner Losh int ar_rev(off_t ); 6246251ddeSWarner Losh int ar_next(void); 634b88c807SRodney W. Grimes 644b88c807SRodney W. Grimes /* 654b88c807SRodney W. Grimes * ar_subs.c 664b88c807SRodney W. Grimes */ 674b88c807SRodney W. Grimes extern u_long flcnt; 6846251ddeSWarner Losh void list(void); 6946251ddeSWarner Losh void extract(void); 7046251ddeSWarner Losh void append(void); 7146251ddeSWarner Losh void archive(void); 7246251ddeSWarner Losh void copy(void); 734b88c807SRodney W. Grimes 744b88c807SRodney W. Grimes /* 754b88c807SRodney W. Grimes * buf_subs.c 764b88c807SRodney W. Grimes */ 774b88c807SRodney W. Grimes extern int blksz; 784b88c807SRodney W. Grimes extern int wrblksz; 794b88c807SRodney W. Grimes extern int maxflt; 804b88c807SRodney W. Grimes extern int rdblksz; 814b88c807SRodney W. Grimes extern off_t wrlimit; 824b88c807SRodney W. Grimes extern off_t rdcnt; 834b88c807SRodney W. Grimes extern off_t wrcnt; 8446251ddeSWarner Losh int wr_start(void); 8546251ddeSWarner Losh int rd_start(void); 8646251ddeSWarner Losh void cp_start(void); 8746251ddeSWarner Losh int appnd_start(off_t); 8846251ddeSWarner Losh int rd_sync(void); 8946251ddeSWarner Losh void pback(char *, int); 9046251ddeSWarner Losh int rd_skip(off_t); 9146251ddeSWarner Losh void wr_fin(void); 9246251ddeSWarner Losh int wr_rdbuf(char *, int); 9346251ddeSWarner Losh int rd_wrbuf(char *, int); 9446251ddeSWarner Losh int wr_skip(off_t); 9546251ddeSWarner Losh int wr_rdfile(ARCHD *, int, off_t *); 9646251ddeSWarner Losh int rd_wrfile(ARCHD *, int, off_t *); 9746251ddeSWarner Losh void cp_file(ARCHD *, int, int); 9846251ddeSWarner Losh int buf_fill(void); 9946251ddeSWarner Losh int buf_flush(int); 1004b88c807SRodney W. Grimes 1014b88c807SRodney W. Grimes /* 1024b88c807SRodney W. Grimes * cache.c 1034b88c807SRodney W. Grimes */ 10446251ddeSWarner Losh int uidtb_start(void); 10546251ddeSWarner Losh int gidtb_start(void); 10646251ddeSWarner Losh int usrtb_start(void); 10746251ddeSWarner Losh int grptb_start(void); 10840feca3aSMark Murray const char * name_uid(uid_t, int); 10940feca3aSMark Murray const char * name_gid(gid_t, int); 11046251ddeSWarner Losh int uid_name(char *, uid_t *); 11146251ddeSWarner Losh int gid_name(char *, gid_t *); 1124b88c807SRodney W. Grimes 1134b88c807SRodney W. Grimes /* 1144b88c807SRodney W. Grimes * cpio.c 1154b88c807SRodney W. Grimes */ 11646251ddeSWarner Losh int cpio_strd(void); 11746251ddeSWarner Losh int cpio_trail(ARCHD *); 11846251ddeSWarner Losh int cpio_endwr(void); 11946251ddeSWarner Losh int cpio_id(char *, int); 12046251ddeSWarner Losh int cpio_rd(ARCHD *, char *); 12146251ddeSWarner Losh off_t cpio_endrd(void); 12246251ddeSWarner Losh int cpio_stwr(void); 12346251ddeSWarner Losh int cpio_wr(ARCHD *); 12446251ddeSWarner Losh int vcpio_id(char *, int); 12546251ddeSWarner Losh int crc_id(char *, int); 12646251ddeSWarner Losh int crc_strd(void); 12746251ddeSWarner Losh int vcpio_rd(ARCHD *, char *); 12846251ddeSWarner Losh off_t vcpio_endrd(void); 12946251ddeSWarner Losh int crc_stwr(void); 13046251ddeSWarner Losh int vcpio_wr(ARCHD *); 13146251ddeSWarner Losh int bcpio_id(char *, int); 13246251ddeSWarner Losh int bcpio_rd(ARCHD *, char *); 13346251ddeSWarner Losh off_t bcpio_endrd(void); 13446251ddeSWarner Losh int bcpio_wr(ARCHD *); 1354b88c807SRodney W. Grimes 1364b88c807SRodney W. Grimes /* 1374b88c807SRodney W. Grimes * file_subs.c 1384b88c807SRodney W. Grimes */ 13946251ddeSWarner Losh int file_creat(ARCHD *); 14046251ddeSWarner Losh void file_close(ARCHD *, int); 14146251ddeSWarner Losh int lnk_creat(ARCHD *); 14246251ddeSWarner Losh int cross_lnk(ARCHD *); 14346251ddeSWarner Losh int chk_same(ARCHD *); 14446251ddeSWarner Losh int node_creat(ARCHD *); 14546251ddeSWarner Losh int unlnk_exist(char *, int); 14646251ddeSWarner Losh int chk_path(char *, uid_t, gid_t); 14746251ddeSWarner Losh void set_ftime(char *fnm, time_t mtime, time_t atime, int frc); 14846251ddeSWarner Losh int set_ids(char *, uid_t, gid_t); 14946251ddeSWarner Losh int set_lids(char *, uid_t, gid_t); 15046251ddeSWarner Losh void set_pmode(char *, mode_t); 15146251ddeSWarner Losh int file_write(int, char *, int, int *, int *, int, char *); 15246251ddeSWarner Losh void file_flush(int, char *, int); 15346251ddeSWarner Losh void rdfile_close(ARCHD *, int *); 15446251ddeSWarner Losh int set_crc(ARCHD *, int); 1554b88c807SRodney W. Grimes 1564b88c807SRodney W. Grimes /* 1574b88c807SRodney W. Grimes * ftree.c 1584b88c807SRodney W. Grimes */ 15946251ddeSWarner Losh int ftree_start(void); 16046251ddeSWarner Losh int ftree_add(char *, int); 16146251ddeSWarner Losh void ftree_sel(ARCHD *); 16246251ddeSWarner Losh void ftree_chk(void); 16346251ddeSWarner Losh int next_file(ARCHD *); 1644b88c807SRodney W. Grimes 1654b88c807SRodney W. Grimes /* 1664b88c807SRodney W. Grimes * gen_subs.c 1674b88c807SRodney W. Grimes */ 16846251ddeSWarner Losh void ls_list(ARCHD *, time_t, FILE *); 16946251ddeSWarner Losh void ls_tty(ARCHD *); 17040feca3aSMark Murray int l_strncpy(char *, const char *, int); 17146251ddeSWarner Losh u_long asc_ul(char *, int, int); 17246251ddeSWarner Losh int ul_asc(u_long, char *, int, int); 1734b88c807SRodney W. Grimes #ifndef NET2_STAT 17446251ddeSWarner Losh u_quad_t asc_uqd(char *, int, int); 17546251ddeSWarner Losh int uqd_asc(u_quad_t, char *, int, int); 1764b88c807SRodney W. Grimes #endif 1774b88c807SRodney W. Grimes 1784b88c807SRodney W. Grimes /* 179b1787decSKris Kennaway * getoldopt.c 180b1787decSKris Kennaway */ 18140feca3aSMark Murray int getoldopt(int, char **, const char *); 182b1787decSKris Kennaway 183b1787decSKris Kennaway /* 1844b88c807SRodney W. Grimes * options.c 1854b88c807SRodney W. Grimes */ 1864b88c807SRodney W. Grimes extern FSUB fsub[]; 1874b88c807SRodney W. Grimes extern int ford[]; 18846251ddeSWarner Losh void options(int, char **); 18946251ddeSWarner Losh OPLIST * opt_next(void); 19040feca3aSMark Murray int opt_add(const char *); 19146251ddeSWarner Losh int bad_opt(void); 192b1787decSKris Kennaway char *chdname; 1934b88c807SRodney W. Grimes 1944b88c807SRodney W. Grimes /* 1954b88c807SRodney W. Grimes * pat_rep.c 1964b88c807SRodney W. Grimes */ 19746251ddeSWarner Losh int rep_add(char *); 19846251ddeSWarner Losh int pat_add(char *, char *); 19946251ddeSWarner Losh void pat_chk(void); 20046251ddeSWarner Losh int pat_sel(ARCHD *); 20146251ddeSWarner Losh int pat_match(ARCHD *); 20246251ddeSWarner Losh int mod_name(ARCHD *); 20346251ddeSWarner Losh int set_dest(ARCHD *, char *, int); 2044b88c807SRodney W. Grimes 2054b88c807SRodney W. Grimes /* 2064b88c807SRodney W. Grimes * pax.c 2074b88c807SRodney W. Grimes */ 2084b88c807SRodney W. Grimes extern int act; 2094b88c807SRodney W. Grimes extern FSUB *frmt; 2104b88c807SRodney W. Grimes extern int cflag; 211b1787decSKris Kennaway extern int cwdfd; 2124b88c807SRodney W. Grimes extern int dflag; 2134b88c807SRodney W. Grimes extern int iflag; 2144b88c807SRodney W. Grimes extern int kflag; 2154b88c807SRodney W. Grimes extern int lflag; 2164b88c807SRodney W. Grimes extern int nflag; 2174b88c807SRodney W. Grimes extern int tflag; 2184b88c807SRodney W. Grimes extern int uflag; 2194b88c807SRodney W. Grimes extern int vflag; 2204b88c807SRodney W. Grimes extern int Dflag; 2214b88c807SRodney W. Grimes extern int Hflag; 2224b88c807SRodney W. Grimes extern int Lflag; 2234b88c807SRodney W. Grimes extern int Xflag; 2244b88c807SRodney W. Grimes extern int Yflag; 2254b88c807SRodney W. Grimes extern int Zflag; 2264b88c807SRodney W. Grimes extern int vfpart; 2274b88c807SRodney W. Grimes extern int patime; 2284b88c807SRodney W. Grimes extern int pmtime; 229b1787decSKris Kennaway extern int nodirs; 2304b88c807SRodney W. Grimes extern int pmode; 2314b88c807SRodney W. Grimes extern int pids; 232b1787decSKris Kennaway extern int rmleadslash; 2334b88c807SRodney W. Grimes extern int exit_val; 2344b88c807SRodney W. Grimes extern int docrc; 2354b88c807SRodney W. Grimes extern char *dirptr; 23640feca3aSMark Murray extern const char *argv0; 237b1787decSKris Kennaway extern FILE *listf; 238ffbef1cdSKris Kennaway extern char *tempfile; 239ffbef1cdSKris Kennaway extern char *tempbase; 240ffbef1cdSKris Kennaway 24146251ddeSWarner Losh void sig_cleanup(int); 2424b88c807SRodney W. Grimes 2434b88c807SRodney W. Grimes /* 2444b88c807SRodney W. Grimes * sel_subs.c 2454b88c807SRodney W. Grimes */ 24646251ddeSWarner Losh int sel_chk(ARCHD *); 24746251ddeSWarner Losh int grp_add(char *); 24846251ddeSWarner Losh int usr_add(char *); 24946251ddeSWarner Losh int trng_add(char *); 2504b88c807SRodney W. Grimes 2514b88c807SRodney W. Grimes /* 2524b88c807SRodney W. Grimes * tables.c 2534b88c807SRodney W. Grimes */ 25446251ddeSWarner Losh int lnk_start(void); 25546251ddeSWarner Losh int chk_lnk(ARCHD *); 25646251ddeSWarner Losh void purg_lnk(ARCHD *); 25746251ddeSWarner Losh void lnk_end(void); 25846251ddeSWarner Losh int ftime_start(void); 25946251ddeSWarner Losh int chk_ftime(ARCHD *); 26046251ddeSWarner Losh int name_start(void); 26146251ddeSWarner Losh int add_name(char *, int, char *); 26246251ddeSWarner Losh void sub_name(char *, int *, size_t); 26346251ddeSWarner Losh int dev_start(void); 26446251ddeSWarner Losh int add_dev(ARCHD *); 26546251ddeSWarner Losh int map_dev(ARCHD *, u_long, u_long); 26646251ddeSWarner Losh int atdir_start(void); 26746251ddeSWarner Losh void atdir_end(void); 26846251ddeSWarner Losh void add_atdir(char *, dev_t, ino_t, time_t, time_t); 26946251ddeSWarner Losh int get_atdir(dev_t, ino_t, time_t *, time_t *); 27046251ddeSWarner Losh int dir_start(void); 27146251ddeSWarner Losh void add_dir(char *, int, struct stat *, int); 27246251ddeSWarner Losh void proc_dir(void); 27346251ddeSWarner Losh u_int st_hash(char *, int, int); 2744b88c807SRodney W. Grimes 2754b88c807SRodney W. Grimes /* 2764b88c807SRodney W. Grimes * tar.c 2774b88c807SRodney W. Grimes */ 27846251ddeSWarner Losh int tar_endwr(void); 27946251ddeSWarner Losh off_t tar_endrd(void); 28046251ddeSWarner Losh int tar_trail(char *, int, int *); 28146251ddeSWarner Losh int tar_id(char *, int); 28246251ddeSWarner Losh int tar_opt(void); 28346251ddeSWarner Losh int tar_rd(ARCHD *, char *); 28446251ddeSWarner Losh int tar_wr(ARCHD *); 28546251ddeSWarner Losh int ustar_strd(void); 28646251ddeSWarner Losh int ustar_stwr(void); 28746251ddeSWarner Losh int ustar_id(char *, int); 28846251ddeSWarner Losh int ustar_rd(ARCHD *, char *); 28946251ddeSWarner Losh int ustar_wr(ARCHD *); 2904b88c807SRodney W. Grimes 2914b88c807SRodney W. Grimes /* 2924b88c807SRodney W. Grimes * tty_subs.c 2934b88c807SRodney W. Grimes */ 29446251ddeSWarner Losh int tty_init(void); 29546251ddeSWarner Losh void tty_prnt(const char *, ...) __printflike(1, 2); 29646251ddeSWarner Losh int tty_read(char *, int); 29746251ddeSWarner Losh void paxwarn(int, const char *, ...) __printflike(2, 3); 29846251ddeSWarner Losh void syswarn(int, int, const char *, ...) __printflike(3, 4); 299