diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-04-14 16:41:43 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-04-14 16:41:43 (GMT) |
commit | 7d8b8f129d03569a6af39e22a51fae6c36009e09 (patch) | |
tree | 9b84dd34217b583f4bb35ddcb0f2c4ef13b92cfa | |
parent | 2fac8dfcbc095338240c87b86fc91411b22de699 (diff) | |
download | hdf5-7d8b8f129d03569a6af39e22a51fae6c36009e09.zip hdf5-7d8b8f129d03569a6af39e22a51fae6c36009e09.tar.gz hdf5-7d8b8f129d03569a6af39e22a51fae6c36009e09.tar.bz2 |
[svn-r8352] Purpose:
bug fix
Description:
the routine for reading the options from a file had the "old" parse syntax
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
-rw-r--r-- | tools/h5repack/h5repack.c | 27 | ||||
-rw-r--r-- | tools/h5repack/h5repack.sh | 2 |
2 files changed, 22 insertions, 7 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 21166b7..bd89ca0 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -397,14 +397,23 @@ void read_info(const char *filename, FILE *fp; char c; int i, rc=1; + char *srcdir = getenv("srcdir"); /* the source directory */ + char data_file[512]=""; /* buffer to hold name of existing file */ + + /* compose the name of the file to open, using the srcdir, if appropriate */ + if (srcdir){ + strcpy(data_file,srcdir); + strcat(data_file,"/"); + } + strcat(data_file,filename); - if ((fp = fopen(filename, "r")) == (FILE *)NULL) { + if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { printf( "Cannot open options file %s", filename); exit(1); } - /* Cycle until end of file reached */ + /* cycle until end of file reached */ while( 1 ) { rc=fscanf(fp, "%s", stype); @@ -419,17 +428,20 @@ void read_info(const char *filename, /* find begining of info */ i=0; c='0'; - while( c!='"' ) + while( c!=' ' ) { fscanf(fp, "%c", &c); + if (feof(fp)) break; } c='0'; /* go until end */ - while( c!='"' ) + while( c!=' ' ) { fscanf(fp, "%c", &c); comp_info[i]=c; i++; + if (feof(fp)) break; + if (c==10 /*eol*/) break; } comp_info[i-1]='\0'; /*cut the last " */ @@ -446,17 +458,20 @@ void read_info(const char *filename, /* find begining of info */ i=0; c='0'; - while( c!='"' ) + while( c!=' ' ) { fscanf(fp, "%c", &c); + if (feof(fp)) break; } c='0'; /* go until end */ - while( c!='"' ) + while( c!=' ' ) { fscanf(fp, "%c", &c); comp_info[i]=c; i++; + if (feof(fp)) break; + if (c==10 /*eol*/) break; } comp_info[i-1]='\0'; /*cut the last " */ diff --git a/tools/h5repack/h5repack.sh b/tools/h5repack/h5repack.sh index df7a7a3..f1a6281 100644 --- a/tools/h5repack/h5repack.sh +++ b/tools/h5repack/h5repack.sh @@ -169,7 +169,7 @@ TOOLTEST test4.h5 -f dset_all:GZIP=1 TOOLTEST test4.h5 -f GZIP=1 -m 1024 #file -#TOOLTEST test4.h5 -e h5repack_info.txt +TOOLTEST test4.h5 -e ../testfiles/h5repack_info.txt if test $nerrors -eq 0 ; then echo "All $H5REPACK tests passed." |