1 /* extern.h - External declarations for cpio. Requires system.h.
2 Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 arf_unknown
, arf_binary
, arf_oldascii
, arf_newascii
, arf_crcascii
,
21 arf_tar
, arf_ustar
, arf_hpoldascii
, arf_hpbinary
23 extern enum archive_format archive_format
;
24 extern int reset_time_flag
;
25 extern int io_block_size
;
26 extern int create_dir_flag
;
27 extern int rename_flag
;
28 extern char *rename_batch_file
;
29 extern int table_flag
;
30 extern int unconditional_flag
;
31 extern int verbose_flag
;
34 extern int retain_time_flag
;
35 extern int crc_i_flag
;
36 extern int append_flag
;
37 extern int swap_bytes_flag
;
38 extern int swap_halfwords_flag
;
39 extern int swapping_bytes
;
40 extern int swapping_halfwords
;
41 extern int set_owner_flag
;
42 extern uid_t set_owner
;
43 extern int set_group_flag
;
44 extern gid_t set_group
;
45 extern int no_chown_flag
;
46 extern int sparse_flag
;
47 extern int quiet_flag
;
48 extern int only_verify_crc_flag
;
49 extern int no_abs_paths_flag
;
51 extern int last_header_start
;
52 extern int copy_matching_files
;
53 extern int numeric_uid
;
54 extern char *pattern_file_name
;
55 extern char *new_media_message
;
56 extern char *new_media_message_with_number
;
57 extern char *new_media_message_after_number
;
58 extern int archive_des
;
59 extern char *archive_name
;
60 extern unsigned long crc
;
62 extern int debug_flag
;
65 extern char *input_buffer
, *output_buffer
;
66 extern char *in_buff
, *out_buff
;
67 extern long input_buffer_size
;
68 extern long input_size
, output_size
;
70 extern long long input_bytes
, output_bytes
;
72 extern long input_bytes
, output_bytes
;
74 extern char zeros_512
[];
75 extern char *directory_name
;
76 extern char **save_patterns
;
77 extern int num_patterns
;
79 extern char input_is_special
;
80 extern char output_is_special
;
81 extern char input_is_seekable
;
82 extern char output_is_seekable
;
83 extern int f_force_local
;
84 extern char *program_name
;
85 extern int (*xstat
) ();
86 extern void (*copy_function
) ();
88 #if __STDC__ || defined(__MSDOS__)
95 void read_in_header
P_((struct new_cpio_header
*file_hdr
, int in_des
));
96 void read_in_old_ascii
P_((struct new_cpio_header
*file_hdr
, int in_des
));
97 void read_in_new_ascii
P_((struct new_cpio_header
*file_hdr
, int in_des
));
98 void read_in_binary
P_((struct new_cpio_header
*file_hdr
, int in_des
));
99 void swab_array
P_((char *arg
, int count
));
100 void process_copy_in
P_((void));
101 void long_format
P_((struct new_cpio_header
*file_hdr
, char *link_name
));
102 void print_name_with_quoting
P_((char *p
));
105 void write_out_header
P_((struct new_cpio_header
*file_hdr
, int out_des
));
106 void process_copy_out
P_((void));
109 void process_copy_pass
P_((void));
110 int link_to_maj_min_ino
P_((char *file_name
, int st_dev_maj
,
111 int st_dev_min
, int st_ino
));
112 int link_to_name
P_((char *link_name
, char *link_target
));
115 char *dirname
P_((char *path
));
118 void error
P_((int status
, int errnum
, char *message
, ...));
121 void mode_string
P_((unsigned int mode
, char *str
));
127 uid_t
*getuidbyname ();
128 gid_t
*getgidbyname ();
133 int lchown
P_((const char *path
, uid_t owner
, gid_t group
));
137 void process_args
P_((int argc
, char *argv
[]));
138 void initialize_buffers
P_((void));
141 int make_path
P_((char *argpath
, int mode
, int parent_mode
,
142 uid_t owner
, gid_t group
, char *verbose_fmt_string
));
145 void strip_trailing_slashes
P_((char *path
));
148 void write_out_tar_header
P_((struct new_cpio_header
*file_hdr
, int out_des
));
149 int null_block
P_((long *block
, int size
));
150 void read_in_tar_header
P_((struct new_cpio_header
*file_hdr
, int in_des
));
151 int otoa
P_((char *s
, unsigned long *n
));
152 int is_tar_header
P_((char *buf
));
153 int is_tar_filename_too_long
P_((char *name
));
157 char *parse_user_spec
P_((char *name
, uid_t
*uid
, gid_t
*gid
,
158 char **username
, char **groupname
));
162 void tape_empty_output_buffer
P_((int out_des
));
163 void disk_empty_output_buffer
P_((int out_des
));
164 void swahw_array
P_((char *ptr
, int count
));
165 void tape_buffered_write
P_((char *in_buf
, int out_des
, long num_bytes
));
166 void tape_buffered_read
P_((char *in_buf
, int in_des
, long num_bytes
));
167 int tape_buffered_peek
P_((char *peek_buf
, int in_des
, int num_bytes
));
168 void tape_toss_input
P_((int in_des
, long num_bytes
));
169 void copy_files_tape_to_disk
P_((int in_des
, int out_des
, long num_bytes
));
170 void copy_files_disk_to_tape
P_((int in_des
, int out_des
, long num_bytes
, char *filename
));
171 void copy_files_disk_to_disk
P_((int in_des
, int out_des
, long num_bytes
, char *filename
));
172 void create_all_directories
P_((char *name
));
173 void prepare_append
P_((int out_file_des
));
174 char *find_inode_file
P_((unsigned long node_num
,
175 unsigned long major_num
, unsigned long minor_num
));
176 void add_inode
P_((unsigned long node_num
, char *file_name
,
177 unsigned long major_num
, unsigned long minor_num
));
178 int open_archive
P_((char *file
));
179 void tape_offline
P_((int tape_des
));
180 void get_next_reel
P_((int tape_des
));
181 void set_new_media_message
P_((char *message
));
182 #if defined(__MSDOS__) && !defined(__GNUC__)
183 int chown
P_((char *path
, int owner
, int group
));
186 int utime
P_((char *filename
, struct utimbuf
*utb
));
189 char *add_cdf_double_slashes
P_((char *filename
));
193 char *xmalloc
P_((unsigned n
));
194 char *xrealloc
P_((char *p
, unsigned n
));
197 char *xstrdup
P_((char *string
));
199 #define DISK_IO_BLOCK_SIZE (512)