X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fpaxlib.h;h=d4251d14cd126892649916716a9470c21ab54ad8;hb=3bfdc14c713fb2b9c9ad0c9e9e87e32dee5fd165;hp=eeb445e83e8786df71ffbf36f3fd08d7bdbccce4;hpb=ee168310ec4227174ace489bf5f81f8c2f91cde0;p=debian%2Ftar diff --git a/lib/paxlib.h b/lib/paxlib.h index eeb445e8..d4251d14 100644 --- a/lib/paxlib.h +++ b/lib/paxlib.h @@ -21,7 +21,6 @@ #ifndef _paxlib_h_ #define _paxlib_h_ -#include #include /* Error reporting functions and definitions */ @@ -33,6 +32,8 @@ #define PAXEXIT_DIFFERS 1 #define PAXEXIT_FAILURE 2 +extern void (*error_hook) (void); + /* Both WARN and ERROR write a message on stderr and continue processing, however ERROR manages so tar will exit unsuccessfully. FATAL_ERROR writes a message on stderr and aborts immediately, with another message @@ -42,13 +43,31 @@ is zero when the error is not being detected by the system. */ #define WARN(Args) \ - error Args + do { if (error_hook) error_hook (); error Args; } while (0) #define ERROR(Args) \ - (error Args, exit_status = PAXEXIT_FAILURE) + do \ + { \ + if (error_hook) error_hook (); \ + error Args; \ + exit_status = PAXEXIT_FAILURE; \ + } \ + while (0) #define FATAL_ERROR(Args) \ - (error Args, fatal_exit ()) + do \ + { \ + if (error_hook) error_hook (); \ + error Args; \ + fatal_exit (); \ + } \ + while (0) #define USAGE_ERROR(Args) \ - (error Args, usage (PAXEXIT_FAILURE)) + do \ + { \ + if (error_hook) error_hook (); \ + error Args; \ + usage (PAXEXIT_FAILURE); \ + } \ + while (0) extern int exit_status; @@ -107,9 +126,6 @@ void fatal_exit (void) __attribute__ ((noreturn)); /* Name-related functions */ -bool hash_string_insert (Hash_table **table, char const *string); -bool hash_string_lookup (Hash_table const *table, char const *string); - bool removed_prefixes_p (void); char *safer_name_suffix (char const *file_name, bool link_target, bool absolute_names);