|
Packit Service |
9285f1 |
/* This file is part of GNU paxutils
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003,
|
|
Packit Service |
9285f1 |
2005, 2007 Free Software Foundation, Inc.
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
9285f1 |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
9285f1 |
the Free Software Foundation; either version 3, or (at your option)
|
|
Packit Service |
9285f1 |
any later version.
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
9285f1 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
9285f1 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
9285f1 |
GNU General Public License for more details.
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
9285f1 |
along with this program; if not, write to the Free Software Foundation,
|
|
Packit Service |
9285f1 |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit Service |
9285f1 |
*/
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
#ifndef _paxlib_h_
|
|
Packit Service |
9285f1 |
#define _paxlib_h_
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
#include <inttostr.h>
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
/* Error reporting functions and definitions */
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
/* Exit status for paxutils app. Let's try to keep this list as simple as
|
|
Packit Service |
9285f1 |
possible. tar -d option strongly invites a status different for unequal
|
|
Packit Service |
9285f1 |
comparison and other errors. */
|
|
Packit Service |
9285f1 |
#define PAXEXIT_SUCCESS 0
|
|
Packit Service |
9285f1 |
#define PAXEXIT_DIFFERS 1
|
|
Packit Service |
9285f1 |
#define PAXEXIT_FAILURE 2
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
extern void (*error_hook) (void);
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
/* Both WARN and ERROR write a message on stderr and continue processing,
|
|
Packit Service |
9285f1 |
however ERROR manages so tar will exit unsuccessfully. FATAL_ERROR
|
|
Packit Service |
9285f1 |
writes a message on stderr and aborts immediately, with another message
|
|
Packit Service |
9285f1 |
line telling so. USAGE_ERROR works like FATAL_ERROR except that the
|
|
Packit Service |
9285f1 |
other message line suggests trying --help. All four macros accept a
|
|
Packit Service |
9285f1 |
single argument of the form ((0, errno, _("FORMAT"), Args...)). errno
|
|
Packit Service |
9285f1 |
is zero when the error is not being detected by the system. */
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
#define WARN(Args) \
|
|
Packit Service |
9285f1 |
do { if (error_hook) error_hook (); error Args; } while (0)
|
|
Packit Service |
9285f1 |
#define ERROR(Args) \
|
|
Packit Service |
9285f1 |
do \
|
|
Packit Service |
9285f1 |
{ \
|
|
Packit Service |
9285f1 |
if (error_hook) error_hook (); \
|
|
Packit Service |
9285f1 |
error Args; \
|
|
Packit Service |
9285f1 |
exit_status = PAXEXIT_FAILURE; \
|
|
Packit Service |
9285f1 |
} \
|
|
Packit Service |
9285f1 |
while (0)
|
|
Packit Service |
9285f1 |
#define FATAL_ERROR(Args) \
|
|
Packit Service |
9285f1 |
do \
|
|
Packit Service |
9285f1 |
{ \
|
|
Packit Service |
9285f1 |
if (error_hook) error_hook (); \
|
|
Packit Service |
9285f1 |
error Args; \
|
|
Packit Service |
9285f1 |
fatal_exit (); \
|
|
Packit Service |
9285f1 |
} \
|
|
Packit Service |
9285f1 |
while (0)
|
|
Packit Service |
9285f1 |
#define USAGE_ERROR(Args) \
|
|
Packit Service |
9285f1 |
do \
|
|
Packit Service |
9285f1 |
{ \
|
|
Packit Service |
9285f1 |
if (error_hook) error_hook (); \
|
|
Packit Service |
9285f1 |
error Args; \
|
|
Packit Service |
9285f1 |
usage (PAXEXIT_FAILURE); \
|
|
Packit Service |
9285f1 |
} \
|
|
Packit Service |
9285f1 |
while (0)
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
extern int exit_status;
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
void pax_decode_mode (mode_t mode, char *string);
|
|
Packit Service |
9285f1 |
void call_arg_error (char const *call, char const *name);
|
|
Packit Service |
9285f1 |
void call_arg_fatal (char const *call, char const *name) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void call_arg_warn (char const *call, char const *name);
|
|
Packit Service |
9285f1 |
void chmod_error_details (char const *name, mode_t mode);
|
|
Packit Service |
9285f1 |
void chown_error_details (char const *name, uid_t uid, gid_t gid);
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
void decode_mode (mode_t, char *);
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
void chdir_fatal (char const *) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void chmod_error_details (char const *, mode_t);
|
|
Packit Service |
9285f1 |
void chown_error_details (char const *, uid_t, gid_t);
|
|
Packit Service |
9285f1 |
void close_error (char const *);
|
|
Packit Service |
9285f1 |
void close_warn (char const *);
|
|
Packit Service |
9285f1 |
void exec_fatal (char const *) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void link_error (char const *, char const *);
|
|
Packit Service |
9285f1 |
void mkdir_error (char const *);
|
|
Packit Service |
9285f1 |
void mkfifo_error (char const *);
|
|
Packit Service |
9285f1 |
void mknod_error (char const *);
|
|
Packit Service |
9285f1 |
void open_error (char const *);
|
|
Packit Service |
9285f1 |
void open_fatal (char const *) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void open_warn (char const *);
|
|
Packit Service |
9285f1 |
void read_error (char const *);
|
|
Packit Service |
9285f1 |
void read_error_details (char const *, off_t, size_t);
|
|
Packit Service |
9285f1 |
void read_fatal (char const *) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void read_fatal_details (char const *, off_t, size_t) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void read_warn_details (char const *, off_t, size_t);
|
|
Packit Service |
9285f1 |
void readlink_error (char const *);
|
|
Packit Service |
9285f1 |
void readlink_warn (char const *);
|
|
Packit Service |
9285f1 |
void rmdir_error (char const *);
|
|
Packit Service |
9285f1 |
void savedir_error (char const *);
|
|
Packit Service |
9285f1 |
void savedir_warn (char const *);
|
|
Packit Service |
9285f1 |
void seek_error (char const *);
|
|
Packit Service |
9285f1 |
void seek_error_details (char const *, off_t);
|
|
Packit Service |
9285f1 |
void seek_warn (char const *);
|
|
Packit Service |
9285f1 |
void seek_warn_details (char const *, off_t);
|
|
Packit Service |
9285f1 |
void stat_fatal (char const *) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void stat_error (char const *);
|
|
Packit Service |
9285f1 |
void stat_warn (char const *);
|
|
Packit Service |
9285f1 |
void symlink_error (char const *, char const *);
|
|
Packit Service |
9285f1 |
void truncate_error (char const *);
|
|
Packit Service |
9285f1 |
void truncate_warn (char const *);
|
|
Packit Service |
9285f1 |
void unlink_error (char const *);
|
|
Packit Service |
9285f1 |
void utime_error (char const *);
|
|
Packit Service |
9285f1 |
void waitpid_error (char const *);
|
|
Packit Service |
9285f1 |
void write_error (char const *);
|
|
Packit Service |
9285f1 |
void write_error_details (char const *, size_t, size_t);
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
void pax_exit (void) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
void fatal_exit (void) __attribute__ ((noreturn));
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
#define STRINGIFY_BIGINT(i, b) umaxtostr (i, b)
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
/* Name-related functions */
|
|
Packit Service |
9285f1 |
bool removed_prefixes_p (void);
|
|
Packit Service |
9285f1 |
char *safer_name_suffix (char const *file_name, bool link_target, bool absolute_names);
|
|
Packit Service |
9285f1 |
|
|
Packit Service |
9285f1 |
#endif
|