1 #ifndef libjmmcg_core_exit_codes_hpp 2 #define libjmmcg_core_exit_codes_hpp 3 4 /****************************************************************************** 5 ** $Header: svn+ssh://jmmcg@svn.code.sf.net/p/libjmmcg/code/trunk/libjmmcg/core/exit_codes.hpp 2272 2018-03-17 22:21:39Z jmmcg $ 6 ** 7 ** Copyright (c) 2016 by J.M.McGuiness, coder@hussar.me.uk 8 ** 9 ** This library is free software; you can redistribute it and/or 10 ** modify it under the terms of the GNU Lesser General Public 11 ** License as published by the Free Software Foundation; either 12 ** version 2.1 of the License, or (at your option) any later version. 13 ** 14 ** This library is distributed in the hope that it will be useful, 15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 ** Lesser General Public License for more details. 18 ** 19 ** You should have received a copy of the GNU Lesser General Public 20 ** License along with this library; if not, write to the Free Software 21 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #include <cerrno> 25 #include <stdexcept> 26 #include <cstdint> 27 #include <string.h> 28 29 namespace jmmcg { 30 31 /// A nice enum for the exit codes from main(). 32 /** 33 Note use of POSIX compatibility macros & starting out custom errors at 129. Also note that we shouldn't exceed 255, as the exit code is truncated to 8 bits, which would cause problems... 34 */ 35 enum exit_codes : std::uint8_t { 36 exit_success=EXIT_SUCCESS, 37 exit_unknown_failure=EXIT_FAILURE, 38 exit_unknown_exception=129, 39 exit_print_help, 40 exit_print_version, 41 exit_stl_exception, 42 exit_jmmcg_exception, 43 exit_crt_exception, 44 exit_parameter_error 45 }; 46 47 } 48 49 #endif