#ifdef RCSID
static char RcsId[] = "@(#)$Revision: 1.1 $";
#endif
/*
$Header: /pita/work/HDF/dev/RCS/test/annotations/getSDSan.c,v 1.1 90/04/19 11:14:52 mfolk beta $

$Log:	getSDSan.c,v $
 * Revision 1.1  90/04/19  11:14:52  mfolk
 * Initial revision
 * 
*/
#include <stdio.h>
#include "df.h"
char *malloc();

main(argc,argv)
int argc;
char *argv[];
{
    int i, rank, dimsizes[3], desclen, count=1, ret;
    uint16 ref;
    char label[20], *s;
	
    if (argc != 2) {
        printf("Usage: %s infile\n\n\n", argv[0]);
        exit(1);
    }

    i = DFSDgetdims(argv[1],&rank,dimsizes,3);
    if (i < 0) 
        printf("\n****Unable to read scientific data set.****\n\n\n");

    while (i >= 0) {
        ref = DFSDlastref();
        ret = DFANgetlabel(argv[1], DFTAG_SDG, ref, label, 11);
        printf("\nData set # %d\n",count++);

        if (ret < 0) 
            printf("    No label\n");
        else 
            printf("    Label: %s\n", label);

        desclen = DFANgetdesclen(argv[1], DFTAG_SDG, ref);
        if (desclen < 0) 
            printf("    No description \n");
        else {
            s = malloc( desclen+1);
    	    DFANgetdesc(argv[1], DFTAG_SDG, ref, s, desclen);
	    s[desclen] = '\0';
            printf("    Description: %s\n", s);
        }
        i = DFSDgetdims(argv[1],&rank,dimsizes,3);
    }
    printf("\n+++++++++++++++++++++++++\n\n");
}

