/*
 * NeXT-compatible SoundFile I/O functions
 *		stp--12/89
 */

#include <stdio.h>
#include <sound/soundstruct.h>
#include <sys/file.h>

void SNDWriteHeader(fd, sndStruct) int fd; SNDSoundStruct *sndStruct; {
	int i;

/*	if (sndStruct->dataLocation != sizeof(SNDSoundStruct)) {
			fprintf(stderr, "I can't handle comments in soundfile header yet.\n");
			exit(1);
	}
*/
	if (i = write(fd, sndStruct, sizeof(SNDSoundStruct)) != sizeof(SNDSoundStruct)) {
		fprintf(stderr, "can't write soundfile header.\n");
		exit(1);
	}
}

void SNDReadHeader(fd, sndStruct) int fd; SNDSoundStruct *sndStruct; {
	int i;

	if ((i = read(fd, sndStruct, sizeof(SNDSoundStruct))) != sizeof(SNDSoundStruct)) {
		fprintf(stderr, "Can't read soundfile header.\n");
/*		return();	*/
	}
/*
	if (sndStruct->dataLocation = sizeof(SNDSoundStruct))
		return;
	else {
			fprintf(stderr, "I can't handle comments in soundfile header yet.\n");
			exit(1);
	}
*/
}

