[cig-commits] r4510 - mc/3D/CitcomS/trunk/visual
luis at geodynamics.org
luis at geodynamics.org
Sun Sep 10 17:09:54 PDT 2006
Author: luis
Date: 2006-09-10 17:09:53 -0700 (Sun, 10 Sep 2006)
New Revision: 4510
Modified:
mc/3D/CitcomS/trunk/visual/h5tocap.c
Log:
When no frames are specified, print number of available frames.
Modified: mc/3D/CitcomS/trunk/visual/h5tocap.c
===================================================================
--- mc/3D/CitcomS/trunk/visual/h5tocap.c 2006-09-10 09:50:56 UTC (rev 4509)
+++ mc/3D/CitcomS/trunk/visual/h5tocap.c 2006-09-11 00:09:53 UTC (rev 4510)
@@ -139,31 +139,26 @@
status = read_steps(h5file, &steps, &numsteps);
- if (argc > 2)
+ if (argc == 2)
{
- if (strcmp(argv[2], "-l") == 0)
- {
- printf("Found %d frames in file \"%s\"\n\n", numsteps, argv[1]);
- printf("\tsteps = [");
- for (n = 0; n < numsteps; n++)
- printf(" %d%c", steps[n], ((n<numsteps-1) ? ',' : ' '));
- printf("]\n\n");
- status = H5Fclose(h5file);
- return EXIT_FAILURE;
- }
+ printf("Found %d frames in the file \"%s\"\n\n", numsteps, argv[1]);
+ printf("Usage: %s file.h5 [frame1 [frame2 [...]]]\n", argv[0]);
+ printf("\tPlease specify frames in the range [0,%d]\n", numsteps-1);
+
+ status = H5Fclose(h5file);
+ free(steps);
+
+ return EXIT_FAILURE;
}
/*
* Read frame(s) from argv[2:]
*/
- /* Allocate at least one step (we know argc >= 2) */
- timesteps = (argc == 2) ? 1 : (argc-2);
+ /* Allocate at least one step (we know argc > 2) */
+ timesteps = argc-2;
frames = (int *)malloc(timesteps * sizeof(int));
- /* By default, use zeroth step (might be overwritten) */
- frames[0] = 0;
-
/* Convert argv[2:] into int array */
for(n = 2; n < argc; n++)
{
More information about the cig-commits
mailing list