1 /* $NetBSD: extern.h,v 1.59 2012/08/09 08:09:21 christos Exp $ */
4 * Copyright (c) 1992 Keith Muller.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
8 * This code is derived from software contributed to Berkeley by
9 * Keith Muller of the University of California, San Diego.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * @(#)extern.h 8.2 (Berkeley) 4/18/94
39 * External references from each source file
42 #include <sys/cdefs.h>
48 extern const char *arcname
;
50 extern const char *gzip_program
;
51 extern time_t starttime
;
52 extern int force_one_volume
;
54 extern int forcelocal
;
57 int ar_open(const char *);
63 int read_with_restart(int, void *, int);
64 int write_with_restart(int, void *, int);
66 #define read_with_restart read
67 #define write_with_restart write
69 int xread(int, void *, int);
70 int xwrite(int, void *, int);
71 int ar_read(char *, int);
72 int ar_write(char *, int);
74 int ar_fow(off_t
, off_t
*);
78 int ar_dochdir(const char *);
86 int dochdir(const char *);
88 int domkdir(const char *, mode_t
);
102 extern off_t wrlimit
;
108 int appnd_start(off_t
);
110 void pback(char *, int);
113 int wr_rdbuf(char *, int);
114 int rd_wrbuf(char *, int);
116 int wr_rdfile(ARCHD
*, int, off_t
*);
117 int rd_wrfile(ARCHD
*, int, off_t
*);
118 void cp_file(ARCHD
*, int, int);
125 extern int cpio_swp_head
;
127 int cpio_subtrail(ARCHD
*);
128 int cpio_endwr(void);
129 int cpio_id(char *, int);
130 int cpio_rd(ARCHD
*, char *);
131 off_t
cpio_endrd(void);
133 int cpio_wr(ARCHD
*);
134 int vcpio_id(char *, int);
135 int crc_id(char *, int);
137 int vcpio_rd(ARCHD
*, char *);
138 off_t
vcpio_endrd(void);
140 int vcpio_wr(ARCHD
*);
141 int bcpio_id(char *, int);
142 int bcpio_rd(ARCHD
*, char *);
143 off_t
bcpio_endrd(void);
144 int bcpio_wr(ARCHD
*);
149 extern char *gnu_name_string
, *gnu_link_string
;
150 extern size_t gnu_name_length
, gnu_link_length
;
151 extern char *xtmp_name
;
152 int file_creat(ARCHD
*, int);
153 void file_close(ARCHD
*, int);
154 int lnk_creat(ARCHD
*, int *);
155 int cross_lnk(ARCHD
*);
156 int chk_same(ARCHD
*);
157 int node_creat(ARCHD
*);
158 int unlnk_exist(char *, int);
159 int chk_path(char *, uid_t
, gid_t
);
160 void set_ftime(char *fnm
, time_t mtime
, time_t atime
, int frc
, int slk
);
161 int set_ids(char *, uid_t
, gid_t
);
162 void set_pmode(char *, mode_t
);
163 void set_chflags(char *fnm
, u_int32_t flags
);
164 int file_write(int, char *, int, int *, int *, int, char *);
165 void file_flush(int, char *, int);
166 void rdfile_close(ARCHD
*, int *);
167 int set_crc(ARCHD
*, int);
172 int ftree_start(void);
173 int ftree_add(char *, int);
174 void ftree_sel(ARCHD
*);
175 void ftree_chk(void);
176 int next_file(ARCHD
*);
181 void ls_list(ARCHD
*, time_t, FILE *);
182 void ls_tty(ARCHD
*);
183 void safe_print(const char *, FILE *);
184 uint32_t asc_u32(char *, int, int);
185 int u32_asc(uintmax_t, char *, int, int);
186 uintmax_t asc_umax(char *, int, int);
187 int umax_asc(uintmax_t, char *, int, int);
188 int check_Aflag(void);
194 int getoldopt(int, char **, const char *, struct option
*, int *);
203 void options(int, char **);
204 OPLIST
* opt_next(void);
208 #if !HAVE_NBTOOL_CONFIG_H
216 int pat_add(char *, char *, int);
218 int pat_sel(ARCHD
*);
219 int pat_match(ARCHD
*);
220 int mod_name(ARCHD
*, int);
221 int set_dest(ARCHD
*, char *, int);
254 extern int rmleadslash
;
257 extern int to_stdout
;
259 extern char *ltmfrmt
;
260 extern const char *argv0
;
262 extern char *tempfile
;
263 extern char *tempbase
;
268 int sel_chk(ARCHD
*);
271 int trng_add(char *);
277 int chk_lnk(ARCHD
*);
278 void purg_lnk(ARCHD
*);
280 int ftime_start(void);
281 int chk_ftime(ARCHD
*);
282 int name_start(void);
283 int add_name(char *, int, char *);
284 void sub_name(char *, int *, size_t);
286 int add_dev(ARCHD
*);
287 int map_dev(ARCHD
*, u_long
, u_long
);
288 int atdir_start(void);
289 void atdir_end(void);
290 void add_atdir(char *, dev_t
, ino_t
, time_t, time_t);
291 int get_atdir(dev_t
, ino_t
, time_t *, time_t *);
293 void add_dir(char *, int, struct stat
*, int);
295 u_int
st_hash(char *, int, int);
300 extern int is_gnutar
;
302 off_t
tar_endrd(void);
303 int tar_trail(char *, int, int *);
304 int tar_id(char *, int);
306 int tar_rd(ARCHD
*, char *);
308 int ustar_strd(void);
309 int ustar_stwr(void);
310 int ustar_id(char *, int);
311 int ustar_rd(ARCHD
*, char *);
312 int ustar_wr(ARCHD
*);
313 int tar_gnutar_X_compat(const char *);
314 int tar_gnutar_minus_minus_exclude(const char *);
320 void tty_prnt(const char *, ...)
321 __attribute__((format (printf
, 1, 2)));
322 int tty_read(char *, int);
323 void tty_warn(int, const char *, ...)
324 __attribute__((format (printf
, 2, 3)));
325 void syswarn(int, int, const char *, ...)
326 __attribute__((format (printf
, 3, 4)));