-config.h
\ No newline at end of file
+config.h
+version.c
\ No newline at end of file
LINK=-lmysqlclient
all:
+ ./version.sh
+ gcc -g -O2 ${LIBS} -c version.c -o version.o ${CFLAGS}
gcc -g -O2 ${LIBS} -c IRCEvents.c -o IRCEvents.o ${CFLAGS}
gcc -g -O2 ${LIBS} -c main.c -o main.o ${CFLAGS}
gcc -g -O2 ${LIBS} -c ChanNode.c -o ChanNode.o ${CFLAGS}
#include "DBHelper.h"
#include "tools.h"
#include "timeq.h"
+#include "version.h"
#define BOTID 1
{"NS_NETINFO_CHANNEL", " Channel:"},
{"NS_NETINFO_USER", " User:"},
{"NS_NETINFO_CHANUSER", " Channel-User:"},
+ {"NS_NETINFO_VERSION", "Version:"},
+ {"NS_NETINFO_CODE", "Code:"},
+ {"NS_NETINFO_CODE_VALUE", "%s lines c code (view it at http://git.pk910.de/?p=NeonServV5.git;a=summary)"},
+ {"NS_NETINFO_COMPILER", "Compiler:"},
+ {"NS_NETINFO_COMPILER_VALUE", "%s (%s)"},
+
{NULL, NULL}
};
reply(getTextBot(), user, "NS_NETINFO_HEADER");
char tmp[MAXLEN];
struct Table *table;
- table = table_init(2, 7, 0);
+ table = table_init(2, 10, 0);
char *content[2];
content[0] = get_language_string(user, "NS_NETINFO_UPTIME");
content[1] = tmp;
table_add(table, content);
+ if(strcmp(revision, ""))
+ sprintf(tmp, "%s (%s)", NEONSERV_VERSION, revision);
+ else
+ strcpy(tmp, NEONSERV_VERSION);
+ content[0] = get_language_string(user, "NS_NETINFO_VERSION");
+ content[1] = tmp;
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_COMPILER");
+ content[1] = build_language_string(user, tmp, "NS_NETINFO_COMPILER_VALUE", COMPILER, creation);
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_CODE");
+ content[1] = build_language_string(user, tmp, "NS_NETINFO_CODE_VALUE", codelines);
+ table_add(table, content);
+
char **table_lines = table_end(table);
int i;
for(i = 0; i < table->entrys; i++) {
#ifndef _main_h
#define _main_h
+#define NEONSERV_VERSION "5.0.1-dev"
+
#include "config.h"
#include <stdio.h>
#define UNUSED_ARG(ARG) ARG
#endif
+#define STRINGIFY_(x) #x
+#define STRINGIFY(x) STRINGIFY_(x)
+
+#if defined(__GNUC__)
+#if defined(__GNUC_PATCHLEVEL__)
+#define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
+#else
+#define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__)
+#endif
+#elif defined (__IMAGECRAFT__)
+#define COMPILER "ICCAVR"
+#else
+#define COMPILER "Unknown"
+#endif
+
#define SOCKET_SELECT_TIME 2
#define NICKLEN 30
--- /dev/null
+#ifndef _version_h
+#define _version_h
+
+#include "main.h"
+
+extern const char *compilation;
+extern const char *creation;
+extern const char *revision;
+extern const char *codelines;
+
+#endif
\ No newline at end of file
--- /dev/null
+#! /bin/sh
+echo "Extracting version.c ..."
+
+if test -r version.c
+then
+ compilation=`sed -n 's/^const char \*compilation = \"\(.*\)\";/\1/p' < version.c`
+ if test ! "$compilation" ; then compilation=0; fi
+else
+ compilation=0
+fi
+
+compilation=`expr $compilation + 1`
+
+creation=`date | \
+awk '{if (NF == 6) \
+ { print $1 " " $2 " " $3 " " $6 " at " $4 " " $5 } \
+else \
+ { print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'`
+
+codelines=`find . -type f -regex '\./.*\.h' -or -regex '\./.*\.c' |xargs cat|wc -l`
+
+svn_revision=`svn info | grep Revision | grep -o -E '[0-9]+'`
+if test "x$svn_revision" = "x" ; then
+ svn_revision=`git log -n 1 --pretty="format:%h"`
+ if test "x$svn_revision" = "x" ; then
+ svn_revision="0"
+ else
+ git_commitcount=`git rev-list --all | wc -l | sed "s/[ \t]//g"`
+ svn_revision="git-$git_commitcount-$svn_revision"
+ fi
+else
+ svn_revision="svn-$svn_revision"
+fi
+
+
+/bin/cat >version.c <<!SUB!THIS!
+//Auto generated file!
+
+#include "version.h"
+
+const char *compilation = "$compilation";
+const char *creation = "$creation";
+const char *revision = "$svn_revision";
+const char *codelines = "$codelines";
+
+!SUB!THIS!
+