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