1 /* $OpenBSD: extern.h,v 1.29 2004/11/29 16:23:22 otto 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
43 #include <sys/cdefs.h>
48 extern const char *arcname
;
49 extern const char *gzip_program
;
50 extern int force_one_volume
;
51 int ar_open(const char *);
56 int ar_read(char *, int);
57 int ar_write(char *, int);
59 int ar_fow(off_t
, off_t
*);
86 int appnd_start(off_t
);
88 void pback(char *, int);
91 int wr_rdbuf(char *, int);
92 int rd_wrbuf(char *, int);
94 int wr_rdfile(ARCHD
*, int, off_t
*);
95 int rd_wrfile(ARCHD
*, int, off_t
*);
96 void cp_file(ARCHD
*, int, int);
103 int uidtb_start(void);
104 int gidtb_start(void);
105 int usrtb_start(void);
106 int grptb_start(void);
107 char * name_uid(uid_t
, int);
108 char * name_gid(gid_t
, int);
109 int uid_name(char *, uid_t
*);
110 int gid_name(char *, gid_t
*);
116 int cpio_trail(ARCHD
*, char *, int, int *);
117 int cpio_endwr(void);
118 int cpio_id(char *, int);
119 int cpio_rd(ARCHD
*, char *);
120 off_t
cpio_endrd(void);
122 int cpio_wr(ARCHD
*);
123 int vcpio_id(char *, int);
124 int crc_id(char *, int);
126 int vcpio_rd(ARCHD
*, char *);
127 off_t
vcpio_endrd(void);
129 int vcpio_wr(ARCHD
*);
130 int bcpio_id(char *, int);
131 int bcpio_rd(ARCHD
*, char *);
132 off_t
bcpio_endrd(void);
133 int bcpio_wr(ARCHD
*);
138 extern char *gnu_name_string
, *gnu_link_string
;
139 int file_creat(ARCHD
*);
140 void file_close(ARCHD
*, int);
141 int lnk_creat(ARCHD
*);
142 int cross_lnk(ARCHD
*);
143 int chk_same(ARCHD
*);
144 int node_creat(ARCHD
*);
145 int unlnk_exist(char *, int);
146 int chk_path(char *, uid_t
, gid_t
, char **);
147 void set_ftime(char *fnm
, time_t mtime
, time_t atime
, int frc
);
148 int set_ids(char *, uid_t
, gid_t
);
149 int set_lids(char *, uid_t
, gid_t
);
150 void set_pmode(char *, mode_t
);
151 int file_write(int, char *, int, int *, int *, int, char *);
152 void file_flush(int, char *, int);
153 void rdfile_close(ARCHD
*, int *);
154 int set_crc(ARCHD
*, int);
159 int ftree_start(void);
160 int ftree_add(char *, int);
161 void ftree_sel(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);
174 u_quad_t
asc_uqd(char *, int, int);
175 int uqd_asc(u_quad_t
, char *, int, int);
181 int getoldopt(int, char **, const char *);
188 void options(int, char **);
189 OPLIST
* opt_next(void);
190 int opt_add(const char *);
192 int pax_format_opt_add (char *);
194 extern char *chdname
;
200 int pat_add(char *, char *);
202 int pat_sel(ARCHD
*);
203 int pat_match(ARCHD
*);
204 int mod_name(ARCHD
*);
205 int set_dest(ARCHD
*, char *, int);
235 extern int rmleadslash
;
239 extern char *ltmfrmt
;
242 extern char *tempfile
;
243 extern char *tempbase
;
245 int main(int, char **);
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 name_start(void);
266 int add_name(char *, int, char *);
267 void sub_name(char *, int *, size_t);
269 int add_dev(ARCHD
*);
270 int map_dev(ARCHD
*, u_long
, u_long
);
271 int atdir_start(void);
272 void atdir_end(void);
273 void add_atdir(char *, dev_t
, ino_t
, time_t, time_t);
274 int get_atdir(dev_t
, ino_t
, time_t *, time_t *);
276 void add_dir(char *, struct stat
*, int);
278 u_int
st_hash(char *, int, int);
283 extern char *gnu_hack_string
;
285 off_t
tar_endrd(void);
286 int tar_trail(ARCHD
*, char *, int, int *);
287 int tar_id(char *, int);
289 int tar_rd(ARCHD
*, char *);
291 int ustar_strd(void);
292 int ustar_stwr(void);
293 int ustar_id(char *, int);
294 int ustar_rd(ARCHD
*, char *);
295 int ustar_wr(ARCHD
*);
300 extern char *header_name_g
;
301 extern int pax_read_or_list_mode
;
302 #define PAX_INVALID_ACTION_BYPASS 1
303 #define PAX_INVALID_ACTION_RENAME 2
304 #define PAX_INVALID_ACTION_UTF8 3
305 #define PAX_INVALID_ACTION_WRITE 4
306 extern int want_linkdata
;
307 extern int pax_invalid_action
;
308 extern char * pax_list_opt_format
;
309 extern char * pax_invalid_action_write_path
;
310 extern char * pax_invalid_action_write_cwd
;
311 void pax_format_list_output(ARCHD
*, time_t, FILE *, int);
312 void cleanup_pax_invalid_action(void);
313 void record_pax_invalid_action_results(ARCHD
*, char *);
314 int perform_pax_invalid_action(ARCHD
*, int);
315 void adjust_copy_for_pax_options(ARCHD
*);
320 int pax_id(char *, int);
321 int pax_rd(ARCHD
*, char *);
328 void tty_prnt(const char *, ...);
329 int tty_read(char *, int);
330 void paxwarn(int, const char *, ...);
331 void syswarn(int, int, const char *, ...);