1 /* $OpenBSD: extern.h,v 1.33 2008/05/06 06:54:28 henning 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
39 #ifndef _PAX_EXTERN_H_
40 #define _PAX_EXTERN_H_
43 * External references from each source file
46 #include <sys/cdefs.h>
51 extern const char *arcname
;
52 extern const char *gzip_program
;
53 extern int force_one_volume
;
54 int ar_open(const char *);
59 int ar_read(char *, int);
60 int ar_write(char *, int);
62 int ar_fow(off_t
, off_t
*);
71 int dochdir(const char *);
92 int appnd_start(off_t
);
94 void pback(char *, int);
97 int wr_rdbuf(char *, int);
98 int rd_wrbuf(char *, int);
100 int wr_rdfile(ARCHD
*, int, off_t
*);
101 int rd_wrfile(ARCHD
*, int, off_t
*);
102 void cp_file(ARCHD
*, int, int);
109 int uidtb_start(void);
110 int gidtb_start(void);
111 int usrtb_start(void);
112 int grptb_start(void);
113 char * name_uid(uid_t
, int);
114 char * name_gid(gid_t
, int);
115 int uid_name(char *, uid_t
*);
116 int gid_name(char *, gid_t
*);
122 int cpio_trail(ARCHD
*, char *, int, int *);
123 int cpio_endwr(void);
124 int cpio_id(char *, int);
125 int cpio_rd(ARCHD
*, char *);
126 off_t
cpio_endrd(void);
128 int cpio_wr(ARCHD
*);
129 int vcpio_id(char *, int);
130 int crc_id(char *, int);
132 int vcpio_rd(ARCHD
*, char *);
133 off_t
vcpio_endrd(void);
135 int vcpio_wr(ARCHD
*);
136 int bcpio_id(char *, int);
137 int bcpio_rd(ARCHD
*, char *);
138 off_t
bcpio_endrd(void);
139 int bcpio_wr(ARCHD
*);
144 extern char *gnu_name_string
, *gnu_link_string
;
145 int file_creat(ARCHD
*);
146 void file_close(ARCHD
*, int);
147 int lnk_creat(ARCHD
*);
148 int cross_lnk(ARCHD
*);
149 int chk_same(ARCHD
*);
150 int node_creat(ARCHD
*);
151 int unlnk_exist(char *, int);
152 int chk_path(char *, uid_t
, gid_t
, char **);
153 void set_ftime(char *fnm
, time_t mtime
, time_t atime
, int frc
);
154 void fset_ftime(char *fnm
, int, 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);
168 int ftree_start(void);
169 int ftree_add(char *, int);
170 void ftree_sel(ARCHD
*);
171 void ftree_notsel(void);
172 void ftree_skipped_newer(ARCHD
*);
173 void ftree_chk(void);
174 int next_file(ARCHD
*);
179 void ls_list(ARCHD
*, time_t, FILE *);
180 void ls_tty(ARCHD
*);
181 void safe_print(const char *, FILE *);
182 u_long
asc_ul(char *, int, int);
183 int ul_asc(u_long
, char *, int, int);
185 u_quad_t
asc_uqd(char *, int, int);
186 int uqd_asc(u_quad_t
, char *, int, int);
188 size_t fieldcpy(char *, size_t, const char *, size_t);
193 int getoldopt(int, char **, const char *);
198 extern const FSUB fsub
[];
200 void options(int, char **);
201 OPLIST
* opt_next(void);
202 int opt_add(const char *);
204 int pax_format_opt_add(char *);
206 extern char *chdname
;
212 int pat_add(char *, char *);
214 int pat_sel(ARCHD
*);
215 int pat_match(ARCHD
*);
216 int mod_name(ARCHD
*);
217 int set_dest(ARCHD
*, char *, int);
223 extern const FSUB
*frmt
;
247 extern int rmleadslash
;
252 extern char *ltmfrmt
;
255 extern char *tempfile
;
256 extern char *tempbase
;
259 int main(int, char **);
260 void sig_cleanup(int);
265 int sel_chk(ARCHD
*);
268 int trng_add(char *);
274 int chk_lnk(ARCHD
*);
275 void purg_lnk(ARCHD
*);
277 int ftime_start(void);
278 int chk_ftime(ARCHD
*);
279 int name_start(void);
280 int add_name(char *, int, char *);
281 void sub_name(char *, int *, size_t);
283 int add_dev(ARCHD
*);
284 int map_dev(ARCHD
*, u_long
, u_long
);
285 int atdir_start(void);
286 void atdir_end(void);
287 void add_atdir(char *, dev_t
, ino_t
, time_t, time_t);
288 int get_atdir(dev_t
, ino_t
, time_t *, time_t *);
290 void add_dir(char *, size_t, struct stat
*, int);
292 u_int
st_hash(char *, int, int);
297 extern char *gnu_hack_string
;
299 off_t
tar_endrd(void);
300 int tar_trail(ARCHD
*, char *, int, int *);
301 int tar_id(char *, int);
303 int tar_rd(ARCHD
*, char *);
305 int ustar_strd(void);
306 int ustar_stwr(void);
307 int ustar_id(char *, int);
308 int ustar_rd(ARCHD
*, char *);
309 int ustar_wr(ARCHD
*);
314 extern char *header_name_g
;
315 extern int pax_read_or_list_mode
;
316 #define PAX_INVALID_ACTION_BYPASS 1
317 #define PAX_INVALID_ACTION_RENAME 2
318 #define PAX_INVALID_ACTION_UTF8 3
319 #define PAX_INVALID_ACTION_WRITE 4
320 extern int want_linkdata
;
321 extern int pax_invalid_action
;
322 extern char * pax_list_opt_format
;
323 extern char * pax_invalid_action_write_path
;
324 extern char * pax_invalid_action_write_cwd
;
325 void pax_format_list_output(ARCHD
*, time_t, FILE *, int);
326 void cleanup_pax_invalid_action(void);
327 void record_pax_invalid_action_results(ARCHD
*, char *);
328 int perform_pax_invalid_action(ARCHD
*, int);
329 void adjust_copy_for_pax_options(ARCHD
*);
334 int pax_id(char *, int);
335 int pax_rd(ARCHD
*, char *);
342 void tty_prnt(const char *, ...);
343 int tty_read(char *, int);
344 void paxwarn(int, const char *, ...);
345 void syswarn(int, int, const char *, ...);
347 #endif /* _PAX_EXTERN_H_ */