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