1 /* $OpenBSD: extern.h,v 1.57 2016/08/25 01:44:55 guenther Exp $ */
2 /* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */
5 * Copyright (c) 1992 Keith Muller.
6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved.
9 * This code is derived from software contributed to Berkeley by
10 * Keith Muller of the University of California, San Diego.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)extern.h 8.2 (Berkeley) 4/18/94
40 * External references from each source file
46 extern const char *arcname
;
47 extern const char *gzip_program
;
48 extern int force_one_volume
;
49 int ar_open(const char *);
50 void ar_close(int _in_sig
);
54 int ar_read(char *, int);
55 int ar_write(char *, int);
57 int ar_fow(off_t
, off_t
*);
84 int appnd_start(off_t
);
86 void pback(char *, int);
89 int wr_rdbuf(char *, int);
90 int rd_wrbuf(char *, int);
92 int wr_rdfile(ARCHD
*, int, off_t
*);
93 int rd_wrfile(ARCHD
*, int, off_t
*);
94 void cp_file(ARCHD
*, int, int);
101 int usrtb_start(void);
102 int grptb_start(void);
103 int uid_name(char *, uid_t
*);
104 int gid_name(char *, gid_t
*);
110 int cpio_trail(ARCHD
*, char *, int, int *);
111 int cpio_endwr(void);
112 int cpio_id(char *, int);
113 int cpio_rd(ARCHD
*, char *);
114 off_t
cpio_endrd(void);
116 int cpio_wr(ARCHD
*);
117 int vcpio_id(char *, int);
118 int crc_id(char *, int);
120 int vcpio_rd(ARCHD
*, char *);
121 off_t
vcpio_endrd(void);
123 int vcpio_wr(ARCHD
*);
124 int bcpio_id(char *, int);
125 int bcpio_rd(ARCHD
*, char *);
126 off_t
bcpio_endrd(void);
127 int bcpio_wr(ARCHD
*);
132 int file_creat(ARCHD
*);
133 void file_close(ARCHD
*, int);
134 int lnk_creat(ARCHD
*);
135 int cross_lnk(ARCHD
*);
136 int chk_same(ARCHD
*);
137 int node_creat(ARCHD
*);
138 int unlnk_exist(char *, int);
139 int chk_path(char *, uid_t
, gid_t
);
140 void set_ftime(const char *, const struct timespec
*,
141 const struct timespec
*, int);
142 void fset_ftime(const char *, int, const struct timespec
*,
143 const struct timespec
*, int);
144 int set_ids(char *, uid_t
, gid_t
);
145 int fset_ids(char *, int, uid_t
, gid_t
);
146 void set_pmode(char *, mode_t
);
147 void fset_pmode(char *, int, mode_t
);
148 int set_attr(const struct file_times
*, int _force_times
, mode_t
, int _do_mode
,
150 int file_write(int, char *, int, int *, int *, int, char *);
151 void file_flush(int, char *, int);
152 void rdfile_close(ARCHD
*, int *);
153 int set_crc(ARCHD
*, int);
158 int ftree_start(void);
159 int ftree_add(char *, int);
160 void ftree_sel(ARCHD
*);
161 void ftree_skipped_newer(ARCHD
*);
162 void ftree_chk(void);
163 int next_file(ARCHD
*);
168 void ls_list(ARCHD
*, time_t, FILE *);
169 void ls_tty(ARCHD
*);
170 void safe_print(const char *, FILE *);
171 u_long
asc_ul(char *, int, int);
172 int ul_asc(u_long
, char *, int, int);
173 unsigned long long asc_ull(char *, int, int);
174 int ull_asc(unsigned long long, char *, int, int);
175 size_t fieldcpy(char *, size_t, const char *, size_t);
180 int getoldopt(int, char **, const char *);
187 void options(int, char **);
188 OPLIST
* opt_next(void);
189 int opt_add(const char *);
191 extern char *chdname
;
197 int pat_add(char *, char *);
199 int pat_sel(ARCHD
*);
200 int pat_match(ARCHD
*);
201 int mod_name(ARCHD
*);
202 int set_dest(ARCHD
*, char *, int);
203 int has_dotdot(const char *);
234 extern int rmleadslash
;
239 extern enum op_mode
{ OP_PAX
, OP_TAR
, OP_CPIO
} op_mode
;
242 extern char *tempfile
;
243 extern char *tempbase
;
246 void sig_cleanup(int);
251 int sel_chk(ARCHD
*);
254 int trng_add(char *);
260 int chk_lnk(ARCHD
*);
261 void purg_lnk(ARCHD
*);
263 int ftime_start(void);
264 int chk_ftime(ARCHD
*);
265 int sltab_start(void);
266 int sltab_add_sym(const char *_path
, const char *_value
, mode_t _mode
);
267 int sltab_add_link(const char *, const struct stat
*);
268 void sltab_process(int _in_sig
);
269 int name_start(void);
270 int add_name(char *, int, char *);
271 void sub_name(char *, int *, size_t);
274 int add_dev(ARCHD
*);
275 int map_dev(ARCHD
*, u_long
, u_long
);
277 # define dev_start() 0
278 # define add_dev(x) 0
279 # define map_dev(x,y,z) 0
281 int atdir_start(void);
282 void atdir_end(void);
283 void add_atdir(char *, dev_t
, ino_t
, const struct timespec
*,
284 const struct timespec
*);
285 int do_atdir(const char *, dev_t
, ino_t
);
287 void add_dir(char *, struct stat
*, int);
288 void delete_dir(dev_t
, ino_t
);
289 void proc_dir(int _in_sig
);
290 u_int
st_hash(const char *, int, int);
295 extern int tar_nodir
;
296 extern char *gnu_name_string
, *gnu_link_string
;
298 off_t
tar_endrd(void);
299 int tar_trail(ARCHD
*, char *, int, int *);
300 int tar_id(char *, int);
302 int tar_rd(ARCHD
*, char *);
304 int ustar_strd(void);
305 int ustar_id(char *, int);
306 int ustar_rd(ARCHD
*, char *);
307 int ustar_wr(ARCHD
*);
313 void tty_prnt(const char *, ...)
314 __attribute__((nonnull(1), format(printf
, 1, 2)));
315 int tty_read(char *, int);
316 void paxwarn(int, const char *, ...)
317 __attribute__((nonnull(2), format(printf
, 2, 3)));
318 void syswarn(int, int, const char *, ...)
319 __attribute__((nonnull(3), format(printf
, 3, 4)));