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