]> icculus.org git repositories - icculus/xz.git/blob - src/xz/main.h
Cleanups to the code that detects the amount of RAM and
[icculus/xz.git] / src / xz / main.h
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       main.h
4 /// \brief      Miscellanous declarations
5 //
6 //  Copyright (C) 2008 Lasse Collin
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Lesser General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2.1 of the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Lesser General Public License for more details.
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 /// Possible exit status values. These are the same as used by gzip and bzip2.
21 enum exit_status_type {
22         E_SUCCESS  = 0,
23         E_ERROR    = 1,
24         E_WARNING  = 2,
25 };
26
27
28 /// Sets the exit status after a warning or error has occurred. If new_status
29 /// is EX_WARNING and the old exit status was already EX_ERROR, the exit
30 /// status is not changed.
31 extern void set_exit_status(enum exit_status_type new_status);
32
33
34 /// Exits the program using the given status. This takes care of closing
35 /// stdin, stdout, and stderr and catches possible errors. If we had got
36 /// a signal, this function will raise it so that to the parent process it
37 /// appears that we were killed by the signal sent by the user.
38 extern void my_exit(enum exit_status_type status) lzma_attribute((noreturn));