add -v version option to map_extractor

--HG--
branch : trunk
This commit is contained in:
Tartalo
2010-06-09 17:20:06 +02:00
parent 5ee985b231
commit bddfebb0c7
2 changed files with 20 additions and 6 deletions
+1 -3
View File
@@ -9,12 +9,10 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cmake_minimum_required (VERSION 2.6)
project (TRINITY_MAP_EXTRACTOR)
file(GLOB sources *.cpp) file(GLOB sources *.cpp)
file(GLOB loadlib_sources loadlib/*.cpp) file(GLOB loadlib_sources loadlib/*.cpp)
include_directories (${CMAKE_SOURCE_DIR}/src/server/shared)
include_directories (${CMAKE_SOURCE_DIR}/externals/libmpq) include_directories (${CMAKE_SOURCE_DIR}/externals/libmpq)
include_directories (${CMAKE_SOURCE_DIR}/src/tools/map_extractor) include_directories (${CMAKE_SOURCE_DIR}/src/tools/map_extractor)
include_directories (${CMAKE_SOURCE_DIR}/src/tools/map_extractor/loadlib) include_directories (${CMAKE_SOURCE_DIR}/src/tools/map_extractor/loadlib)
+16
View File
@@ -17,6 +17,8 @@
#include "loadlib/adt.h" #include "loadlib/adt.h"
#include "loadlib/wdt.h" #include "loadlib/wdt.h"
#include <fcntl.h> #include <fcntl.h>
#include "revision.h"
#define _MAP_EXTRACTOR_VERSION 2
#if defined( __GNUC__ ) #if defined( __GNUC__ )
#define _open open #define _open open
@@ -33,6 +35,7 @@
#else #else
#define OPEN_FLAGS (O_RDONLY | O_BINARY) #define OPEN_FLAGS (O_RDONLY | O_BINARY)
#endif #endif
extern ArchiveSet gOpenArchives; extern ArchiveSet gOpenArchives;
typedef struct typedef struct
@@ -120,6 +123,13 @@ void Usage(char* prg)
exit(1); exit(1);
} }
void Version(char* prg)
{
printf("TrinityCore Rev: " _REVISION " " _BUILD_DIRECTIVE " Hash: " _HASH "\n"\
"%s Ver: " _MAP_EXTRACTOR_VERSION, prg);
exit(0);
}
void HandleArgs(int argc, char * arg[]) void HandleArgs(int argc, char * arg[])
{ {
for(int c = 1; c < argc; ++c) for(int c = 1; c < argc; ++c)
@@ -162,6 +172,12 @@ void HandleArgs(int argc, char * arg[])
else else
Usage(arg[0]); Usage(arg[0]);
break; break;
case 'v':
if (c + 1 < argc) // all ok
Version(arg[0]);
else
Usage(arg[0]);
break;
} }
} }
} }