xref: /dragonfly/bin/pax/extern.h (revision 57fed2af)
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: src/bin/pax/extern.h,v 1.6.2.2 2001/08/01 05:03:11 obrien Exp $
39  * $DragonFly: src/bin/pax/extern.h,v 1.4 2004/10/30 13:34:50 liamfoy Exp $
40  */
41 
42 /*
43  * External references from each source file
44  */
45 
46 #include <sys/cdefs.h>
47 
48 /*
49  * ar_io.c
50  */
51 extern char *arcname;
52 extern const char *gzip_program;
53 int ar_open (char *);
54 void ar_close (void);
55 void ar_drain (void);
56 int ar_set_wr (void);
57 int ar_app_ok (void);
58 int ar_read (char *, int);
59 int ar_write (char *, int);
60 int ar_rdsync (void);
61 int ar_fow (off_t, off_t *);
62 int ar_rev (off_t );
63 int ar_next (void);
64 
65 /*
66  * ar_subs.c
67  */
68 extern u_long flcnt;
69 void list (void);
70 void extract (void);
71 void append (void);
72 void archive (void);
73 void copy (void);
74 
75 /*
76  * buf_subs.c
77  */
78 extern int blksz;
79 extern int wrblksz;
80 extern int maxflt;
81 extern int rdblksz;
82 extern off_t wrlimit;
83 extern off_t rdcnt;
84 extern off_t wrcnt;
85 int wr_start (void);
86 int rd_start (void);
87 void cp_start (void);
88 int appnd_start (off_t);
89 int rd_sync (void);
90 void pback (char *, int);
91 int rd_skip (off_t);
92 void wr_fin (void);
93 int wr_rdbuf (char *, int);
94 int rd_wrbuf (char *, int);
95 int wr_skip (off_t);
96 int wr_rdfile (ARCHD *, int, off_t *);
97 int rd_wrfile (ARCHD *, int, off_t *);
98 void cp_file (ARCHD *, int, int);
99 int buf_fill (void);
100 int buf_flush (int);
101 
102 /*
103  * cache.c
104  */
105 int uidtb_start (void);
106 int gidtb_start (void);
107 int usrtb_start (void);
108 int grptb_start (void);
109 char * name_uid (uid_t, int);
110 char * name_gid (gid_t, int);
111 int uid_name (char *, uid_t *);
112 int gid_name (char *, gid_t *);
113 
114 /*
115  * cpio.c
116  */
117 int cpio_strd (void);
118 int cpio_trail (ARCHD *);
119 int cpio_endwr (void);
120 int cpio_id (char *, int);
121 int cpio_rd (ARCHD *, char *);
122 off_t cpio_endrd (void);
123 int cpio_stwr (void);
124 int cpio_wr (ARCHD *);
125 int vcpio_id (char *, int);
126 int crc_id (char *, int);
127 int crc_strd (void);
128 int vcpio_rd (ARCHD *, char *);
129 off_t vcpio_endrd (void);
130 int crc_stwr (void);
131 int vcpio_wr (ARCHD *);
132 int bcpio_id (char *, int);
133 int bcpio_rd (ARCHD *, char *);
134 off_t bcpio_endrd (void);
135 int bcpio_wr (ARCHD *);
136 
137 /*
138  * file_subs.c
139  */
140 int file_creat (ARCHD *);
141 void file_close (ARCHD *, int);
142 int lnk_creat (ARCHD *);
143 int cross_lnk (ARCHD *);
144 int chk_same (ARCHD *);
145 int node_creat (ARCHD *);
146 int unlnk_exist (char *, int);
147 int chk_path (char *, uid_t, gid_t);
148 void set_ftime (char *fnm, time_t mtime, time_t atime, int frc);
149 int set_ids (char *, uid_t, gid_t);
150 int set_lids (char *, uid_t, gid_t);
151 void set_pmode (char *, mode_t);
152 int file_write (int, char *, int, int *, int *, int, char *);
153 void file_flush (int, char *, int);
154 void rdfile_close (ARCHD *, int *);
155 int set_crc (ARCHD *, int);
156 
157 /*
158  * ftree.c
159  */
160 int ftree_start (void);
161 int ftree_add (char *, int);
162 void ftree_sel (ARCHD *);
163 void ftree_chk (void);
164 int next_file (ARCHD *);
165 
166 /*
167  * gen_subs.c
168  */
169 void ls_list (ARCHD *, time_t, FILE *);
170 void ls_tty (ARCHD *);
171 int l_strncpy (char *, char *, int);
172 u_long asc_ul (char *, int, int);
173 int ul_asc (u_long, char *, int, int);
174 #ifndef NET2_STAT
175 u_quad_t asc_uqd (char *, int, int);
176 int uqd_asc (u_quad_t, char *, int, int);
177 #endif
178 
179 /*
180  * getoldopt.c
181  */
182 int getoldopt (int, char **, char *);
183 
184 /*
185  * options.c
186  */
187 extern FSUB fsub[];
188 extern int ford[];
189 void options (int, char **);
190 OPLIST * opt_next (void);
191 int opt_add (char *);
192 int bad_opt (void);
193 char *chdname;
194 
195 /*
196  * pat_rep.c
197  */
198 int rep_add (char *);
199 int pat_add (char *, char *);
200 void pat_chk (void);
201 int pat_sel (ARCHD *);
202 int pat_match (ARCHD *);
203 int mod_name (ARCHD *);
204 int set_dest (ARCHD *, char *, int);
205 
206 /*
207  * pax.c
208  */
209 extern int act;
210 extern FSUB *frmt;
211 extern int cflag;
212 extern int cwdfd;
213 extern int dflag;
214 extern int iflag;
215 extern int kflag;
216 extern int lflag;
217 extern int nflag;
218 extern int tflag;
219 extern int uflag;
220 extern int vflag;
221 extern int Dflag;
222 extern int Hflag;
223 extern int Lflag;
224 extern int Xflag;
225 extern int Yflag;
226 extern int Zflag;
227 extern int vfpart;
228 extern int patime;
229 extern int pmtime;
230 extern int nodirs;
231 extern int pmode;
232 extern int pids;
233 extern int rmleadslash;
234 extern int exit_val;
235 extern int docrc;
236 extern char *dirptr;
237 extern char *argv0;
238 extern FILE *listf;
239 extern char *tempfile;
240 extern char *tempbase;
241 
242 int main (int, char **);
243 void sig_cleanup (int);
244 
245 /*
246  * sel_subs.c
247  */
248 int sel_chk (ARCHD *);
249 int grp_add (char *);
250 int usr_add (char *);
251 int trng_add (char *);
252 
253 /*
254  * tables.c
255  */
256 int lnk_start (void);
257 int chk_lnk (ARCHD *);
258 void purg_lnk (ARCHD *);
259 void lnk_end (void);
260 int ftime_start (void);
261 int chk_ftime (ARCHD *);
262 int name_start (void);
263 int add_name (char *, int, char *);
264 void sub_name (char *, int *, size_t);
265 int dev_start (void);
266 int add_dev (ARCHD *);
267 int map_dev (ARCHD *, u_long, u_long);
268 int atdir_start (void);
269 void atdir_end (void);
270 void add_atdir (char *, dev_t, ino_t, time_t, time_t);
271 int get_atdir (dev_t, ino_t, time_t *, time_t *);
272 int dir_start (void);
273 void add_dir (char *, int, struct stat *, int);
274 void proc_dir (void);
275 u_int st_hash (char *, int, int);
276 
277 /*
278  * tar.c
279  */
280 int tar_endwr (void);
281 off_t tar_endrd (void);
282 int tar_trail (char *, int, int *);
283 int tar_id (char *, int);
284 int tar_opt (void);
285 int tar_rd (ARCHD *, char *);
286 int tar_wr (ARCHD *);
287 int ustar_strd (void);
288 int ustar_stwr (void);
289 int ustar_id (char *, int);
290 int ustar_rd (ARCHD *, char *);
291 int ustar_wr (ARCHD *);
292 
293 /*
294  * tty_subs.c
295  */
296 int tty_init (void);
297 void tty_prnt (const char *, ...) __printflike(1, 2);
298 int tty_read (char *, int);
299 void paxwarn (int, const char *, ...) __printflike(2, 3);
300 void syswarn (int, int, const char *, ...) __printflike(3, 4);
301