61 lines
1.8 KiB
C
61 lines
1.8 KiB
C
/* ************************************************************************** */
|
|
/* _____ _ */
|
|
/* core/version.c |_ _|__ _ _| |__ ___ _ _ */
|
|
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
|
|
/* | | (_) | |_| | | | | __/ |_| | */
|
|
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
|
|
/* Last updated: 2017/01/04 15:01:48 |___/ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include <libp7/internals.h>
|
|
#ifndef is_static
|
|
# include <unistd.h>
|
|
|
|
# define Q(x) #x
|
|
# define QUOTE(x) Q(x)
|
|
|
|
/* 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[] =
|
|
"libp7 v" QUOTE(VERSION) " (licensed under GPLv2)\n"
|
|
"Maintained by " QUOTE(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.";
|
|
|
|
/**
|
|
* __libp7_version:
|
|
* Display version when the library is executed.
|
|
*/
|
|
|
|
extern void __libp7_version(void)
|
|
__attribute__((noreturn));
|
|
void __libp7_version(void)
|
|
{
|
|
puts(version_message);
|
|
_exit(0);
|
|
}
|
|
|
|
#endif
|