extern.h revision 1.29
1/* $NetBSD: extern.h,v 1.29 2002/01/29 10:20:28 tv 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#if HAVE_CONFIG_H 43#include "config.h" 44#else 45#define HAVE_ERR_H 1 46#define HAVE_FTS_H 1 47#define HAVE_STRUCT_STAT_ST_FLAGS 1 48#endif 49 50#if HAVE_ERR_H 51#include <err.h> 52#endif 53 54/* 55 * External references from each source file 56 */ 57 58#include <sys/cdefs.h> 59 60/* 61 * ar_io.c 62 */ 63extern const char *arcname; 64extern int curdirfd; 65extern const char *gzip_program; 66extern time_t starttime; 67extern int force_one_volume; 68int ar_open(const char *); 69void ar_close(void); 70void ar_drain(void); 71int ar_set_wr(void); 72int ar_app_ok(void); 73#ifdef SYS_NO_RESTART 74int read_with_restart(int, void *, int); 75int write_with_restart(int, void *, int); 76#else 77#define read_with_restart read 78#define write_with_restart write 79#endif 80int xread(int, void *, int); 81int xwrite(int, void *, int); 82int ar_read(char *, int); 83int ar_write(char *, int); 84int ar_rdsync(void); 85int ar_fow(off_t, off_t *); 86int ar_rev(off_t ); 87int ar_next(void); 88void ar_summary(int); 89int ar_dochdir(char *); 90 91/* 92 * ar_subs.c 93 */ 94extern u_long flcnt; 95extern ARCHD archd; 96void list(void); 97void extract(void); 98void append(void); 99void archive(void); 100void copy(void); 101 102/* 103 * buf_subs.c 104 */ 105extern int blksz; 106extern int wrblksz; 107extern int maxflt; 108extern int rdblksz; 109extern off_t wrlimit; 110extern off_t rdcnt; 111extern off_t wrcnt; 112int wr_start(void); 113int rd_start(void); 114void cp_start(void); 115int appnd_start(off_t); 116int rd_sync(void); 117void pback(char *, int); 118int rd_skip(off_t); 119void wr_fin(void); 120int wr_rdbuf(char *, int); 121int rd_wrbuf(char *, int); 122int wr_skip(off_t); 123int wr_rdfile(ARCHD *, int, off_t *); 124int rd_wrfile(ARCHD *, int, off_t *); 125void cp_file(ARCHD *, int, int); 126int buf_fill(void); 127int buf_flush(int); 128 129/* 130 * cpio.c 131 */ 132extern int cpio_swp_head; 133int cpio_strd(void); 134int cpio_subtrail(ARCHD *); 135int cpio_endwr(void); 136int cpio_id(char *, int); 137int cpio_rd(ARCHD *, char *); 138off_t cpio_endrd(void); 139int cpio_stwr(void); 140int cpio_wr(ARCHD *); 141int vcpio_id(char *, int); 142int crc_id(char *, int); 143int crc_strd(void); 144int vcpio_rd(ARCHD *, char *); 145off_t vcpio_endrd(void); 146int crc_stwr(void); 147int vcpio_wr(ARCHD *); 148int bcpio_id(char *, int); 149int bcpio_rd(ARCHD *, char *); 150off_t bcpio_endrd(void); 151int bcpio_wr(ARCHD *); 152 153/* 154 * file_subs.c 155 */ 156extern char *gnu_hack_string; 157int file_creat(ARCHD *); 158void file_close(ARCHD *, int); 159int lnk_creat(ARCHD *); 160int cross_lnk(ARCHD *); 161int chk_same(ARCHD *); 162int node_creat(ARCHD *); 163int unlnk_exist(char *, int); 164int chk_path(char *, uid_t, gid_t); 165void set_ftime(char *fnm, time_t mtime, time_t atime, int frc); 166int set_ids(char *, uid_t, gid_t); 167void set_pmode(char *, mode_t); 168void set_chflags(char *fnm, u_int32_t flags); 169int file_write(int, char *, int, int *, int *, int, char *); 170void file_flush(int, char *, int); 171void rdfile_close(ARCHD *, int *); 172int set_crc(ARCHD *, int); 173 174/* 175 * ftree.c 176 */ 177int ftree_start(void); 178int ftree_add(char *, int); 179void ftree_sel(ARCHD *); 180void ftree_chk(void); 181int next_file(ARCHD *); 182 183/* 184 * gen_subs.c 185 */ 186void ls_list(ARCHD *, time_t); 187void ls_tty(ARCHD *); 188void zf_strncpy(char *, const char *, int); 189int l_strncpy(char *, const char *, int); 190u_long asc_ul(char *, int, int); 191int ul_asc(u_long, char *, int, int); 192#ifndef NET2_STAT 193unsigned long long asc_ull(char *, int, int); 194int ull_asc(unsigned long long, char *, int, int); 195#endif 196int check_Aflag(void); 197 198/* 199 * getoldopt.c 200 */ 201struct option; 202int getoldopt(int, char **, const char *, struct option *, int *); 203 204/* 205 * options.c 206 */ 207extern FSUB fsub[]; 208extern int ford[]; 209extern int cpio_mode; 210void options(int, char **); 211OPLIST * opt_next(void); 212int opt_add(const char *); 213int opt_chdir(char *); 214int bad_opt(void); 215 216/* 217 * pat_rep.c 218 */ 219int rep_add(char *); 220int pat_add(char *, int); 221void pat_chk(void); 222int pat_sel(ARCHD *); 223int pat_match(ARCHD *); 224int mod_name(ARCHD *); 225int set_dest(ARCHD *, char *, int); 226 227/* 228 * pax.c 229 */ 230extern int act; 231extern FSUB *frmt; 232extern int Aflag; 233extern int cflag; 234extern int dflag; 235extern int iflag; 236extern int kflag; 237extern int lflag; 238extern int nflag; 239extern int tflag; 240extern int uflag; 241extern int vflag; 242extern int zflag; 243extern int Dflag; 244extern int Hflag; 245extern int Lflag; 246extern int Mflag; 247extern int Xflag; 248extern int Yflag; 249extern int Zflag; 250extern int vfpart; 251extern int patime; 252extern int pmtime; 253extern int pfflags; 254extern int pmode; 255extern int pids; 256extern int exit_val; 257extern int docrc; 258extern char *dirptr; 259extern char *argv0; 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 *); 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_oldgnutar; 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 *); 312 313/* 314 * tty_subs.c 315 */ 316int tty_init(void); 317void tty_prnt(const char *, ...) 318 __attribute__((format (printf, 1, 2))); 319int tty_read(char *, int); 320void tty_warn(int, const char *, ...) 321 __attribute__((format (printf, 2, 3))); 322void syswarn(int, int, const char *, ...) 323 __attribute__((format (printf, 3, 4))); 324