#define CYLFILE "/snd/cylinders"
#include <stdio.h>
main()
{
	FILE *fp;
	char c;
	int fd;
	int nused, nfree, ncyls;

	nused = nfree = ncyls = 0;
	/*if((fp = fopen(CYLFILE, "r")) == NULL) {*/
	if((fd = open(CYLFILE, 0)) < 0) {
		fprintf(stderr,"bad open of %s\n", CYLFILE);
		exit(-1);
	}
	/* while(fscanf(fp,"%c", &c) != EOF) {*/
	while(read(fd,&c,1) > 0) {
		ncyls++;
		if(c == 'u') nused++;
		else if(c == 'f') nfree++;
		else {
			fprintf(stderr,"got bad char in file %s\n", CYLFILE);
			exit(-1);
		}
	}
	printf("Soundfile System:\n");
	printf("\tCylinders Used: %d\n\tCylinders Free: %d\n", 
		nused, nfree);
}
