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