explain_exit(3)                                                explain_exit(3)



NNAAMMEE
       explain_exit - print an explanation of exit status before exiting

SSYYNNOOPPSSIISS
       #include <libexplain/libexplain.h>
       void explain_exit_on_exit(void);
       void explain_exit_on_error(void);
       void explain_exit_cancel(void);

DDEESSCCRRIIPPTTIIOONN
       The  _e_x_p_l_a_i_n___e_x_i_t___o_n___e_x_i_t function may be used to have the calling pro-
       gram print an explanation of its  exit  status  (the  value  passed  to
       _e_x_i_t(3)  or  the  return  value from _m_a_i_n) immediately before it termi-
       nates.

       The _e_x_p_l_a_i_n___e_x_i_t___o_n___e_r_r_o_r function may be used to have the calling pro-
       gram print an explanation of its exit status immediately before it ter-
       minates, if that exit status is not EXIT_SUCCESS.

       The _e_x_p_l_a_i_n___e_x_i_t___c_a_n_c_e_l function may be used to cancel  the  effect  of
       the _e_x_p_l_a_i_n___e_x_i_t___o_n___e_x_i_t or _e_x_p_l_a_i_n___e_x_i_t___o_n___e_r_r_o_r function.

       These  functions  may  be called multiple times, and in any order.  The
       last called has precedence.  The explanation will never be printed more
       than once.

   CCaallll EExxiitt AAss NNoorrmmaall
       In  order  to have the explanation printed, simply call _e_x_i_t(3) as nor-
       mal, or return from _m_a_i_n as normal.  Do not call any of these functions
       in  order  to  exit  your program, they are called before you exit your
       program.

   CCaavveeaatt
       This functionality is only available on  systems  with  the  _o_n___e_x_i_t(3)
       system  call.   Unfortunately,  the _a_t_e_x_i_t(3) system call is not suffi-
       ciently capable, as it does not pass the exit status to the  registered
       function.

SSEEEE AALLSSOO
       _e_x_i_t(3) cause normal process termination

       _a_t_e_x_i_t(3)
               register a function to be called at normal process termination

       _o_n___e_x_i_t(3)
               register a function to be called at normal process termination

CCOOPPYYRRIIGGHHTT
       libexplain version 1.4
       Copyright (C) 2009 Peter Miller

AAUUTTHHOORR
       Written by Peter Miller <pmiller@opensource.org.au>



                                                               explain_exit(3)
