home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / hdf / unix / hdf3_2r2 / test / tvers.c < prev   
Encoding:
C/C++ Source or Header  |  1992-10-29  |  2.6 KB  |  96 lines

  1. /***************************************************************************
  2. *
  3. *
  4. *                         NCSA HDF version 3.2r2
  5. *                            October 30, 1992
  6. *
  7. * NCSA HDF Version 3.2 source code and documentation are in the public
  8. * domain.  Specifically, we give to the public domain all rights for future
  9. * licensing of the source code, all resale rights, and all publishing rights.
  10. *
  11. * We ask, but do not require, that the following message be included in all
  12. * derived works:
  13. *
  14. * Portions developed at the National Center for Supercomputing Applications at
  15. * the University of Illinois at Urbana-Champaign, in collaboration with the
  16. * Information Technology Institute of Singapore.
  17. *
  18. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  19. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  20. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  21. *
  22. ****************************************************************************
  23. */
  24.  
  25. #ifdef RCSID
  26. static char RcsId[] = "@(#)$Revision: 1.2 $";
  27. #endif
  28. /*
  29. $Header: /hdf/hdf/v3.2r2/test/RCS/tvers.c,v 1.2 1992/02/10 22:00:57 chouck beta koziol $
  30.  
  31. $Log: tvers.c,v $
  32.  * Revision 1.2  1992/02/10  22:00:57  chouck
  33.  * Fixed earliest recognizable version
  34.  *
  35.  * Revision 1.1  1992/02/10  20:59:34  chouck
  36.  * Initial revision
  37.  *
  38. */
  39. /*
  40. ***********************************************************************
  41. ** get version string from an HDF file
  42. ***********************************************************************
  43. */
  44.  
  45. #include <stdio.h>
  46. #include "hdf.h"
  47.  
  48. int main(argc, argv)
  49.      int argc;
  50.      char *argv[];
  51. {
  52.   int i, j, ret;
  53.   int32 f;
  54.   uint32 fmajor, fminor, frelease;
  55.   uint32 lmajor, lminor, lrelease;
  56.   char fstring[81], lstring[81], output[256];
  57.  
  58.   ret = Hgetlibversion(&lmajor, &lminor, &lrelease, lstring);
  59.   printf("Library Version\n");
  60.   printf("---------------\n");
  61.   printf("Major:\t\t%d\nMinor:\t\t%d\nRelease:\t%d\nString:\t\t\"%s\"\n\n\n",
  62.      lmajor, lminor, lrelease, lstring);
  63.  
  64.   for (i=1; i<argc; i++) {
  65.     f = Hopen(argv[i], DFACC_READ, 0);
  66.     if (f < 0) {
  67.       printf("%s: not a hdf-file\n", argv[i]);
  68.     } else {
  69.       ret = Hgetfileversion(f, &fmajor, &fminor, &frelease, fstring);
  70.       sprintf(output, "File Version (%s)\n", argv[i]);
  71.       printf(output);
  72.       for(j = strlen(output) - 1; j; j--)
  73.     printf("-");    
  74.       if ((ret < 0) || ((fmajor == 0) && (fminor == 0))){
  75.     printf("\nEarlier than 3.2\n\n");
  76.       } else {
  77.     printf("\nMajor:\t\t%d\nMinor:\t\t%d\nRelease:\t%d\nString:\t\t\"%s\"\n\n",
  78.            fmajor, fminor, frelease, fstring);
  79.       }
  80.       Hclose(f);
  81.     }
  82.   }
  83.  
  84.   exit(0);
  85. }
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.