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 */ 504b88c807SRodney W. Grimes extern char *arcname; 514b88c807SRodney W. Grimes int ar_open __P((char *)); 524b88c807SRodney W. Grimes void ar_close __P((void)); 534b88c807SRodney W. Grimes void ar_drain __P((void)); 544b88c807SRodney W. Grimes int ar_set_wr __P((void)); 554b88c807SRodney W. Grimes int ar_app_ok __P((void)); 564b88c807SRodney W. Grimes int ar_read __P((register char *, register int)); 574b88c807SRodney W. Grimes int ar_write __P((register char *, register int)); 584b88c807SRodney W. Grimes int ar_rdsync __P((void)); 594b88c807SRodney W. Grimes int ar_fow __P((off_t, off_t *)); 604b88c807SRodney W. Grimes int ar_rev __P((off_t )); 614b88c807SRodney W. Grimes int ar_next __P((void)); 624b88c807SRodney W. Grimes 634b88c807SRodney W. Grimes /* 644b88c807SRodney W. Grimes * ar_subs.c 654b88c807SRodney W. Grimes */ 664b88c807SRodney W. Grimes extern u_long flcnt; 674b88c807SRodney W. Grimes void list __P((void)); 684b88c807SRodney W. Grimes void extract __P((void)); 694b88c807SRodney W. Grimes void append __P((void)); 704b88c807SRodney W. Grimes void archive __P((void)); 714b88c807SRodney W. Grimes void copy __P((void)); 724b88c807SRodney W. Grimes 734b88c807SRodney W. Grimes /* 744b88c807SRodney W. Grimes * buf_subs.c 754b88c807SRodney W. Grimes */ 764b88c807SRodney W. Grimes extern int blksz; 774b88c807SRodney W. Grimes extern int wrblksz; 784b88c807SRodney W. Grimes extern int maxflt; 794b88c807SRodney W. Grimes extern int rdblksz; 804b88c807SRodney W. Grimes extern off_t wrlimit; 814b88c807SRodney W. Grimes extern off_t rdcnt; 824b88c807SRodney W. Grimes extern off_t wrcnt; 834b88c807SRodney W. Grimes int wr_start __P((void)); 844b88c807SRodney W. Grimes int rd_start __P((void)); 854b88c807SRodney W. Grimes void cp_start __P((void)); 864b88c807SRodney W. Grimes int appnd_start __P((off_t)); 874b88c807SRodney W. Grimes int rd_sync __P((void)); 884b88c807SRodney W. Grimes void pback __P((char *, int)); 894b88c807SRodney W. Grimes int rd_skip __P((off_t)); 904b88c807SRodney W. Grimes void wr_fin __P((void)); 914b88c807SRodney W. Grimes int wr_rdbuf __P((register char *, register int)); 924b88c807SRodney W. Grimes int rd_wrbuf __P((register char *, register int)); 934b88c807SRodney W. Grimes int wr_skip __P((off_t)); 944b88c807SRodney W. Grimes int wr_rdfile __P((ARCHD *, int, off_t *)); 954b88c807SRodney W. Grimes int rd_wrfile __P((ARCHD *, int, off_t *)); 964b88c807SRodney W. Grimes void cp_file __P((ARCHD *, int, int)); 974b88c807SRodney W. Grimes int buf_fill __P((void)); 984b88c807SRodney W. Grimes int buf_flush __P((register int)); 994b88c807SRodney W. Grimes 1004b88c807SRodney W. Grimes /* 1014b88c807SRodney W. Grimes * cache.c 1024b88c807SRodney W. Grimes */ 1034b88c807SRodney W. Grimes int uidtb_start __P((void)); 1044b88c807SRodney W. Grimes int gidtb_start __P((void)); 1054b88c807SRodney W. Grimes int usrtb_start __P((void)); 1064b88c807SRodney W. Grimes int grptb_start __P((void)); 1074b88c807SRodney W. Grimes char * name_uid __P((uid_t, int)); 1084b88c807SRodney W. Grimes char * name_gid __P((gid_t, int)); 1094b88c807SRodney W. Grimes int uid_name __P((char *, uid_t *)); 1104b88c807SRodney W. Grimes int gid_name __P((char *, gid_t *)); 1114b88c807SRodney W. Grimes 1124b88c807SRodney W. Grimes /* 1134b88c807SRodney W. Grimes * cpio.c 1144b88c807SRodney W. Grimes */ 1154b88c807SRodney W. Grimes int cpio_strd __P((void)); 1164b88c807SRodney W. Grimes int cpio_trail __P((register ARCHD *)); 1174b88c807SRodney W. Grimes int cpio_endwr __P((void)); 1184b88c807SRodney W. Grimes int cpio_id __P((char *, int)); 1194b88c807SRodney W. Grimes int cpio_rd __P((register ARCHD *, register char *)); 1204b88c807SRodney W. Grimes off_t cpio_endrd __P((void)); 1214b88c807SRodney W. Grimes int cpio_stwr __P((void)); 1224b88c807SRodney W. Grimes int cpio_wr __P((register ARCHD *)); 1234b88c807SRodney W. Grimes int vcpio_id __P((char *, int)); 1244b88c807SRodney W. Grimes int crc_id __P((char *, int)); 1254b88c807SRodney W. Grimes int crc_strd __P((void)); 1264b88c807SRodney W. Grimes int vcpio_rd __P((register ARCHD *, register char *)); 1274b88c807SRodney W. Grimes off_t vcpio_endrd __P((void)); 1284b88c807SRodney W. Grimes int crc_stwr __P((void)); 1294b88c807SRodney W. Grimes int vcpio_wr __P((register ARCHD *)); 1304b88c807SRodney W. Grimes int bcpio_id __P((char *, int)); 1314b88c807SRodney W. Grimes int bcpio_rd __P((register ARCHD *, register char *)); 1324b88c807SRodney W. Grimes off_t bcpio_endrd __P((void)); 1334b88c807SRodney W. Grimes int bcpio_wr __P((register ARCHD *)); 1344b88c807SRodney W. Grimes 1354b88c807SRodney W. Grimes /* 1364b88c807SRodney W. Grimes * file_subs.c 1374b88c807SRodney W. Grimes */ 1384b88c807SRodney W. Grimes int file_creat __P((register ARCHD *)); 1394b88c807SRodney W. Grimes void file_close __P((register ARCHD *, int)); 1404b88c807SRodney W. Grimes int lnk_creat __P((register ARCHD *)); 1414b88c807SRodney W. Grimes int cross_lnk __P((register ARCHD *)); 1424b88c807SRodney W. Grimes int chk_same __P((register ARCHD *)); 1434b88c807SRodney W. Grimes int node_creat __P((register ARCHD *)); 1444b88c807SRodney W. Grimes int unlnk_exist __P((register char *, register int)); 1454b88c807SRodney W. Grimes int chk_path __P((register char *, uid_t, gid_t)); 1464b88c807SRodney W. Grimes void set_ftime __P((char *fnm, time_t mtime, time_t atime, int frc)); 1474b88c807SRodney W. Grimes int set_ids __P((char *, uid_t, gid_t)); 1484b88c807SRodney W. Grimes void set_pmode __P((char *, mode_t)); 1494b88c807SRodney W. Grimes int file_write __P((int, char *, register int, int *, int *, int, char *)); 1504b88c807SRodney W. Grimes void file_flush __P((int, char *, int)); 1514b88c807SRodney W. Grimes void rdfile_close __P((register ARCHD *, register int *)); 1524b88c807SRodney W. Grimes int set_crc __P((register ARCHD *, register int)); 1534b88c807SRodney W. Grimes 1544b88c807SRodney W. Grimes /* 1554b88c807SRodney W. Grimes * ftree.c 1564b88c807SRodney W. Grimes */ 1574b88c807SRodney W. Grimes int ftree_start __P((void)); 1584b88c807SRodney W. Grimes int ftree_add __P((register char *)); 1594b88c807SRodney W. Grimes void ftree_sel __P((register ARCHD *)); 1604b88c807SRodney W. Grimes void ftree_chk __P((void)); 1614b88c807SRodney W. Grimes int next_file __P((register ARCHD *)); 1624b88c807SRodney W. Grimes 1634b88c807SRodney W. Grimes /* 1644b88c807SRodney W. Grimes * gen_subs.c 1654b88c807SRodney W. Grimes */ 1664b88c807SRodney W. Grimes void ls_list __P((register ARCHD *, time_t)); 1674b88c807SRodney W. Grimes void ls_tty __P((register ARCHD *)); 1684b88c807SRodney W. Grimes void zf_strncpy __P((register char *, register char *, int)); 1694b88c807SRodney W. Grimes int l_strncpy __P((register char *, register char *, int)); 1704b88c807SRodney W. Grimes u_long asc_ul __P((register char *, int, register int)); 1714b88c807SRodney W. Grimes int ul_asc __P((u_long, register char *, register int, register int)); 1724b88c807SRodney W. Grimes #ifndef NET2_STAT 1734b88c807SRodney W. Grimes u_quad_t asc_uqd __P((register char *, int, register int)); 1744b88c807SRodney W. Grimes int uqd_asc __P((u_quad_t, register char *, register int, register int)); 1754b88c807SRodney W. Grimes #endif 1764b88c807SRodney W. Grimes 1774b88c807SRodney W. Grimes /* 1784b88c807SRodney W. Grimes * options.c 1794b88c807SRodney W. Grimes */ 1804b88c807SRodney W. Grimes extern FSUB fsub[]; 1814b88c807SRodney W. Grimes extern int ford[]; 1824b88c807SRodney W. Grimes void options __P((register int, register char **)); 1834b88c807SRodney W. Grimes OPLIST * opt_next __P((void)); 1844b88c807SRodney W. Grimes int opt_add __P((register char *)); 1854b88c807SRodney W. Grimes int bad_opt __P((void)); 1864b88c807SRodney W. Grimes 1874b88c807SRodney W. Grimes /* 1884b88c807SRodney W. Grimes * pat_rep.c 1894b88c807SRodney W. Grimes */ 1904b88c807SRodney W. Grimes int rep_add __P((register char *)); 1914b88c807SRodney W. Grimes int pat_add __P((char *)); 1924b88c807SRodney W. Grimes void pat_chk __P((void)); 1934b88c807SRodney W. Grimes int pat_sel __P((register ARCHD *)); 1944b88c807SRodney W. Grimes int pat_match __P((register ARCHD *)); 1954b88c807SRodney W. Grimes int mod_name __P((register ARCHD *)); 1964b88c807SRodney W. Grimes int set_dest __P((register ARCHD *, char *, int)); 1974b88c807SRodney W. Grimes 1984b88c807SRodney W. Grimes /* 1994b88c807SRodney W. Grimes * pax.c 2004b88c807SRodney W. Grimes */ 2014b88c807SRodney W. Grimes extern int act; 2024b88c807SRodney W. Grimes extern FSUB *frmt; 2034b88c807SRodney W. Grimes extern int cflag; 2044b88c807SRodney W. Grimes extern int dflag; 2054b88c807SRodney W. Grimes extern int iflag; 2064b88c807SRodney W. Grimes extern int kflag; 2074b88c807SRodney W. Grimes extern int lflag; 2084b88c807SRodney W. Grimes extern int nflag; 2094b88c807SRodney W. Grimes extern int tflag; 2104b88c807SRodney W. Grimes extern int uflag; 2114b88c807SRodney W. Grimes extern int vflag; 2124b88c807SRodney W. Grimes extern int Dflag; 2134b88c807SRodney W. Grimes extern int Hflag; 2144b88c807SRodney W. Grimes extern int Lflag; 2154b88c807SRodney W. Grimes extern int Xflag; 2164b88c807SRodney W. Grimes extern int Yflag; 2174b88c807SRodney W. Grimes extern int Zflag; 2184b88c807SRodney W. Grimes extern int vfpart; 2194b88c807SRodney W. Grimes extern int patime; 2204b88c807SRodney W. Grimes extern int pmtime; 2214b88c807SRodney W. Grimes extern int pmode; 2224b88c807SRodney W. Grimes extern int pids; 2234b88c807SRodney W. Grimes extern int exit_val; 2244b88c807SRodney W. Grimes extern int docrc; 2254b88c807SRodney W. Grimes extern char *dirptr; 2264b88c807SRodney W. Grimes extern char *argv0; 227ffbef1cdSKris Kennaway extern char *tempfile; 228ffbef1cdSKris Kennaway extern char *tempbase; 229ffbef1cdSKris Kennaway 2304b88c807SRodney W. Grimes int main __P((int, char **)); 2314b88c807SRodney W. Grimes void sig_cleanup __P((int)); 2324b88c807SRodney W. Grimes 2334b88c807SRodney W. Grimes /* 2344b88c807SRodney W. Grimes * sel_subs.c 2354b88c807SRodney W. Grimes */ 2364b88c807SRodney W. Grimes int sel_chk __P((register ARCHD *)); 2374b88c807SRodney W. Grimes int grp_add __P((register char *)); 2384b88c807SRodney W. Grimes int usr_add __P((register char *)); 2394b88c807SRodney W. Grimes int trng_add __P((register char *)); 2404b88c807SRodney W. Grimes 2414b88c807SRodney W. Grimes /* 2424b88c807SRodney W. Grimes * tables.c 2434b88c807SRodney W. Grimes */ 2444b88c807SRodney W. Grimes int lnk_start __P((void)); 2454b88c807SRodney W. Grimes int chk_lnk __P((register ARCHD *)); 2464b88c807SRodney W. Grimes void purg_lnk __P((register ARCHD *)); 2474b88c807SRodney W. Grimes void lnk_end __P((void)); 2484b88c807SRodney W. Grimes int ftime_start __P((void)); 2494b88c807SRodney W. Grimes int chk_ftime __P((register ARCHD *)); 2504b88c807SRodney W. Grimes int name_start __P((void)); 2514b88c807SRodney W. Grimes int add_name __P((register char *, int, char *)); 2524b88c807SRodney W. Grimes void sub_name __P((register char *, int *)); 2534b88c807SRodney W. Grimes int dev_start __P((void)); 2544b88c807SRodney W. Grimes int add_dev __P((register ARCHD *)); 2554b88c807SRodney W. Grimes int map_dev __P((register ARCHD *, u_long, u_long)); 2564b88c807SRodney W. Grimes int atdir_start __P((void)); 2574b88c807SRodney W. Grimes void atdir_end __P((void)); 2584b88c807SRodney W. Grimes void add_atdir __P((char *, dev_t, ino_t, time_t, time_t)); 2594b88c807SRodney W. Grimes int get_atdir __P((dev_t, ino_t, time_t *, time_t *)); 2604b88c807SRodney W. Grimes int dir_start __P((void)); 2614b88c807SRodney W. Grimes void add_dir __P((char *, int, struct stat *, int)); 2624b88c807SRodney W. Grimes void proc_dir __P((void)); 2634b88c807SRodney W. Grimes u_int st_hash __P((char *, int, int)); 2644b88c807SRodney W. Grimes 2654b88c807SRodney W. Grimes /* 2664b88c807SRodney W. Grimes * tar.c 2674b88c807SRodney W. Grimes */ 2684b88c807SRodney W. Grimes int tar_endwr __P((void)); 2694b88c807SRodney W. Grimes off_t tar_endrd __P((void)); 2704b88c807SRodney W. Grimes int tar_trail __P((register char *, register int, register int *)); 2714b88c807SRodney W. Grimes int tar_id __P((register char *, int)); 2724b88c807SRodney W. Grimes int tar_opt __P((void)); 2734b88c807SRodney W. Grimes int tar_rd __P((register ARCHD *, register char *)); 2744b88c807SRodney W. Grimes int tar_wr __P((register ARCHD *)); 2754b88c807SRodney W. Grimes int ustar_strd __P((void)); 2764b88c807SRodney W. Grimes int ustar_stwr __P((void)); 2774b88c807SRodney W. Grimes int ustar_id __P((char *, int)); 2784b88c807SRodney W. Grimes int ustar_rd __P((register ARCHD *, register char *)); 2794b88c807SRodney W. Grimes int ustar_wr __P((register ARCHD *)); 2804b88c807SRodney W. Grimes 2814b88c807SRodney W. Grimes /* 2824b88c807SRodney W. Grimes * tty_subs.c 2834b88c807SRodney W. Grimes */ 2844b88c807SRodney W. Grimes int tty_init __P((void)); 285a2e73040SKris Kennaway void tty_prnt __P((const char *, ...)) __printflike(1, 2); 2864b88c807SRodney W. Grimes int tty_read __P((char *, int)); 287a2e73040SKris Kennaway void pax_warn __P((int, const char *, ...)) __printflike(2, 3); 288a2e73040SKris Kennaway void sys_warn __P((int, int, const char *, ...)) __printflike(3, 4); 289