55 lines
1.7 KiB
C
55 lines
1.7 KiB
C
/* ************************************************************************** */
|
|
/* _____ _ */
|
|
/* version.c |_ _|__ _ _| |__ ___ _ _ */
|
|
/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */
|
|
/* | | (_) | |_| | | | | __/ |_| | */
|
|
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
|
|
/* Last updated: 2016/10/31 00:14:27 |___/ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#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 __libg1m_version(void)
|
|
__attribute__((noreturn));
|
|
void __libg1m_version(void)
|
|
{
|
|
puts(version_message);
|
|
_exit(0);
|
|
}
|