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