extern.h revision 1.39
1/* $NetBSD: extern.h,v 1.39 2003/08/07 09:05:20 agc Exp $ */ 2 3/*- 4 * Copyright (c) 1992, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Keith Muller of the University of California, San Diego. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)extern.h 8.2 (Berkeley) 4/18/94 35 */ 36 37/*- 38 * Copyright (c) 1992 Keith Muller. 39 * 40 * This code is derived from software contributed to Berkeley by 41 * Keith Muller of the University of California, San Diego. 42 * 43 * Redistribution and use in source and binary forms, with or without 44 * modification, are permitted provided that the following conditions 45 * are met: 46 * 1. Redistributions of source code must retain the above copyright 47 * notice, this list of conditions and the following disclaimer. 48 * 2. Redistributions in binary form must reproduce the above copyright 49 * notice, this list of conditions and the following disclaimer in the 50 * documentation and/or other materials provided with the distribution. 51 * 3. All advertising materials mentioning features or use of this software 52 * must display the following acknowledgement: 53 * This product includes software developed by the University of 54 * California, Berkeley and its contributors. 55 * 4. Neither the name of the University nor the names of its contributors 56 * may be used to endorse or promote products derived from this software 57 * without specific prior written permission. 58 * 59 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 69 * SUCH DAMAGE. 70 * 71 * @(#)extern.h 8.2 (Berkeley) 4/18/94 72 */ 73 74/* 75 * External references from each source file 76 */ 77 78#include <sys/cdefs.h> 79#include <err.h> 80 81/* 82 * ar_io.c 83 */ 84extern const char *arcname; 85extern int curdirfd; 86extern const char *gzip_program; 87extern time_t starttime; 88extern int force_one_volume; 89extern char *chdname; 90extern int forcelocal; 91extern int secure; 92 93int ar_open(const char *); 94void ar_close(void); 95void ar_drain(void); 96int ar_set_wr(void); 97int ar_app_ok(void); 98#ifdef SYS_NO_RESTART 99int read_with_restart(int, void *, int); 100int write_with_restart(int, void *, int); 101#else 102#define read_with_restart read 103#define write_with_restart write 104#endif 105int xread(int, void *, int); 106int xwrite(int, void *, int); 107int ar_read(char *, int); 108int ar_write(char *, int); 109int ar_rdsync(void); 110int ar_fow(off_t, off_t *); 111int ar_rev(off_t ); 112int ar_next(void); 113void ar_summary(int); 114int ar_dochdir(char *); 115 116/* 117 * ar_subs.c 118 */ 119extern u_long flcnt; 120extern ARCHD archd; 121void list(void); 122void extract(void); 123void append(void); 124void archive(void); 125void copy(void); 126 127/* 128 * buf_subs.c 129 */ 130extern int blksz; 131extern int wrblksz; 132extern int maxflt; 133extern int rdblksz; 134extern off_t wrlimit; 135extern off_t rdcnt; 136extern off_t wrcnt; 137int wr_start(void); 138int rd_start(void); 139void cp_start(void); 140int appnd_start(off_t); 141int rd_sync(void); 142void pback(char *, int); 143int rd_skip(off_t); 144void wr_fin(void); 145int wr_rdbuf(char *, int); 146int rd_wrbuf(char *, int); 147int wr_skip(off_t); 148int wr_rdfile(ARCHD *, int, off_t *); 149int rd_wrfile(ARCHD *, int, off_t *); 150void cp_file(ARCHD *, int, int); 151int buf_fill(void); 152int buf_flush(int); 153 154/* 155 * cpio.c 156 */ 157extern int cpio_swp_head; 158int cpio_strd(void); 159int cpio_subtrail(ARCHD *); 160int cpio_endwr(void); 161int cpio_id(char *, int); 162int cpio_rd(ARCHD *, char *); 163off_t cpio_endrd(void); 164int cpio_stwr(void); 165int cpio_wr(ARCHD *); 166int vcpio_id(char *, int); 167int crc_id(char *, int); 168int crc_strd(void); 169int vcpio_rd(ARCHD *, char *); 170off_t vcpio_endrd(void); 171int crc_stwr(void); 172int vcpio_wr(ARCHD *); 173int bcpio_id(char *, int); 174int bcpio_rd(ARCHD *, char *); 175off_t bcpio_endrd(void); 176int bcpio_wr(ARCHD *); 177 178/* 179 * file_subs.c 180 */ 181extern char *gnu_name_string, *gnu_link_string; 182int file_creat(ARCHD *); 183void file_close(ARCHD *, int); 184int lnk_creat(ARCHD *); 185int cross_lnk(ARCHD *); 186int chk_same(ARCHD *); 187int node_creat(ARCHD *); 188int unlnk_exist(char *, int); 189int chk_path(char *, uid_t, gid_t); 190void set_ftime(char *fnm, time_t mtime, time_t atime, int frc); 191int set_ids(char *, uid_t, gid_t); 192void set_pmode(char *, mode_t); 193void set_chflags(char *fnm, u_int32_t flags); 194int file_write(int, char *, int, int *, int *, int, char *); 195void file_flush(int, char *, int); 196void rdfile_close(ARCHD *, int *); 197int set_crc(ARCHD *, int); 198 199/* 200 * ftree.c 201 */ 202int ftree_start(void); 203int ftree_add(char *, int); 204void ftree_sel(ARCHD *); 205void ftree_chk(void); 206int next_file(ARCHD *); 207 208/* 209 * gen_subs.c 210 */ 211void ls_list(ARCHD *, time_t, FILE *); 212void ls_tty(ARCHD *); 213void safe_print(const char *, FILE *); 214u_long asc_ul(char *, int, int); 215int ul_asc(u_long, char *, int, int); 216#if !defined(NET2_STAT) && !defined(_LP64) 217unsigned long long asc_ull(char *, int, int); 218int ull_asc(unsigned long long, char *, int, int); 219#endif 220int check_Aflag(void); 221 222/* 223 * getoldopt.c 224 */ 225struct option; 226int getoldopt(int, char **, const char *, struct option *, int *); 227 228/* 229 * options.c 230 */ 231extern FSUB fsub[]; 232extern int ford[]; 233void options(int, char **); 234OPLIST * opt_next(void); 235int opt_add(const char *); 236int bad_opt(void); 237int mkpath(char *); 238char *chdname; 239 240/* 241 * pat_rep.c 242 */ 243int rep_add(char *); 244int pat_add(char *, char *); 245void pat_chk(void); 246int pat_sel(ARCHD *); 247int pat_match(ARCHD *); 248int mod_name(ARCHD *); 249int set_dest(ARCHD *, char *, int); 250 251/* 252 * pax.c 253 */ 254extern int act; 255extern FSUB *frmt; 256extern int Aflag; 257extern int cflag; 258extern int cwdfd; 259extern int dflag; 260extern int iflag; 261extern int jflag; 262extern int kflag; 263extern int lflag; 264extern int nflag; 265extern int tflag; 266extern int uflag; 267extern int vflag; 268extern int zflag; 269extern int Dflag; 270extern int Hflag; 271extern int Lflag; 272extern int Mflag; 273extern int Xflag; 274extern int Yflag; 275extern int Zflag; 276extern int vfpart; 277extern int patime; 278extern int pmtime; 279extern int nodirs; 280extern int pfflags; 281extern int pmode; 282extern int pids; 283extern int rmleadslash; 284extern int exit_val; 285extern int docrc; 286extern int to_stdout; 287extern char *dirptr; 288extern char *ltmfrmt; 289extern char *argv0; 290extern FILE *listf; 291extern char *tempfile; 292extern char *tempbase; 293 294int main(int, char **); 295void sig_cleanup(int); 296 297/* 298 * sel_subs.c 299 */ 300int sel_chk(ARCHD *); 301int grp_add(char *); 302int usr_add(char *); 303int trng_add(char *); 304 305/* 306 * tables.c 307 */ 308int lnk_start(void); 309int chk_lnk(ARCHD *); 310void purg_lnk(ARCHD *); 311void lnk_end(void); 312int ftime_start(void); 313int chk_ftime(ARCHD *); 314int name_start(void); 315int add_name(char *, int, char *); 316void sub_name(char *, int *, size_t); 317int dev_start(void); 318int add_dev(ARCHD *); 319int map_dev(ARCHD *, u_long, u_long); 320int atdir_start(void); 321void atdir_end(void); 322void add_atdir(char *, dev_t, ino_t, time_t, time_t); 323int get_atdir(dev_t, ino_t, time_t *, time_t *); 324int dir_start(void); 325void add_dir(char *, int, struct stat *, int); 326void proc_dir(void); 327u_int st_hash(char *, int, int); 328 329/* 330 * tar.c 331 */ 332extern int is_gnutar; 333int tar_endwr(void); 334off_t tar_endrd(void); 335int tar_trail(char *, int, int *); 336int tar_id(char *, int); 337int tar_opt(void); 338int tar_rd(ARCHD *, char *); 339int tar_wr(ARCHD *); 340int ustar_strd(void); 341int ustar_stwr(void); 342int ustar_id(char *, int); 343int ustar_rd(ARCHD *, char *); 344int ustar_wr(ARCHD *); 345int tar_gnutar_X_compat(const char *); 346int tar_gnutar_minus_minus_exclude(const char *); 347 348/* 349 * tty_subs.c 350 */ 351int tty_init(void); 352void tty_prnt(const char *, ...) 353 __attribute__((format (printf, 1, 2))); 354int tty_read(char *, int); 355void tty_warn(int, const char *, ...) 356 __attribute__((format (printf, 2, 3))); 357void syswarn(int, int, const char *, ...) 358 __attribute__((format (printf, 3, 4))); 359