| 1 | /** $MirOS: src/bin/pax/extern.h,v 1.19 2012/02/16 17:27:31 tg Exp $ */
|
|---|
| 2 | /* $OpenBSD: extern.h,v 1.34 2010/12/02 04:08:27 tedu 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.c
|
|---|
| 51 | */
|
|---|
| 52 | int uar_stwr(int);
|
|---|
| 53 | int uar_ismagic(char *);
|
|---|
| 54 | int uar_id(char *, int) __attribute__((__noreturn__));
|
|---|
| 55 | int uar_rd(ARCHD *, char *);
|
|---|
| 56 | int uar_wr(ARCHD *);
|
|---|
| 57 | int uar_wr_data(ARCHD *, int, off_t *);
|
|---|
| 58 | off_t uar_endrd(void);
|
|---|
| 59 | int uar_trail(ARCHD *, char *, int, int *) __attribute__((__noreturn__));
|
|---|
| 60 |
|
|---|
| 61 | /*
|
|---|
| 62 | * ar_io.c
|
|---|
| 63 | */
|
|---|
| 64 | extern const char *arcname;
|
|---|
| 65 | extern const char *compress_program;
|
|---|
| 66 | extern int force_one_volume;
|
|---|
| 67 | int ar_open(const char *);
|
|---|
| 68 | void ar_close(void);
|
|---|
| 69 | void ar_drain(void);
|
|---|
| 70 | int ar_set_wr(void);
|
|---|
| 71 | int ar_app_ok(void);
|
|---|
| 72 | int ar_read(char *, int);
|
|---|
| 73 | int ar_write(char *, int);
|
|---|
| 74 | int ar_rdsync(void);
|
|---|
| 75 | int ar_fow(off_t, off_t *);
|
|---|
| 76 | int ar_rev(off_t );
|
|---|
| 77 | int ar_next(void);
|
|---|
| 78 | extern int ar_do_keepopen;
|
|---|
| 79 | int ar_next_keepopen(void);
|
|---|
| 80 |
|
|---|
| 81 | /*
|
|---|
| 82 | * ar_subs.c
|
|---|
| 83 | */
|
|---|
| 84 | extern u_long flcnt;
|
|---|
| 85 | void list(void);
|
|---|
| 86 | void extract(void);
|
|---|
| 87 | void append(void);
|
|---|
| 88 | void archive(void);
|
|---|
| 89 | void copy(void);
|
|---|
| 90 |
|
|---|
| 91 | /*
|
|---|
| 92 | * buf_subs.c
|
|---|
| 93 | */
|
|---|
| 94 | extern int blksz;
|
|---|
| 95 | extern int wrblksz;
|
|---|
| 96 | extern int maxflt;
|
|---|
| 97 | extern int rdblksz;
|
|---|
| 98 | extern off_t wrlimit;
|
|---|
| 99 | extern off_t rdcnt;
|
|---|
| 100 | extern off_t wrcnt;
|
|---|
| 101 | int wr_start(void);
|
|---|
| 102 | int rd_start(void);
|
|---|
| 103 | void cp_start(void);
|
|---|
| 104 | int appnd_start(off_t);
|
|---|
| 105 | int rd_sync(void);
|
|---|
| 106 | void pback(char *, int);
|
|---|
| 107 | int rd_skip(off_t);
|
|---|
| 108 | void wr_fin(void);
|
|---|
| 109 | int wr_rdbuf(char *, int);
|
|---|
| 110 | int rd_wrbuf(char *, int);
|
|---|
| 111 | int wr_skip(off_t);
|
|---|
| 112 | int wr_rdfile(ARCHD *, int, off_t *);
|
|---|
| 113 | int rd_wrfile(ARCHD *, int, off_t *);
|
|---|
| 114 | void cp_file(ARCHD *, int, int);
|
|---|
| 115 | int buf_fill(void);
|
|---|
| 116 | int buf_fill_internal(int);
|
|---|
| 117 | int buf_flush(int);
|
|---|
| 118 |
|
|---|
| 119 | /*
|
|---|
| 120 | * cache.c
|
|---|
| 121 | */
|
|---|
| 122 | int uidtb_start(void);
|
|---|
| 123 | int gidtb_start(void);
|
|---|
| 124 | int usrtb_start(void);
|
|---|
| 125 | int grptb_start(void);
|
|---|
| 126 | const char *name_uid(uid_t, int);
|
|---|
| 127 | const char *name_gid(gid_t, int);
|
|---|
| 128 | int uid_name(const char *, uid_t *);
|
|---|
| 129 | int gid_name(const char *, gid_t *);
|
|---|
| 130 |
|
|---|
| 131 | /*
|
|---|
| 132 | * cpio.c
|
|---|
| 133 | */
|
|---|
| 134 | int cpio_strd(void);
|
|---|
| 135 | int cpio_trail(ARCHD *, char *, int, int *);
|
|---|
| 136 | int cpio_endwr(void);
|
|---|
| 137 | int cpio_id(char *, int);
|
|---|
| 138 | int cpio_rd(ARCHD *, char *);
|
|---|
| 139 | off_t cpio_endrd(void);
|
|---|
| 140 | int cpio_stwr(int);
|
|---|
| 141 | int dist_stwr(int);
|
|---|
| 142 | int cpio_wr(ARCHD *);
|
|---|
| 143 | int vcpio_id(char *, int);
|
|---|
| 144 | int crc_id(char *, int);
|
|---|
| 145 | int crc_strd(void);
|
|---|
| 146 | int vcpio_rd(ARCHD *, char *);
|
|---|
| 147 | off_t vcpio_endrd(void);
|
|---|
| 148 | int crc_stwr(int);
|
|---|
| 149 | int v4root_stwr(int);
|
|---|
| 150 | int v4norm_stwr(int);
|
|---|
| 151 | int vcpio_wr(ARCHD *);
|
|---|
| 152 | int bcpio_id(char *, int);
|
|---|
| 153 | int bcpio_rd(ARCHD *, char *);
|
|---|
| 154 | off_t bcpio_endrd(void);
|
|---|
| 155 | int bcpio_wr(ARCHD *);
|
|---|
| 156 |
|
|---|
| 157 | /*
|
|---|
| 158 | * file_subs.c
|
|---|
| 159 | */
|
|---|
| 160 | extern char *gnu_name_string, *gnu_link_string;
|
|---|
| 161 | int file_creat(ARCHD *);
|
|---|
| 162 | void file_close(ARCHD *, int);
|
|---|
| 163 | int lnk_creat(ARCHD *, int *);
|
|---|
| 164 | int cross_lnk(ARCHD *);
|
|---|
| 165 | int chk_same(ARCHD *);
|
|---|
| 166 | int node_creat(ARCHD *);
|
|---|
| 167 | int unlnk_exist(char *, int);
|
|---|
| 168 | int chk_path(char *, uid_t, gid_t);
|
|---|
| 169 | void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
|
|---|
| 170 | int set_ids(char *, uid_t, gid_t);
|
|---|
| 171 | int fset_ids(char *, int, uid_t, gid_t);
|
|---|
| 172 | int set_lids(char *, uid_t, gid_t);
|
|---|
| 173 | void set_pmode(char *, mode_t);
|
|---|
| 174 | void fset_pmode(char *, int, mode_t);
|
|---|
| 175 | int file_write(int, char *, int, int *, int *, int, char *);
|
|---|
| 176 | void file_flush(int, char *, int);
|
|---|
| 177 | void rdfile_close(ARCHD *, int *);
|
|---|
| 178 | int set_crc(ARCHD *, int);
|
|---|
| 179 |
|
|---|
| 180 | /*
|
|---|
| 181 | * ftree.c
|
|---|
| 182 | */
|
|---|
| 183 | int ftree_start(void);
|
|---|
| 184 | int ftree_add(char *, int);
|
|---|
| 185 | void ftree_sel(ARCHD *);
|
|---|
| 186 | void ftree_skipped_newer(void);
|
|---|
| 187 | void ftree_chk(void);
|
|---|
| 188 | int next_file(ARCHD *);
|
|---|
| 189 |
|
|---|
| 190 | /*
|
|---|
| 191 | * gen_subs.c
|
|---|
| 192 | */
|
|---|
| 193 | void ls_list(ARCHD *, time_t, FILE *);
|
|---|
| 194 | void ls_tty(ARCHD *);
|
|---|
| 195 | void safe_print(const char *, FILE *);
|
|---|
| 196 | u_long asc_ul(char *, int, int);
|
|---|
| 197 | int ul_asc(u_long, char *, int, int);
|
|---|
| 198 | ot_type asc_ot(char *, int, int);
|
|---|
| 199 | int ot_asc(ot_type, char *, int, int);
|
|---|
| 200 | size_t fieldcpy(char *, size_t, const char *, size_t);
|
|---|
| 201 |
|
|---|
| 202 | /*
|
|---|
| 203 | * getoldopt.c
|
|---|
| 204 | */
|
|---|
| 205 | int getoldopt(int, char **, const char *);
|
|---|
| 206 |
|
|---|
| 207 | /*
|
|---|
| 208 | * options.c
|
|---|
| 209 | */
|
|---|
| 210 | extern FSUB fsub[];
|
|---|
| 211 | extern int ford[];
|
|---|
| 212 | void options(int, char **);
|
|---|
| 213 | OPLIST * opt_next(void);
|
|---|
| 214 | int opt_add(const char *);
|
|---|
| 215 | int bad_opt(void);
|
|---|
| 216 | char *chdname;
|
|---|
| 217 |
|
|---|
| 218 | /*
|
|---|
| 219 | * pat_rep.c
|
|---|
| 220 | */
|
|---|
| 221 | int rep_add(char *);
|
|---|
| 222 | int pat_add(char *, char *);
|
|---|
| 223 | void pat_chk(void);
|
|---|
| 224 | int pat_sel(ARCHD *);
|
|---|
| 225 | int pat_match(ARCHD *);
|
|---|
| 226 | int mod_name(ARCHD *);
|
|---|
| 227 | int set_dest(ARCHD *, char *, int);
|
|---|
| 228 |
|
|---|
| 229 | /*
|
|---|
| 230 | * pax.c
|
|---|
| 231 | */
|
|---|
| 232 | extern int act;
|
|---|
| 233 | extern FSUB *frmt;
|
|---|
| 234 | extern int cflag;
|
|---|
| 235 | extern int cwdfd;
|
|---|
| 236 | extern int dflag;
|
|---|
| 237 | extern int iflag;
|
|---|
| 238 | extern int kflag;
|
|---|
| 239 | extern int lflag;
|
|---|
| 240 | extern int nflag;
|
|---|
| 241 | extern int tflag;
|
|---|
| 242 | extern int uflag;
|
|---|
| 243 | extern int Vflag;
|
|---|
| 244 | extern int vflag;
|
|---|
| 245 | extern int Dflag;
|
|---|
| 246 | extern int Hflag;
|
|---|
| 247 | extern int Lflag;
|
|---|
| 248 | extern int Xflag;
|
|---|
| 249 | extern int Yflag;
|
|---|
| 250 | extern int Zflag;
|
|---|
| 251 | extern int zeroflag;
|
|---|
| 252 | extern int vfpart;
|
|---|
| 253 | extern int patime;
|
|---|
| 254 | extern int pmtime;
|
|---|
| 255 | extern int nodirs;
|
|---|
| 256 | extern int pmode;
|
|---|
| 257 | extern int pids;
|
|---|
| 258 | extern int rmleadslash;
|
|---|
| 259 | extern int exit_val;
|
|---|
| 260 | extern int docrc;
|
|---|
| 261 | extern char *dirptr;
|
|---|
| 262 | extern char *ltmfrmt;
|
|---|
| 263 | extern const char *argv0;
|
|---|
| 264 | extern FILE *listf;
|
|---|
| 265 | extern char *tempfile;
|
|---|
| 266 | extern char *tempbase;
|
|---|
| 267 | extern int havechd;
|
|---|
| 268 |
|
|---|
| 269 | int main(int, char **);
|
|---|
| 270 |
|
|---|
| 271 | /*
|
|---|
| 272 | * sel_subs.c
|
|---|
| 273 | */
|
|---|
| 274 | int sel_chk(ARCHD *);
|
|---|
| 275 | int grp_add(char *);
|
|---|
| 276 | int usr_add(char *);
|
|---|
| 277 | int trng_add(char *);
|
|---|
| 278 |
|
|---|
| 279 | /*
|
|---|
| 280 | * tables.c
|
|---|
| 281 | */
|
|---|
| 282 | int lnk_start(void);
|
|---|
| 283 | int chk_lnk(ARCHD *);
|
|---|
| 284 | void purg_lnk(ARCHD *);
|
|---|
| 285 | void lnk_end(void);
|
|---|
| 286 | int ftime_start(void);
|
|---|
| 287 | int chk_ftime(ARCHD *);
|
|---|
| 288 | int name_start(void);
|
|---|
| 289 | int add_name(char *, int, char *);
|
|---|
| 290 | void sub_name(char *, int *, size_t);
|
|---|
| 291 | int dev_start(void);
|
|---|
| 292 | int add_dev(ARCHD *);
|
|---|
| 293 | int map_dev(ARCHD *, u_long, u_long);
|
|---|
| 294 | int atdir_start(void);
|
|---|
| 295 | void atdir_end(void);
|
|---|
| 296 | void add_atdir(char *, dev_t, ino_t, time_t, time_t);
|
|---|
| 297 | int get_atdir(dev_t, ino_t, time_t *, time_t *);
|
|---|
| 298 | int dir_start(void);
|
|---|
| 299 | void add_dir(char *, struct stat *, int);
|
|---|
| 300 | void proc_dir(void);
|
|---|
| 301 | u_int st_hash(const char *, int, int);
|
|---|
| 302 | int flnk_start(void);
|
|---|
| 303 | int chk_flnk(ARCHD *);
|
|---|
| 304 |
|
|---|
| 305 | /*
|
|---|
| 306 | * tar.c
|
|---|
| 307 | */
|
|---|
| 308 | extern char *gnu_hack_string;
|
|---|
| 309 | int tar_endwr(void);
|
|---|
| 310 | off_t tar_endrd(void);
|
|---|
| 311 | int tar_trail(ARCHD *, char *, int, int *);
|
|---|
| 312 | int tar_id(char *, int);
|
|---|
| 313 | int tar_opt(void);
|
|---|
| 314 | int tar_rd(ARCHD *, char *);
|
|---|
| 315 | int tar_wr(ARCHD *);
|
|---|
| 316 | int ustar_strd(void);
|
|---|
| 317 | int ustar_stwr(int);
|
|---|
| 318 | int ustar_id(char *, int);
|
|---|
| 319 | int ustar_rd(ARCHD *, char *);
|
|---|
| 320 | int ustar_wr(ARCHD *);
|
|---|
| 321 |
|
|---|
| 322 | /*
|
|---|
| 323 | * tty_subs.c
|
|---|
| 324 | */
|
|---|
| 325 | int tty_init(void);
|
|---|
| 326 | void tty_prnt(const char *, ...)
|
|---|
| 327 | __attribute__((__format__ (__printf__, 1, 2)));
|
|---|
| 328 | int tty_read(char *, int);
|
|---|
| 329 | void paxwarn(int, const char *, ...)
|
|---|
| 330 | __attribute__((__format__ (__printf__, 2, 3)));
|
|---|
| 331 | void syswarn(int, int, const char *, ...)
|
|---|
| 332 | __attribute__((__format__ (__printf__, 3, 4)));
|
|---|
| 333 |
|
|---|
| 334 | /*
|
|---|
| 335 | * part of the OS
|
|---|
| 336 | */
|
|---|
| 337 | #ifdef USE_LIBBSD
|
|---|
| 338 | size_t strlcat(char *, const char *, size_t);
|
|---|
| 339 | size_t strlcpy(char *, const char *, size_t);
|
|---|
| 340 | #endif
|
|---|