summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2003-06-03 20:12:30 (GMT)
committerRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2003-06-03 20:12:30 (GMT)
commit112aff61caec385132f05fc50efe8d3ce3357929 (patch)
tree22889b4b241ac0b99a35d40d29c9d7f56dc14a63
parent360fc65279dd80220edfc68c91429cc3373a1abd (diff)
downloadhdf5-112aff61caec385132f05fc50efe8d3ce3357929.zip
hdf5-112aff61caec385132f05fc50efe8d3ce3357929.tar.gz
hdf5-112aff61caec385132f05fc50efe8d3ce3357929.tar.bz2
[svn-r6949] Purpose:
Minor corrections to match the man pages. Code provided by Pankaj. Description: * do not accept more than 30 file names * corrected error messages. Solution: Platforms tested: Tested on verbena. Already tested on several platforms before integration. Misc. update:
-rwxr-xr-xtools/h5import/h5import.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index c5e3ff7..8046ddf 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -38,7 +38,8 @@ int main(int argc, char *argv[])
const char *err6 = "Invalid dimensions - %s.\n";
const char *err7 = "Invalid type of data - %s.\n";
const char *err8 = "Invalid size of data - %s.\n";
-
+ const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+
(void) setvbuf(stderr, (char *) NULL, _IOLBF, 0);
(void) setvbuf(stdout, (char *) NULL, _IOLBF, 0);
@@ -77,12 +78,19 @@ int main(int argc, char *argv[])
switch (state)
{
- case 1: /* counting input files */
- (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]);
- in = &(opt.infiles[opt.fcount].in);
- opt.infiles[opt.fcount].config = 0;
- setDefaultValues(in, opt.fcount);
- opt.fcount++;
+ case 1: /* counting input files */
+ if (opt.fcount < 29) {
+ (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]);
+ in = &(opt.infiles[opt.fcount].in);
+ opt.infiles[opt.fcount].config = 0;
+ setDefaultValues(in, opt.fcount);
+ opt.fcount++;
+ }
+ else {
+ (void) fprintf(stderr, err9, argv[i]);
+ goto err;
+ }
+
break;
case 2: /* -c found; look for configfile */
@@ -113,7 +121,7 @@ int main(int argc, char *argv[])
if (parseDimensions(in, argv[i]) == -1)
{
(void) fprintf(stderr, err6, argv[i]);
- return (-1);
+ goto err;
}
break;
@@ -124,7 +132,7 @@ int main(int argc, char *argv[])
if (parsePathInfo(&in->path, argv[i]) == -1)
{
(void) fprintf(stderr, err5, argv[i]);
- return (-1);
+ goto err;
}
break;
@@ -135,7 +143,7 @@ int main(int argc, char *argv[])
if (getInputClass(in, argv[i]) == -1)
{
(void) fprintf(stderr, err7, argv[i]);
- return (-1);
+ goto err;
}
if (in->inputClass == 0 || in->inputClass == 4)
@@ -153,7 +161,7 @@ int main(int argc, char *argv[])
if (getInputSize(in, HDstrtol(argv[i], NULL, BASE_10)) == -1)
{
(void) fprintf(stderr, err8, argv[i]);
- return (-1);
+ goto err;
}
/*set default value for output-size */
in->outputSize = in->inputSize;
@@ -180,7 +188,7 @@ int main(int argc, char *argv[])
return(0);
err:
(void) fprintf(stderr, err4);
- return(1);
+ return(-1);
}
static int