diff --git a/tigge/CMakeLists.txt b/tigge/CMakeLists.txt index c8b199924..dbc9a093e 100644 --- a/tigge/CMakeLists.txt +++ b/tigge/CMakeLists.txt @@ -1,28 +1,35 @@ # tigge + +# library +ecbuild_add_library(TARGET tigge_tools + TYPE STATIC + NOINSTALL + SOURCES tigge_tools.c tigge_tools.h) + +# executables ecbuild_add_executable(TARGET tigge_check SOURCES tigge_check.c INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} - LIBS eccodes + LIBS eccodes tigge_tools ) - ecbuild_add_executable(TARGET tigge_name SOURCES tigge_name.c INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} CONDITION ECCODES_INSTALL_EXTRA_TOOLS - LIBS eccodes + LIBS eccodes tigge_tools ) ecbuild_add_executable(TARGET tigge_accumulations SOURCES tigge_accumulations.c INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} CONDITION ECCODES_INSTALL_EXTRA_TOOLS - LIBS eccodes + LIBS eccodes tigge_tools ) ecbuild_add_executable(TARGET tigge_split SOURCES tigge_split.c INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} CONDITION ECCODES_INSTALL_EXTRA_TOOLS - LIBS eccodes + LIBS eccodes tigge_tools ) diff --git a/tigge/tigge_check.c b/tigge/tigge_check.c index 8fdd365e4..32b3b74d1 100755 --- a/tigge/tigge_check.c +++ b/tigge/tigge_check.c @@ -27,6 +27,7 @@ #include #include #include +#include "tigge_tools.h" #define CHECK(a) check(#a,a) #define WARN(a) warn(#a,a) @@ -1308,7 +1309,7 @@ static void verify(grib_handle* h) } -static void validate(const char* path) +void validate(const char* path) { FILE *f = fopen(path,"r"); grib_handle *h = 0; @@ -1357,26 +1358,6 @@ static void validate(const char* path) } } -static void scan(const char* name) -{ - DIR *dir; - if((dir = opendir(name)) != NULL) - { - struct dirent* e; - char tmp[1024]; - while( (e = readdir(dir)) != NULL) - { - if(e->d_name[0] == '.') continue; - sprintf(tmp,"%s/%s",name,e->d_name); - scan(tmp); - } - - closedir(dir); - } - else - validate(name); -} - static void usage() { printf("tigge_check [options] grib_file grib_file ...\n"); diff --git a/tigge/tigge_name.c b/tigge/tigge_name.c index 25627842a..b3a9837b9 100755 --- a/tigge/tigge_name.c +++ b/tigge/tigge_name.c @@ -26,6 +26,7 @@ #include #include #include +#include "tigge_tools.h" /* #define CHECK(a) check(#a,a) */ #define NUMBER(a) (sizeof(a)/sizeof(a[0])) @@ -152,7 +153,7 @@ static void verify(grib_handle *h,const char* full,const char* base) } } -static void validate(const char* path) +void validate(const char* path) { FILE *f = fopen(path,"r"); grib_handle *h = 0; @@ -204,26 +205,6 @@ static void usage() exit(1); } -static void scan(const char* name) -{ - DIR *dir; - if((dir = opendir(name)) != NULL) - { - struct dirent* e; - char tmp[1024]; - while( (e = readdir(dir)) != NULL) - { - if(e->d_name[0] == '.') continue; - sprintf(tmp,"%s/%s",name,e->d_name); - scan(tmp); - } - - closedir(dir); - } - else - validate(name); -} - int main(int argc, char** argv) { int i = 1;