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 int table_flag;
29 extern int unconditional_flag;
30 extern int verbose_flag;
33 extern int retain_time_flag;
34 extern int crc_i_flag;
35 extern int append_flag;
36 extern int swap_bytes_flag;
37 extern int swap_halfwords_flag;
38 extern int swapping_bytes;
39 extern int swapping_halfwords;
40 extern int set_owner_flag;
41 extern uid_t set_owner;
42 extern int set_group_flag;
43 extern gid_t set_group;
44 extern int no_chown_flag;
45 extern int last_header_start;
46 extern int copy_matching_files;
47 extern int numeric_uid;
48 extern char *pattern_file_name;
49 extern char *new_media_message;
50 extern char *new_media_message_with_number;
51 extern char *new_media_message_after_number;
52 extern int archive_des;
53 extern char *archive_name;
54 extern unsigned long crc;
56 extern int debug_flag;
59 extern char *input_buffer, *output_buffer;
60 extern char *in_buff, *out_buff;
61 extern long input_size, output_size;
62 extern long input_bytes, output_bytes;
63 extern char zeros_512[];
64 extern char *directory_name;
65 extern char **save_patterns;
66 extern int num_patterns;
68 extern char input_is_special;
69 extern char output_is_special;
70 extern char input_is_seekable;
71 extern char output_is_seekable;
72 extern int f_force_local;
73 extern char *program_name;
74 extern int (*xstat) ();
75 extern void (*copy_function) ();
77 #if __STDC__ || defined(__MSDOS__)
84 void read_in_header P_((struct new_cpio_header *file_hdr, int in_des));
85 void read_in_old_ascii P_((struct new_cpio_header *file_hdr, int in_des));
86 void read_in_new_ascii P_((struct new_cpio_header *file_hdr, int in_des));
87 void read_in_binary P_((struct new_cpio_header *file_hdr, int in_des));
88 void swab_array P_((char *arg, int count));
89 void process_copy_in P_((void));
90 void long_format P_((struct new_cpio_header *file_hdr, char *link_name));
91 void print_name_with_quoting P_((char *p));
94 void write_out_header P_((struct new_cpio_header *file_hdr, int out_des));
95 void process_copy_out P_((void));
98 void process_copy_pass P_((void));
101 char *dirname P_((char *path));
104 void error P_((int status, int errnum, char *message, ...));
107 void mode_string P_((unsigned int mode, char *str));
113 uid_t *getuidbyname ();
114 gid_t *getgidbyname ();
118 void process_args P_((int argc, char *argv[]));
119 void initialize_buffers P_((void));
122 int make_path P_((char *argpath, int mode, int parent_mode,
123 uid_t owner, gid_t group, char *verbose_fmt_string));
126 void strip_trailing_slashes P_((char *path));
129 void write_out_tar_header P_((struct new_cpio_header *file_hdr, int out_des));
130 int null_block P_((long *block, int size));
131 void read_in_tar_header P_((struct new_cpio_header *file_hdr, int in_des));
132 int otoa P_((char *s, unsigned long *n));
133 int is_tar_header P_((char *buf));
134 int is_tar_filename_too_long P_((char *name));
138 char *parse_user_spec P_((char *name, uid_t *uid, gid_t *gid,
139 char **username, char **groupname));
143 void empty_output_buffer P_((int out_des));
144 void swahw_array P_((char *ptr, int count));
145 void fill_input_buffer P_((int in_des, int num_bytes));
146 void copy_buf_out P_((char *in_buf, int out_des, long num_bytes));
147 void copy_in_buf P_((char *in_buf, int in_des, long num_bytes));
148 int peek_in_buf P_((char *peek_buf, int in_des, int num_bytes));
149 void toss_input P_((int in_des, long num_bytes));
150 void copy_files P_((int in_des, int out_des, long num_bytes));
151 void create_all_directories P_((char *name));
152 void prepare_append P_((int out_file_des));
153 char *find_inode_file P_((unsigned long node_num,
154 unsigned long major_num, unsigned long minor_num));
155 void add_inode P_((unsigned long node_num, char *file_name,
156 unsigned long major_num, unsigned long minor_num));
157 int open_archive P_((char *file));
158 void tape_offline P_((int tape_des));
159 void get_next_reel P_((int tape_des));
160 void set_new_media_message P_((char *message));
162 int chown P_((char *path, int owner, int group));
165 int utime P_((char *filename, struct utimbuf *utb));
168 char *add_cdf_double_slashes P_((char *filename));
172 char *xmalloc P_((unsigned n));
173 char *xrealloc P_((char *p, unsigned n));
176 char *xstrdup P_((char *string));