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