more debug info

This commit is contained in:
Dennis Heimbigner 2017-07-14 19:37:35 -06:00
parent 081963ef8a
commit 1b138ecf64
3 changed files with 41 additions and 14 deletions

View File

@ -16,9 +16,8 @@
#endif
#include "ncexternl.h"
#include "ncwinpath.h"
#undef PATHDEBUG
#include "ncwinpath.h"
/*
Code to provide some path conversion code so that
@ -40,6 +39,9 @@ static char* windrive = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static size_t cdlen = 10; /* strlen("/cygdrive/") */
static int pathdebug = -1;
static int pathformat = -1;
EXTERNL
char* /* caller frees */
NCpathcvt(const char* path)
@ -50,6 +52,17 @@ NCpathcvt(const char* path)
size_t pathlen;
if(path == NULL) goto done; /* defensive driving */
/* Check for path debug env vars */
if(pathformat < 0) {
const char* s = getenv("NCPATHFORMAT");
pathformat = (s == NULL ? 0 : 1);
}
if(pathdebug < 0) {
const char* s = getenv("NCPATHDEBUG");
pathdebug = (s == NULL ? 0 : 1);
}
pathlen = strlen(path);
/* 1. look for MSYS path /D/... */
@ -109,21 +122,22 @@ slashtrans:
for(;*p;p++) {
if(*p == '/') {*p = '\\';}
}
#ifdef PATHDEBUG
if(pathformat > 0) {
#ifndef _MSC_VER
/* Convert '\' back to '/' */
for(;*p;p++) {
if(*p == '\\') {*p = '/';}
p = outpath;
/* Convert '\' back to '/' */
for(;*p;p++) {
if(*p == '\\') {*p = '/';}
}
}
#endif /*!_MSC_VER*/
#endif /*PATHDEBUG*/
done:
#ifdef PATHDEBUG
fprintf(stderr,"XXXX: inpath=|%s| outpath=|%s|\n",
path?path:"NULL",outpath?outpath:"NULL");
fflush(stderr);
#endif
if(pathdebug) {
fprintf(stderr,"XXXX: inpath=|%s| outpath=|%s|\n",
path?path:"NULL",outpath?outpath:"NULL");
fflush(stderr);
}
return outpath;
}

View File

@ -5,5 +5,16 @@ export SETX=1
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
/g/netcdf-c/build/ncdump/ncdump.exe '[log][cache]file:///g/netcdf-c/ncdap_test/testdata3/ber-2002-10-01.nc'
export NCPATHDEBUG=1
#export NCPATHFORMAT=1
F="ber-2002-10-01.nc"
PWD=`pwd`
EXPECTED="${PWD}/expected3"
URL='[log][cache]file://'
URL="${URL}${PWD}/testdata3/$F"
rm -f ./tmp
${NCDUMP} "${URL}" >./tmp
diff -w ${EXPECTED}/$F.dmp ./tmp
exit

View File

@ -32,9 +32,11 @@ test.sds2 test.sds3 test.sds4 test.sds5 \
test.sds6 test.sds7 test.vs1 \
test.vs2 test.vs3 test.vs4 test.vs5 whoi"
# ber-2002-10-01.nc
ACTUALDATA2=\
"123bears.nc 123.nc bears.nc \
ber-2002-10-01.nc ceopL2AIRS2-2.nc \
ceopL2AIRS2-2.nc \
data.nc fnoc1.nc \
in1.nc in_2.nc in.nc \
in_no_three_double_dmn.nc in_v.nc saco1.nc \