| 1 |
/** $MirOS: src/bin/pax/extern.h,v 1.9 2007/02/17 04:52:40 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 |
const char *name_uid(uid_t, int); |
| 112 |
const char *name_gid(gid_t, int); |
| 113 |
int uid_name(const char *, uid_t *); |
| 114 |
int gid_name(const 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 |
int set_ids(char *, uid_t, gid_t); |
| 156 |
int fset_ids(char *, int, uid_t, gid_t); |
| 157 |
int set_lids(char *, uid_t, gid_t); |
| 158 |
void set_pmode(char *, mode_t); |
| 159 |
void fset_pmode(char *, int, mode_t); |
| 160 |
int file_write(int, char *, int, int *, int *, int, char *); |
| 161 |
void file_flush(int, char *, int); |
| 162 |
void rdfile_close(ARCHD *, int *); |
| 163 |
int set_crc(ARCHD *, int); |
| 164 |
|
| 165 |
/* |
| 166 |
* ftree.c |
| 167 |
*/ |
| 168 |
int ftree_start(void); |
| 169 |
int ftree_add(char *, int); |
| 170 |
void ftree_sel(ARCHD *); |
| 171 |
void ftree_chk(void); |
| 172 |
int next_file(ARCHD *); |
| 173 |
|
| 174 |
/* |
| 175 |
* gen_subs.c |
| 176 |
*/ |
| 177 |
void ls_list(ARCHD *, time_t, FILE *); |
| 178 |
void ls_tty(ARCHD *); |
| 179 |
void safe_print(const char *, FILE *); |
| 180 |
u_long asc_ul(char *, int, int); |
| 181 |
int ul_asc(u_long, char *, int, int); |
| 182 |
#ifndef LONG_OFF_T |
| 183 |
u_quad_t asc_uqd(char *, int, int); |
| 184 |
int uqd_asc(u_quad_t, char *, int, int); |
| 185 |
#endif |
| 186 |
size_t fieldcpy(char *, size_t, const char *, size_t); |
| 187 |
|
| 188 |
/* |
| 189 |
* getoldopt.c |
| 190 |
*/ |
| 191 |
int getoldopt(int, char **, const char *); |
| 192 |
|
| 193 |
/* |
| 194 |
* options.c |
| 195 |
*/ |
| 196 |
extern FSUB fsub[]; |
| 197 |
extern int ford[]; |
| 198 |
void options(int, char **); |
| 199 |
OPLIST * opt_next(void); |
| 200 |
int opt_add(const char *); |
| 201 |
int bad_opt(void); |
| 202 |
char *chdname; |
| 203 |
|
| 204 |
/* |
| 205 |
* pat_rep.c |
| 206 |
*/ |
| 207 |
int rep_add(char *); |
| 208 |
int pat_add(char *, char *); |
| 209 |
void pat_chk(void); |
| 210 |
int pat_sel(ARCHD *); |
| 211 |
int pat_match(ARCHD *); |
| 212 |
int mod_name(ARCHD *); |
| 213 |
int set_dest(ARCHD *, char *, int); |
| 214 |
|
| 215 |
/* |
| 216 |
* pax.c |
| 217 |
*/ |
| 218 |
extern int act; |
| 219 |
extern FSUB *frmt; |
| 220 |
extern int cflag; |
| 221 |
extern int cwdfd; |
| 222 |
extern int dflag; |
| 223 |
extern int iflag; |
| 224 |
extern int kflag; |
| 225 |
extern int lflag; |
| 226 |
extern int nflag; |
| 227 |
extern int tflag; |
| 228 |
extern int uflag; |
| 229 |
extern int vflag; |
| 230 |
extern int Dflag; |
| 231 |
extern int Hflag; |
| 232 |
extern int Lflag; |
| 233 |
extern int Xflag; |
| 234 |
extern int Yflag; |
| 235 |
extern int Zflag; |
| 236 |
extern int zeroflag; |
| 237 |
extern int vfpart; |
| 238 |
extern int patime; |
| 239 |
extern int pmtime; |
| 240 |
extern int nodirs; |
| 241 |
extern int pmode; |
| 242 |
extern int pids; |
| 243 |
extern int rmleadslash; |
| 244 |
extern int exit_val; |
| 245 |
extern int docrc; |
| 246 |
extern char *dirptr; |
| 247 |
extern char *ltmfrmt; |
| 248 |
extern const char *argv0; |
| 249 |
extern FILE *listf; |
| 250 |
extern char *tempfile; |
| 251 |
extern char *tempbase; |
| 252 |
|
| 253 |
int main(int, char **); |
| 254 |
|
| 255 |
/* |
| 256 |
* sel_subs.c |
| 257 |
*/ |
| 258 |
int sel_chk(ARCHD *); |
| 259 |
int grp_add(char *); |
| 260 |
int usr_add(char *); |
| 261 |
int trng_add(char *); |
| 262 |
|
| 263 |
/* |
| 264 |
* tables.c |
| 265 |
*/ |
| 266 |
int lnk_start(void); |
| 267 |
int chk_lnk(ARCHD *); |
| 268 |
void purg_lnk(ARCHD *); |
| 269 |
void lnk_end(void); |
| 270 |
int ftime_start(void); |
| 271 |
int chk_ftime(ARCHD *); |
| 272 |
int name_start(void); |
| 273 |
int add_name(char *, int, char *); |
| 274 |
void sub_name(char *, int *, size_t); |
| 275 |
int dev_start(void); |
| 276 |
int add_dev(ARCHD *); |
| 277 |
int map_dev(ARCHD *, u_long, u_long); |
| 278 |
int atdir_start(void); |
| 279 |
void atdir_end(void); |
| 280 |
void add_atdir(char *, dev_t, ino_t, time_t, time_t); |
| 281 |
int get_atdir(dev_t, ino_t, time_t *, time_t *); |
| 282 |
int dir_start(void); |
| 283 |
void add_dir(char *, struct stat *, int); |
| 284 |
void proc_dir(void); |
| 285 |
u_int st_hash(const char *, int, int); |
| 286 |
int flnk_start(void); |
| 287 |
int chk_flnk(ARCHD *); |
| 288 |
|
| 289 |
/* |
| 290 |
* tar.c |
| 291 |
*/ |
| 292 |
extern char *gnu_hack_string; |
| 293 |
int tar_endwr(void); |
| 294 |
off_t tar_endrd(void); |
| 295 |
int tar_trail(ARCHD *, char *, int, int *); |
| 296 |
int tar_id(char *, int); |
| 297 |
int tar_opt(void); |
| 298 |
int tar_rd(ARCHD *, char *); |
| 299 |
int tar_wr(ARCHD *); |
| 300 |
int ustar_strd(void); |
| 301 |
int ustar_stwr(void); |
| 302 |
int ustar_id(char *, int); |
| 303 |
int ustar_rd(ARCHD *, char *); |
| 304 |
int ustar_wr(ARCHD *); |
| 305 |
|
| 306 |
/* |
| 307 |
* tty_subs.c |
| 308 |
*/ |
| 309 |
int tty_init(void); |
| 310 |
void tty_prnt(const char *, ...) |
| 311 |
__attribute__((format (printf, 1, 2))); |
| 312 |
int tty_read(char *, int); |
| 313 |
void paxwarn(int, const char *, ...) |
| 314 |
__attribute__((format (printf, 2, 3))); |
| 315 |
void syswarn(int, int, const char *, ...) |
| 316 |
__attribute__((format (printf, 3, 4))); |