add ext4,vfat and tar.bz2
[u-tools.git] / u-tools / apps / tar / lib / paxlib.h
blobd0ba45ba1e66ac216d2fdfc96c1adae2a67da087
1 /* This file is part of GNU paxutils
3 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003,
4 2005, 2007 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef _paxlib_h_
22 #define _paxlib_h_
24 #include <inttostr.h>
26 /* Error reporting functions and definitions */
28 /* Exit status for paxutils app. Let's try to keep this list as simple as
29 possible. tar -d option strongly invites a status different for unequal
30 comparison and other errors. */
31 #define PAXEXIT_SUCCESS 0
32 #define PAXEXIT_DIFFERS 1
33 #define PAXEXIT_FAILURE 2
35 /* Both WARN and ERROR write a message on stderr and continue processing,
36 however ERROR manages so tar will exit unsuccessfully. FATAL_ERROR
37 writes a message on stderr and aborts immediately, with another message
38 line telling so. USAGE_ERROR works like FATAL_ERROR except that the
39 other message line suggests trying --help. All four macros accept a
40 single argument of the form ((0, errno, _("FORMAT"), Args...)). errno
41 is zero when the error is not being detected by the system. */
43 #define WARN(Args) \
44 error Args
45 #define ERROR(Args) \
46 (error Args, exit_status = PAXEXIT_FAILURE)
47 #define FATAL_ERROR(Args) \
48 (error Args, fatal_exit ())
49 #define USAGE_ERROR(Args) \
50 (error Args, usage (PAXEXIT_FAILURE))
52 extern int exit_status;
54 void pax_decode_mode (mode_t mode, char *string);
55 void call_arg_error (char const *call, char const *name);
56 void call_arg_fatal (char const *call, char const *name) __attribute__ ((noreturn));
57 void call_arg_warn (char const *call, char const *name);
58 void chmod_error_details (char const *name, mode_t mode);
59 void chown_error_details (char const *name, uid_t uid, gid_t gid);
61 void decode_mode (mode_t, char *);
63 void chdir_fatal (char const *) __attribute__ ((noreturn));
64 void chmod_error_details (char const *, mode_t);
65 void chown_error_details (char const *, uid_t, gid_t);
66 void close_error (char const *);
67 void close_warn (char const *);
68 void exec_fatal (char const *) __attribute__ ((noreturn));
69 void link_error (char const *, char const *);
70 void mkdir_error (char const *);
71 void mkfifo_error (char const *);
72 void mknod_error (char const *);
73 void open_error (char const *);
74 void open_fatal (char const *) __attribute__ ((noreturn));
75 void open_warn (char const *);
76 void read_error (char const *);
77 void read_error_details (char const *, off_t, size_t);
78 void read_fatal (char const *) __attribute__ ((noreturn));
79 void read_fatal_details (char const *, off_t, size_t) __attribute__ ((noreturn));
80 void read_warn_details (char const *, off_t, size_t);
81 void readlink_error (char const *);
82 void readlink_warn (char const *);
83 void rmdir_error (char const *);
84 void savedir_error (char const *);
85 void savedir_warn (char const *);
86 void seek_error (char const *);
87 void seek_error_details (char const *, off_t);
88 void seek_warn (char const *);
89 void seek_warn_details (char const *, off_t);
90 void stat_fatal (char const *) __attribute__ ((noreturn));
91 void stat_error (char const *);
92 void stat_warn (char const *);
93 void symlink_error (char const *, char const *);
94 void truncate_error (char const *);
95 void truncate_warn (char const *);
96 void unlink_error (char const *);
97 void utime_error (char const *);
98 void waitpid_error (char const *);
99 void write_error (char const *);
100 void write_error_details (char const *, size_t, size_t);
102 void pax_exit (void) __attribute__ ((noreturn));
103 void fatal_exit (void) __attribute__ ((noreturn));
105 #define STRINGIFY_BIGINT(i, b) umaxtostr (i, b)
108 /* Name-related functions */
109 bool removed_prefixes_p (void);
110 char *safer_name_suffix (char const *file_name, bool link_target, bool absolute_names);
112 #endif