From 564ff68fbbf333609498537bd90c6d97d49ed8b4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 8 Mar 2016 23:32:18 +0100 Subject: [PATCH] first ideas --- code/C_helper.c | 24 ++++++++++++++++++++++++ code/IO.f90 | 3 +-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 code/C_helper.c diff --git a/code/C_helper.c b/code/C_helper.c new file mode 100644 index 000000000..950a5999e --- /dev/null +++ b/code/C_helper.c @@ -0,0 +1,24 @@ +/* Unix */ +#include +#include +#include +#include + +#define GETCWD getcwd + + +void getCurrentWorkDir(char *str,int *stat){ + if(GETCWD(str, sizeof(str)) == str){ + *stat = 0; + } + else{ + *stat = 1; + } +} + +int isDirectory(const char *path){ + struct stat statbuf; + if(stat(path, &statbuf) != 0) + return 0; + return S_ISDIR(statbuf.st_mode); +} diff --git a/code/IO.f90 b/code/IO.f90 index 1a36269c5..57eb23cb5 100644 --- a/code/IO.f90 +++ b/code/IO.f90 @@ -1237,8 +1237,7 @@ character(len=300) pure function IO_extractValue(pair,key) IO_extractValue = '' myChunk = scan(pair,SEP) - if (myChunk > 0 .and. pair(:myChunk-1) == key(:myChunk-1)) & - IO_extractValue = pair(myChunk+1:) ! extract value if key matches + if (myChunk > 0 .and. pair(:myChunk-1) == key) IO_extractValue = pair(myChunk+1:) ! extract value if key matches end function IO_extractValue