From 9ea02a170cc28c6369ab7eeae09c140fbb3d5954 Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Sat, 27 Nov 2004 17:24:18 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@381 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/common/core.c') diff --git a/src/common/core.c b/src/common/core.c index 6bf68c47f..167b38efb 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -7,11 +7,13 @@ #include #endif #include +#include #include "core.h" #include "socket.h" #include "timer.h" #include "version.h" +#include "showmsg.h" #ifdef MEMWATCH #include "memwatch.h" @@ -51,6 +53,23 @@ static void sig_proc(int sn) } } +int get_svn_revision(char *svnentry) { // Warning: minor syntax checking + char line[1024]; + int rev = 0; + FILE *fp; + if ((fp = fopen(svnentry, "r")) == NULL) { + return 0; + } else { + while (fgets(line,1023,fp)) if (strstr(line,"revision=")) break; + fclose(fp); + if (sscanf(line," %*[^\"]\"%d%*[^\n]",&rev)==1) + return rev; + else + return 0; + } +// return 0; +} + /*====================================== * CORE : Display title *-------------------------------------- @@ -58,6 +77,7 @@ static void sig_proc(int sn) static void display_title(void) { + int revision; // for help with the console colors look here: // http://www.edoceo.com/liberum/?doc=printf-with-color // some code explanation (used here): @@ -82,6 +102,11 @@ static void display_title(void) printf("\033[0;44m (\033[1m \033[0;44m)\033[K\033[0m\n"); // yellow writing (33) printf("\033[0;44m (\033[1;33m Advanced Fusion Maps (c) 2003-2004 The Fusion Project \033[0;44m)\033[K\033[0m\n"); // yellow writing (33) printf("\033[37;44m (=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)\033[K\033[0m\n\n"); // reset color + + if ((revision = get_svn_revision(".svn\\entries"))>0) { + snprintf(tmp_output,sizeof(tmp_output),"SVN Revision: %d.\n",revision); + ShowInfo(tmp_output); + } } // Added by Gabuzomeu -- cgit v1.2.3-70-g09d2