64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
/* *****************************************************************************
|
|
* core/version.c -- display the version message when run directly.
|
|
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
|
|
*
|
|
* This file is part of libg1m.
|
|
* libg1m is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation; either version 3.0 of the License,
|
|
* or (at your option) any later version.
|
|
*
|
|
* libg1m is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
* See the GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with libg1m; if not, see <http://www.gnu.org/licenses/>.
|
|
* ************************************************************************** */
|
|
#include <libg1m/internals.h>
|
|
#include <unistd.h>
|
|
|
|
/* get loglevel string */
|
|
#if LOGLEVEL == ll_info
|
|
# define LLS "info"
|
|
#elif LOGLEVEL == ll_warn
|
|
# define LLS "warn"
|
|
#elif LOGLEVEL == ll_error
|
|
# define LLS "error"
|
|
#elif LOGLEVEL == ll_fatal
|
|
# define LLS "fatal"
|
|
#elif LOGLEVEL == ll_none
|
|
# define LLS "none"
|
|
#else
|
|
# define LLS "unknown"
|
|
#endif
|
|
|
|
/**
|
|
* version_message:
|
|
* The message that should be displayed when the library is executed.
|
|
*/
|
|
|
|
static const char version_message[] =
|
|
"libg1m v" LIBG1M_VERSION " (licensed under LGPL3)\n"
|
|
"Maintained by " LIBG1M_MAINTAINER ".\n"
|
|
"\n"
|
|
"Compiled with the '" LLS "' loglevel.\n"
|
|
"\n"
|
|
"This is free software; see the source for copying conditions.\n"
|
|
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
|
"FITNESS FOR A PARTICULAR PURPOSE.";
|
|
|
|
/**
|
|
* __libg1m_version:
|
|
* Display version when the library is executed.
|
|
*/
|
|
|
|
extern void g1m__version(void)
|
|
__attribute__((noreturn));
|
|
void g1m__version(void)
|
|
{
|
|
puts(version_message);
|
|
_exit(0);
|
|
}
|