summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-04-14 16:41:43 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-04-14 16:41:43 (GMT)
commit7d8b8f129d03569a6af39e22a51fae6c36009e09 (patch)
tree9b84dd34217b583f4bb35ddcb0f2c4ef13b92cfa /tools/h5repack/h5repack.c
parent2fac8dfcbc095338240c87b86fc91411b22de699 (diff)
downloadhdf5-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:
Diffstat (limited to 'tools/h5repack/h5repack.c')
-rw-r--r--tools/h5repack/h5repack.c27
1 files changed, 21 insertions, 6 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 " */