

/*
 *
 * Description
 *	Add property structure to OFF property list.
 *
 * Output
 *	OFFAddProperty returns a pointer to the newly-created and
 *	initialized property structure.
 *
 * Input
 *	Obj		Pointer to object to which property is to be added.
 *
 * Diagnostics
 *	Returns NULL if unsuccessful malloc'ing the property structure.
 *
 * Author
 *	Randi J. Rost
 *	Digital Equipment Corp.
 *	Workstation Systems Engineering
 *	Palo Alto, CA
 *
 * History
 *	17-Nov-86	Created
 */

#include <stdio.h>
#include "off.h"

OFFProperty *OFFAddProperty(Obj)
    OFFObjDesc	*Obj;	/* Pointer to object */

    {
    OFFProperty	**ppProp;
    OFFProperty	*newProp;

    ppProp = &(Obj->FirstProp);
    while (*ppProp != NULL) ppProp = &((*ppProp)->NextProp);

    newProp = (OFFProperty *) malloc(sizeof(OFFProperty));

    if (newProp == NULL)
	{
	fprintf(stderr, "OFFAddProperty: malloc failed\n");
	return(NULL);
	}

    *ppProp = newProp;
    newProp->PropName[0] = '\0';
    newProp->PropType = OFF_UNKNOWN_TYPE_DATA;
    newProp->PropFileName[0] = '\0';
    newProp->DataFormat[0] = '\0';
    newProp->PropCount = 0;
    newProp->PropData = NULL;
    newProp->NextProp = NULL;

    return(newProp);
    }
