[project @ 2003-12-19 00:59:36 by jmb]

Move version string creation to utils for easy access

svn path=/import/netsurf/; revision=432
This commit is contained in:
John Mark Bell 2003-12-19 00:59:36 +00:00
parent 7ec54af359
commit 4f52950690
2 changed files with 35 additions and 0 deletions

View File

@ -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;
}

View File

@ -27,5 +27,6 @@ char *squash_tolat1(xmlChar *s);
char *url_join(const char* new, const char* base);
char *get_host_from_url(char* url);
bool is_dir(const char *path);
char * populate_version(void);
#endif