Commit a7561faa authored by Lucas Russo's avatar Lucas Russo

src/libs/*/{src/include}/bpm_client_revision.*: add build info functions

parent 9f10044a
......@@ -12,10 +12,50 @@
extern "C" {
#endif
extern const char *build_revision;
extern const char *build_date;
extern const char *build_user_name;
extern const char *build_user_email;
/* Clone the build revision. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_revision (void);
/* Copies the build revision into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_revision (char *dest, size_t size);
/* Returns a const reference to build revision */
const char *revision_get_build_revision (void);
/* Clone the build date. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_date (void);
/* Copies the build date into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_date (char *dest, size_t size);
/* Returns a const reference to build version */
const char *revision_get_build_date (void);
/* Clone the build user name. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_user_name (void);
/* Copies the build user name into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_user_name (char *dest, size_t size);
/* Returns a const reference to build user name */
const char *revision_get_build_user_name (void);
/* Clone the build user email. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_user_email (void);
/* Copies the build user email into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_user_email (char *dest, size_t size);
/* Returns a const reference to build user email */
const char *revision_get_build_user_email (void);
/* Clone the build version. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_version (void);
/* Copies the build version into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_version (char *dest, size_t size);
/* Returns a const reference to build version */
const char *revision_get_build_version (void);
#ifdef __cplusplus
}
......
......@@ -13,5 +13,89 @@
#define BPM_CLIENT_VERSION_MINOR_STR STRINGIFY(BPM_CLIENT_VERSION_MINOR)
#define BPM_CLIENT_VERSION_PATCH_STR STRINGIFY(BPM_CLIENT_VERSION_PATCH)
const char *build_revision = GIT_REVISION;
const char *build_date = __DATE__ " " __TIME__;
static const char *build_revision = GIT_REVISION;
static const char *build_date = __DATE__ " " __TIME__;
static const char *build_user_name = GIT_USER_NAME;
static const char *build_user_email = GIT_USER_EMAIL;
static const char *build_version = BPM_CLIENT_VERSION_MAJOR_STR"."BPM_CLIENT_VERSION_MINOR_STR"."BPM_CLIENT_VERSION_PATCH_STR;
/************************* Clone functions ***********************************/
char *revision_clone_build_revision (void)
{
return hutils_clone_str (build_revision);
}
char *revision_clone_build_date (void)
{
return hutils_clone_str (build_date);
}
char *revision_clone_build_user_name (void)
{
return hutils_clone_str (build_user_name);
}
char *revision_clone_build_user_email (void)
{
return hutils_clone_str (build_user_email);
}
char *revision_clone_build_version (void)
{
return hutils_clone_str (build_version);
}
/************************* Get Const functions ********************************/
const char *revision_get_build_revision (void)
{
return build_revision;
}
const char *revision_get_build_date (void)
{
return build_date;
}
const char *revision_get_build_user_name (void)
{
return build_user_name;
}
const char *revision_get_build_user_email (void)
{
return build_user_email;
}
const char *revision_get_build_version (void)
{
return build_version;
}
/*************************** Copy functions **********************************/
int revision_copy_build_revision (char *dest, size_t size)
{
return hutils_copy_str (dest, build_revision, size);
}
int revision_copy_build_date (char *dest, size_t size)
{
return hutils_copy_str (dest, build_date, size);
}
int revision_copy_build_user_name (char *dest, size_t size)
{
return hutils_copy_str (dest, build_user_name, size);
}
int revision_copy_build_user_email (char *dest, size_t size)
{
return hutils_copy_str (dest, build_user_email, size);
}
int revision_copy_build_version (char *dest, size_t size)
{
return hutils_copy_str (dest, build_version, size);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment