1 /* extern.h - External declarations for cpio. Requires system.h.
2 Copyright (C) 1990, 1991, 1992, 2001 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 along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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;
50 extern unsigned int warn_option;
52 /* Values for warn_option */
53 #define CPIO_WARN_NONE 0
54 #define CPIO_WARN_TRUNCATE 0x01
55 #define CPIO_WARN_ALL (unsigned int)-1
57 extern bool to_stdout_option;
59 extern int last_header_start;
60 extern int copy_matching_files;
61 extern int numeric_uid;
62 extern char *pattern_file_name;
63 extern char *new_media_message;
64 extern char *new_media_message_with_number;
65 extern char *new_media_message_after_number;
66 extern int archive_des;
67 extern char *archive_name;
68 extern char *rsh_command_option;
69 extern unsigned long crc;
70 extern int delayed_seek_count;
72 extern int debug_flag;
75 extern char *input_buffer, *output_buffer;
76 extern char *in_buff, *out_buff;
77 extern long input_buffer_size;
78 extern long input_size, output_size;
80 extern long long input_bytes, output_bytes;
82 extern long input_bytes, output_bytes;
84 extern char zeros_512[];
85 extern char *directory_name;
86 extern char **save_patterns;
87 extern int num_patterns;
89 extern char input_is_special;
90 extern char output_is_special;
91 extern char input_is_seekable;
92 extern char output_is_seekable;
93 extern char *program_name;
94 extern int (*xstat) ();
95 extern void (*copy_function) ();
97 #if defined PROTOTYPES || (defined __STDC__ && __STDC__)
104 void warn_junk_bytes P_((long bytes_skipped));
105 void read_in_header P_((struct new_cpio_header *file_hdr, int in_des));
106 void read_in_old_ascii P_((struct new_cpio_header *file_hdr, int in_des));
107 void read_in_new_ascii P_((struct new_cpio_header *file_hdr, int in_des));
108 void read_in_binary P_((struct new_cpio_header *file_hdr, int in_des));
109 void swab_array P_((char *arg, int count));
110 void process_copy_in P_((void));
111 void long_format P_((struct new_cpio_header *file_hdr, char *link_name));
112 void print_name_with_quoting P_((char *p));
115 void write_out_header P_((struct new_cpio_header *file_hdr, int out_des));
116 void process_copy_out P_((void));
119 void process_copy_pass P_((void));
120 int link_to_maj_min_ino P_((char *file_name, int st_dev_maj,
121 int st_dev_min, int st_ino));
122 int link_to_name P_((char *link_name, char *link_target));
125 char *dirname P_((char *path));
128 void mode_string P_((unsigned int mode, char *str));
134 uid_t *getuidbyname ();
135 gid_t *getgidbyname ();
139 void process_args P_((int argc, char *argv[]));
140 void initialize_buffers P_((void));
143 int make_path P_((char *argpath, int mode, int parent_mode,
144 uid_t owner, gid_t group, char *verbose_fmt_string));
147 void write_out_tar_header P_((struct new_cpio_header *file_hdr, int out_des));
148 int null_block P_((long *block, int size));
149 void read_in_tar_header P_((struct new_cpio_header *file_hdr, int in_des));
150 int otoa P_((char *s, unsigned long *n));
151 int is_tar_header P_((char *buf));
152 int is_tar_filename_too_long P_((char *name));
156 char *parse_user_spec P_((char *name, uid_t *uid, gid_t *gid,
157 char **username, char **groupname));
161 void tape_empty_output_buffer P_((int out_des));
162 void disk_empty_output_buffer P_((int out_des));
163 void swahw_array P_((char *ptr, int count));
164 void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes));
165 void tape_buffered_read P_((char *in_buf, int in_des, long num_bytes));
166 int tape_buffered_peek P_((char *peek_buf, int in_des, int num_bytes));
167 void tape_toss_input P_((int in_des, long num_bytes));
168 void copy_files_tape_to_disk P_((int in_des, int out_des, long num_bytes));
169 void copy_files_disk_to_tape P_((int in_des, int out_des, long num_bytes, char *filename));
170 void copy_files_disk_to_disk P_((int in_des, int out_des, long num_bytes, char *filename));
171 void warn_if_file_changed P_((char *file_name, unsigned long old_file_size,
172 unsigned long old_file_mtime));
173 void create_all_directories P_((char *name));
174 void prepare_append P_((int out_file_des));
175 char *find_inode_file P_((unsigned long node_num,
176 unsigned long major_num, unsigned long minor_num));
177 void add_inode P_((unsigned long node_num, char *file_name,
178 unsigned long major_num, unsigned long minor_num));
179 int open_archive P_((char *file));
180 void tape_offline P_((int tape_des));
181 void get_next_reel P_((int tape_des));
182 void set_new_media_message P_((char *message));
183 #if defined(__MSDOS__) && !defined(__GNUC__)
184 int chown P_((char *path, int owner, int group));
187 int utime P_((char *filename, struct utimbuf *utb));
190 char *add_cdf_double_slashes P_((char *filename));
193 #define DISK_IO_BLOCK_SIZE (512)
195 /* FIXME: Move to system.h? */
196 #ifndef SYMLINK_USES_UMASK
197 # define UMASKED_SYMLINK(name1,name2,mode) symlink(name1,name2)
199 # define UMASKED_SYMLINK(name1,name2,mode) umasked_symlink(name1,name2,mode)
200 #endif /* SYMLINK_USES_UMASK */