extern.h revision 1.26
1/* $NetBSD: extern.h,v 1.26 2001/10/25 05:33:32 lukem 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 48/* 49 * ar_io.c 50 */ 51extern const char *arcname; 52extern int curdirfd; 53extern const char *gzip_program; 54extern time_t starttime; 55extern int force_one_volume; 56int ar_open(const char *); 57void ar_close(void); 58void ar_drain(void); 59int ar_set_wr(void); 60int ar_app_ok(void); 61#ifdef SYS_NO_RESTART 62int read_with_restart(int, void *, int); 63int write_with_restart(int, void *, int); 64#else 65#define read_with_restart read 66#define write_with_restart write 67#endif 68int xread(int, void *, int); 69int xwrite(int, void *, int); 70int ar_read(char *, int); 71int ar_write(char *, int); 72int ar_rdsync(void); 73int ar_fow(off_t, off_t *); 74int ar_rev(off_t ); 75int ar_next(void); 76void ar_summary(int); 77int ar_dochdir(char *); 78 79/* 80 * ar_subs.c 81 */ 82extern u_long flcnt; 83extern ARCHD archd; 84void list(void); 85void extract(void); 86void append(void); 87void archive(void); 88void copy(void); 89 90/* 91 * buf_subs.c 92 */ 93extern int blksz; 94extern int wrblksz; 95extern int maxflt; 96extern int rdblksz; 97extern off_t wrlimit; 98extern off_t rdcnt; 99extern off_t wrcnt; 100int wr_start(void); 101int rd_start(void); 102void cp_start(void); 103int appnd_start(off_t); 104int rd_sync(void); 105void pback(char *, int); 106int rd_skip(off_t); 107void wr_fin(void); 108int wr_rdbuf(char *, int); 109int rd_wrbuf(char *, int); 110int wr_skip(off_t); 111int wr_rdfile(ARCHD *, int, off_t *); 112int rd_wrfile(ARCHD *, int, off_t *); 113void cp_file(ARCHD *, int, int); 114int buf_fill(void); 115int buf_flush(int); 116 117/* 118 * cpio.c 119 */ 120extern int cpio_swp_head; 121int cpio_strd(void); 122int cpio_subtrail(ARCHD *); 123int cpio_endwr(void); 124int cpio_id(char *, int); 125int cpio_rd(ARCHD *, char *); 126off_t cpio_endrd(void); 127int cpio_stwr(void); 128int cpio_wr(ARCHD *); 129int vcpio_id(char *, int); 130int crc_id(char *, int); 131int crc_strd(void); 132int vcpio_rd(ARCHD *, char *); 133off_t vcpio_endrd(void); 134int crc_stwr(void); 135int vcpio_wr(ARCHD *); 136int bcpio_id(char *, int); 137int bcpio_rd(ARCHD *, char *); 138off_t bcpio_endrd(void); 139int bcpio_wr(ARCHD *); 140 141/* 142 * file_subs.c 143 */ 144extern char *gnu_hack_string; 145int file_creat(ARCHD *); 146void file_close(ARCHD *, int); 147int lnk_creat(ARCHD *); 148int cross_lnk(ARCHD *); 149int chk_same(ARCHD *); 150int node_creat(ARCHD *); 151int unlnk_exist(char *, int); 152int chk_path(char *, uid_t, gid_t); 153void set_ftime(char *fnm, time_t mtime, time_t atime, int frc); 154int set_ids(char *, uid_t, gid_t); 155void set_pmode(char *, mode_t); 156void set_chflags(char *fnm, u_int32_t flags); 157int file_write(int, char *, int, int *, int *, int, char *); 158void file_flush(int, char *, int); 159void rdfile_close(ARCHD *, int *); 160int set_crc(ARCHD *, int); 161 162/* 163 * ftree.c 164 */ 165int ftree_start(void); 166int ftree_add(char *, int); 167void ftree_sel(ARCHD *); 168void ftree_chk(void); 169int next_file(ARCHD *); 170 171/* 172 * gen_subs.c 173 */ 174void ls_list(ARCHD *, time_t); 175void ls_tty(ARCHD *); 176void zf_strncpy(char *, const char *, int); 177int l_strncpy(char *, const char *, int); 178u_long asc_ul(char *, int, int); 179int ul_asc(u_long, char *, int, int); 180#ifndef NET2_STAT 181u_longlong_t asc_ull(char *, int, int); 182int ull_asc(u_longlong_t, char *, int, int); 183#endif 184int check_Aflag(void); 185 186/* 187 * getoldopt.c 188 */ 189struct option; 190int getoldopt(int, char **, const char *, struct option *, int *); 191 192/* 193 * options.c 194 */ 195extern FSUB fsub[]; 196extern int ford[]; 197extern int cpio_mode; 198void options(int, char **); 199OPLIST * opt_next(void); 200int opt_add(const char *); 201int opt_chdir(char *); 202int bad_opt(void); 203 204/* 205 * pat_rep.c 206 */ 207int rep_add(char *); 208int pat_add(char *, int); 209void pat_chk(void); 210int pat_sel(ARCHD *); 211int pat_match(ARCHD *); 212int mod_name(ARCHD *); 213int set_dest(ARCHD *, char *, int); 214 215/* 216 * pax.c 217 */ 218extern int act; 219extern FSUB *frmt; 220extern int Aflag; 221extern int cflag; 222extern int dflag; 223extern int iflag; 224extern int kflag; 225extern int lflag; 226extern int nflag; 227extern int tflag; 228extern int uflag; 229extern int vflag; 230extern int zflag; 231extern int Dflag; 232extern int Hflag; 233extern int Lflag; 234extern int Xflag; 235extern int Yflag; 236extern int Zflag; 237extern int vfpart; 238extern int patime; 239extern int pmtime; 240extern int pfflags; 241extern int pmode; 242extern int pids; 243extern int exit_val; 244extern int docrc; 245extern char *dirptr; 246extern char *argv0; 247int main(int, char **); 248void sig_cleanup(int); 249 250/* 251 * sel_subs.c 252 */ 253int sel_chk(ARCHD *); 254int grp_add(char *); 255int usr_add(char *); 256int trng_add(char *); 257 258/* 259 * tables.c 260 */ 261int lnk_start(void); 262int chk_lnk(ARCHD *); 263void purg_lnk(ARCHD *); 264void lnk_end(void); 265int ftime_start(void); 266int chk_ftime(ARCHD *); 267int name_start(void); 268int add_name(char *, int, char *); 269void sub_name(char *, int *); 270int dev_start(void); 271int add_dev(ARCHD *); 272int map_dev(ARCHD *, u_long, u_long); 273int atdir_start(void); 274void atdir_end(void); 275void add_atdir(char *, dev_t, ino_t, time_t, time_t); 276int get_atdir(dev_t, ino_t, time_t *, time_t *); 277int dir_start(void); 278void add_dir(char *, int, struct stat *, int); 279void proc_dir(void); 280u_int st_hash(char *, int, int); 281 282/* 283 * tar.c 284 */ 285extern int is_oldgnutar; 286int tar_endwr(void); 287off_t tar_endrd(void); 288int tar_trail(char *, int, int *); 289int tar_id(char *, int); 290int tar_opt(void); 291int tar_rd(ARCHD *, char *); 292int tar_wr(ARCHD *); 293int ustar_strd(void); 294int ustar_stwr(void); 295int ustar_id(char *, int); 296int ustar_rd(ARCHD *, char *); 297int ustar_wr(ARCHD *); 298int tar_gnutar_X_compat(const char *); 299 300/* 301 * tty_subs.c 302 */ 303int tty_init(void); 304void tty_prnt(const char *, ...) 305 __attribute__((format (printf, 1, 2))); 306int tty_read(char *, int); 307void tty_warn(int, const char *, ...) 308 __attribute__((format (printf, 2, 3))); 309void syswarn(int, int, const char *, ...) 310 __attribute__((format (printf, 3, 4))); 311