1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 // vim: expandtab:ts=8:sw=4:softtabstop=4:
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 /// \file       main.h
6 /// \brief      Miscellanous declarations
7 //
8 //  Author:     Lasse Collin
9 //
10 //  This file has been put into the public domain.
11 //  You can do whatever you want with this file.
12 //
13 ///////////////////////////////////////////////////////////////////////////////
14 
15 /// Possible exit status values. These are the same as used by gzip and bzip2.
16 enum exit_status_type {
17 	E_SUCCESS  = 0,
18 	E_ERROR    = 1,
19 	E_WARNING  = 2,
20 };
21 
22 
23 /// Sets the exit status after a warning or error has occurred. If new_status
24 /// is E_WARNING and the old exit status was already E_ERROR, the exit
25 /// status is not changed.
26 extern void set_exit_status(enum exit_status_type new_status);
27 
28 
29 /// Use E_SUCCESS instead of E_WARNING if something worth a warning occurs
30 /// but nothing worth an error has occurred. This is called when --no-warn
31 /// is specified.
32 extern void set_exit_no_warn(void);
33 
34 
35 /// Exits the program using the given status. This takes care of closing
36 /// stdin, stdout, and stderr and catches possible errors. If we had got
37 /// a signal, this function will raise it so that to the parent process it
38 /// appears that we were killed by the signal sent by the user.
39 extern void my_exit(enum exit_status_type status) lzma_attribute((noreturn));
40