xref: /freebsd/bin/pax/extern.h (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1 /*-
2  * Copyright (c) 1992 Keith Muller.
3  * Copyright (c) 1992, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * Keith Muller of the University of California, San Diego.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)extern.h	8.2 (Berkeley) 4/18/94
34  * $FreeBSD$
35  */
36 
37 /*
38  * External references from each source file
39  */
40 
41 #include <sys/cdefs.h>
42 
43 /*
44  * ar_io.c
45  */
46 extern const char *arcname;
47 extern const char *gzip_program;
48 int ar_open(const char *);
49 void ar_close(void);
50 void ar_drain(void);
51 int ar_set_wr(void);
52 int ar_app_ok(void);
53 int ar_read(char *, int);
54 int ar_write(char *, int);
55 int ar_rdsync(void);
56 int ar_fow(off_t, off_t *);
57 int ar_rev(off_t );
58 int ar_next(void);
59 
60 /*
61  * ar_subs.c
62  */
63 extern u_long flcnt;
64 void list(void);
65 void extract(void);
66 void append(void);
67 void archive(void);
68 void copy(void);
69 
70 /*
71  * buf_subs.c
72  */
73 extern int blksz;
74 extern int wrblksz;
75 extern int maxflt;
76 extern int rdblksz;
77 extern off_t wrlimit;
78 extern off_t rdcnt;
79 extern off_t wrcnt;
80 int wr_start(void);
81 int rd_start(void);
82 void cp_start(void);
83 int appnd_start(off_t);
84 int rd_sync(void);
85 void pback(char *, int);
86 int rd_skip(off_t);
87 void wr_fin(void);
88 int wr_rdbuf(char *, int);
89 int rd_wrbuf(char *, int);
90 int wr_skip(off_t);
91 int wr_rdfile(ARCHD *, int, off_t *);
92 int rd_wrfile(ARCHD *, int, off_t *);
93 void cp_file(ARCHD *, int, int);
94 int buf_fill(void);
95 int buf_flush(int);
96 
97 /*
98  * cache.c
99  */
100 int uidtb_start(void);
101 int gidtb_start(void);
102 int usrtb_start(void);
103 int grptb_start(void);
104 const char * name_uid(uid_t, int);
105 const char * name_gid(gid_t, int);
106 int uid_name(char *, uid_t *);
107 int gid_name(char *, gid_t *);
108 
109 /*
110  * cpio.c
111  */
112 int cpio_strd(void);
113 int cpio_trail(ARCHD *);
114 int cpio_endwr(void);
115 int cpio_id(char *, int);
116 int cpio_rd(ARCHD *, char *);
117 off_t cpio_endrd(void);
118 int cpio_stwr(void);
119 int cpio_wr(ARCHD *);
120 int vcpio_id(char *, int);
121 int crc_id(char *, int);
122 int crc_strd(void);
123 int vcpio_rd(ARCHD *, char *);
124 off_t vcpio_endrd(void);
125 int crc_stwr(void);
126 int vcpio_wr(ARCHD *);
127 int bcpio_id(char *, int);
128 int bcpio_rd(ARCHD *, char *);
129 off_t bcpio_endrd(void);
130 int bcpio_wr(ARCHD *);
131 
132 /*
133  * file_subs.c
134  */
135 int file_creat(ARCHD *);
136 void file_close(ARCHD *, int);
137 int lnk_creat(ARCHD *);
138 int cross_lnk(ARCHD *);
139 int chk_same(ARCHD *);
140 int node_creat(ARCHD *);
141 int unlnk_exist(char *, int);
142 int chk_path(char *, uid_t, gid_t);
143 void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
144 int set_ids(char *, uid_t, gid_t);
145 int set_lids(char *, uid_t, gid_t);
146 void set_pmode(char *, mode_t);
147 int file_write(int, char *, int, int *, int *, int, char *);
148 void file_flush(int, char *, int);
149 void rdfile_close(ARCHD *, int *);
150 int set_crc(ARCHD *, int);
151 
152 /*
153  * ftree.c
154  */
155 int ftree_start(void);
156 int ftree_add(char *, int);
157 void ftree_sel(ARCHD *);
158 void ftree_notsel(void);
159 void ftree_chk(void);
160 int next_file(ARCHD *);
161 
162 /*
163  * gen_subs.c
164  */
165 void ls_list(ARCHD *, time_t, FILE *);
166 void ls_tty(ARCHD *);
167 int l_strncpy(char *, const char *, int);
168 u_long asc_ul(char *, int, int);
169 int ul_asc(u_long, char *, int, int);
170 #ifndef NET2_STAT
171 u_quad_t asc_uqd(char *, int, int);
172 int uqd_asc(u_quad_t, char *, int, int);
173 #endif
174 
175 /*
176  * getoldopt.c
177  */
178 int getoldopt(int, char **, const char *);
179 
180 /*
181  * options.c
182  */
183 extern FSUB fsub[];
184 extern int ford[];
185 void options(int, char **);
186 OPLIST * opt_next(void);
187 int opt_add(const char *);
188 int bad_opt(void);
189 extern char *chdname;
190 
191 /*
192  * pat_rep.c
193  */
194 int rep_add(char *);
195 int pat_add(char *, char *);
196 void pat_chk(void);
197 int pat_sel(ARCHD *);
198 int pat_match(ARCHD *);
199 int mod_name(ARCHD *);
200 int set_dest(ARCHD *, char *, int);
201 
202 /*
203  * pax.c
204  */
205 extern int act;
206 extern FSUB *frmt;
207 extern int cflag;
208 extern int cwdfd;
209 extern int dflag;
210 extern int iflag;
211 extern int kflag;
212 extern int lflag;
213 extern int nflag;
214 extern int tflag;
215 extern int uflag;
216 extern int vflag;
217 extern int Dflag;
218 extern int Hflag;
219 extern int Lflag;
220 extern int Oflag;
221 extern int Xflag;
222 extern int Yflag;
223 extern int Zflag;
224 extern int vfpart;
225 extern int patime;
226 extern int pmtime;
227 extern int nodirs;
228 extern int pmode;
229 extern int pids;
230 extern int rmleadslash;
231 extern int exit_val;
232 extern int docrc;
233 extern char *dirptr;
234 extern const char *argv0;
235 extern sigset_t s_mask;
236 extern FILE *listf;
237 extern char *tempfile;
238 extern char *tempbase;
239 
240 void sig_cleanup(int);
241 
242 /*
243  * sel_subs.c
244  */
245 int sel_chk(ARCHD *);
246 int grp_add(char *);
247 int usr_add(char *);
248 int trng_add(char *);
249 
250 /*
251  * tables.c
252  */
253 int lnk_start(void);
254 int chk_lnk(ARCHD *);
255 void purg_lnk(ARCHD *);
256 void lnk_end(void);
257 int ftime_start(void);
258 int chk_ftime(ARCHD *);
259 int name_start(void);
260 int add_name(char *, int, char *);
261 void sub_name(char *, int *, size_t);
262 int dev_start(void);
263 int add_dev(ARCHD *);
264 int map_dev(ARCHD *, u_long, u_long);
265 int atdir_start(void);
266 void atdir_end(void);
267 void add_atdir(char *, dev_t, ino_t, time_t, time_t);
268 int get_atdir(dev_t, ino_t, time_t *, time_t *);
269 int dir_start(void);
270 void add_dir(char *, int, struct stat *, int);
271 void proc_dir(void);
272 u_int st_hash(char *, int, int);
273 
274 /*
275  * tar.c
276  */
277 int tar_endwr(void);
278 off_t tar_endrd(void);
279 int tar_trail(char *, int, int *);
280 int tar_id(char *, int);
281 int tar_opt(void);
282 int tar_rd(ARCHD *, char *);
283 int tar_wr(ARCHD *);
284 int ustar_strd(void);
285 int ustar_stwr(void);
286 int ustar_id(char *, int);
287 int ustar_rd(ARCHD *, char *);
288 int ustar_wr(ARCHD *);
289 
290 /*
291  * tty_subs.c
292  */
293 int tty_init(void);
294 void tty_prnt(const char *, ...) __printflike(1, 2);
295 int tty_read(char *, int);
296 void paxwarn(int, const char *, ...) __printflike(2, 3);
297 void syswarn(int, int, const char *, ...) __printflike(3, 4);
298