Files
gsmartcontrol/src/gsc_main.cpp
T
Alexander Shaduri 77e3668173 Tagging 0.8.2:
Fixed gsmartcontrol_root.sh script to support distributions with no
        /usr/sbin in their users' paths (thanks to Erwan Velu).
    Added desktop auto-detection to gsmartcontrol_root.sh script. This allows
        us to use only one desktop file (thanks to Erwan Velu).
    Added debian package directory (named "debian.dist" for now to avoid
        control file conflicts with Build Service).
    Renamed gsmartcontrol_root.sh to gsmartcontrol-root, to make Debian happy.
    Added make targets for Windows packages (zip and NSIS).
    Fixed Windows-related issues (Vista is fully supported now).
    Fixed minor bugs:
        Smartctl parser is win32-locale-aware now.
        No more unnecessary parsing.
        No segfault on exit under Windows and Solaris.
        A friendlier message is displayed if smartctl was not found.
        No hilighted labels when switching tabs in Information window.
2010-12-26 19:34:23 +00:00

56 lines
1.4 KiB
C++

/**************************************************************************
Copyright:
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
#include <iostream> // cerr
#include <exception> // std::exception, std::set_terminate()
#include <cstdlib> // EXIT_*
#include "hz/hz_config.h" // HAVE_VERBOSE_TERMINATE_HANDLER
#include "gsc_init.h" // app_init_and_loop()
int main (int argc, char** argv)
{
// we still leave __GNUC__ for autoconf-less setups.
#if defined HAVE_VERBOSE_TERMINATE_HANDLER || defined __GNUC__
// Verbose uncaught exception handler
std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
#else
try {
#endif
// initialize stuff and enter the main loop
if (!app_init_and_loop(argc, argv))
return EXIT_FAILURE;
// print uncaught exceptions for non-gcc-compatible
#if !(defined HAVE_VERBOSE_TERMINATE_HANDLER || defined __GNUC__)
}
catch(std::exception& e) {
// don't use anything other than cerr here, it's the most safe option.
std::cerr << "main(): Unhandled exception: " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch(...) { // this guarantees proper unwinding in case of unhandled exceptions (win32 I think)
std::cerr << "main(): Unhandled unknown exception." << std::endl;
return EXIT_FAILURE;
}
#endif
return EXIT_SUCCESS;
}