mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Imported MaNGOS revision 6767 from http://mangos.svn.sourceforge.net/svnroot/mangos/trunk/
This commit is contained in:
parent
d767495d5b
commit
800ee76535
3322 changed files with 903437 additions and 0 deletions
23
src/tools/Makefile.am
Normal file
23
src/tools/Makefile.am
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Sub-directories to parse
|
||||
SUBDIRS = gensvnrevision
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
# Nothing yet.
|
||||
35
src/tools/gensvnrevision/Makefile.am
Normal file
35
src/tools/gensvnrevision/Makefile.am
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## CPP flags for includes, defines, etc.
|
||||
AM_CPPFLAGS = -I$(srcdir)
|
||||
|
||||
## Build world list daemon as standalone program
|
||||
bin_PROGRAMS = gensvnrevision
|
||||
gensvnrevision_SOURCES = \
|
||||
gensvnrevision.cpp
|
||||
|
||||
## Link world daemon against the shared library
|
||||
gensvnrevision_LDADD =
|
||||
gensvnrevision_LDFLAGS = -L$(libdir)
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
# Include world daemon configuration
|
||||
#EXTRA_DIST =
|
||||
|
||||
## Additional files to install
|
||||
103
src/tools/gensvnrevision/gensvnrevision.cpp
Normal file
103
src/tools/gensvnrevision/gensvnrevision.cpp
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::string path;
|
||||
|
||||
if(argc >= 1 && argv[1] )
|
||||
{
|
||||
path = argv[1];
|
||||
if(path.size() > 0 && (path[path.size()-1]!='/' || path[path.size()-1]!='\\'))
|
||||
path += '/';
|
||||
}
|
||||
|
||||
FILE* EntriesFile = fopen((path+".svn/entries").c_str(), "r");
|
||||
if(!EntriesFile)
|
||||
EntriesFile = fopen((path+"_svn/entries").c_str(), "r");
|
||||
|
||||
std::ostringstream newData;
|
||||
|
||||
if(!EntriesFile)
|
||||
{
|
||||
newData << "#ifndef __SVN_REVISION_H__" << std::endl;
|
||||
newData << "#define __SVN_REVISION_H__" << std::endl;
|
||||
newData << " #define SVN_REVISION \"Unknown\"" << std::endl;
|
||||
newData << " #define SVN_DATE \"Unknown\"" << std::endl;
|
||||
newData << " #define SVN_TIME \"Unknown\""<< std::endl;
|
||||
newData << "#endif // __SVN_REVISION_H__" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[200];
|
||||
int revision;
|
||||
char date_str[200];
|
||||
char time_str[200];
|
||||
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fscanf(EntriesFile,"%i",&revision);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fscanf(EntriesFile,"%10sT%8s",date_str,time_str);
|
||||
|
||||
newData << "#ifndef __SVN_REVISION_H__" << std::endl;
|
||||
newData << "#define __SVN_REVISION_H__" << std::endl;
|
||||
newData << " #define SVN_REVISION \"" << revision << "\"" << std::endl;
|
||||
newData << " #define SVN_DATE \"" << date_str << "\"" << std::endl;
|
||||
newData << " #define SVN_TIME \"" << time_str << "\""<< std::endl;
|
||||
newData << "#endif // __SVN_REVISION_H__" << std::endl;
|
||||
|
||||
fclose(EntriesFile);
|
||||
}
|
||||
|
||||
std::string oldData;
|
||||
|
||||
if(FILE* HeaderFile = fopen("svn_revision.h","rb"))
|
||||
{
|
||||
while(!feof(HeaderFile))
|
||||
{
|
||||
int c = fgetc(HeaderFile);
|
||||
if(c < 0)
|
||||
break;
|
||||
oldData += (char)c;
|
||||
}
|
||||
|
||||
fclose(HeaderFile);
|
||||
}
|
||||
|
||||
if(newData.str() != oldData)
|
||||
{
|
||||
if(FILE* OutputFile = fopen("svn_revision.h","wb"))
|
||||
{
|
||||
fprintf(OutputFile,"%s",newData.str().c_str());
|
||||
fclose(OutputFile);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue