From 4f52950690cf23be3c781cd45065f9046c84aad7 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 19 Dec 2003 00:59:36 +0000 Subject: [project @ 2003-12-19 00:59:36 by jmb] Move version string creation to utils for easy access svn path=/import/netsurf/; revision=432 --- utils/utils.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'utils/utils.c') diff --git a/utils/utils.c b/utils/utils.c index 8fcbc7f44..98038cfe8 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -15,6 +15,7 @@ #include "libxml/encoding.h" #include "libxml/uri.h" #include "netsurf/utils/log.h" +#include "netsurf/utils/messages.h" #include "netsurf/utils/utils.h" void die(const char * const error) @@ -291,3 +292,36 @@ bool is_dir(const char *path) return S_ISDIR(s.st_mode) ? true : false; } + +/** + * Fills in the version string. + * The release version is defined in the Messages file. + */ +char *populate_version(void) { + + const char *version = "%s (%s %s %s)"; /**< version string prototype */ + char *p; + char *day; + char *mon; + char *year; + char *temp = xcalloc(12, sizeof(char)); + char *ret = xcalloc(30, sizeof(char)); + + sprintf(temp, "%s", __DATE__); + p = strchr(temp, ' '); + *p = 0; + mon = strdup(temp); + if (strchr(p+1, ' ') == p+1) + day = p+2; + else + day = p+1; + p = strchr(day, ' '); + *p = 0; + year = p+1; + + sprintf(ret, version, messages_get("Version:CVS Test Build"), day, mon, year); + + xfree(temp); + + return ret; +} -- cgit v1.2.3