(c)  Copyright 1989 Commodore-Amiga, Inc.   All rights reserved.
The information contained herein is subject to change without notice, and 
is provided "as is" without warranty of any kind, either expressed or implied.  
The entire risk as to the use of this information is assumed by the user.



                            Infodata

                        by Bryce Nesbitt


Infodata is an example program that will print out the block size used 
by the current file system.  This can be used by programs that have internal 
buffers to exactly match the size of the internal buffer to the size of the
file system's buffer so that performance is enhanced.


/* infodata: by Bryce Nesbitt  Compiles under Manx 3.6 or Lattice 4.01

--EXAMPLE OUTPUT--
InfoData read for a:

id_BytesPerBlock	=512
id_NumBlocks		=108288
id_NumBlocksUsed	=86762
id_DiskState		=82
id_InUse		=527966
id_DiskType		=DOS0

Note: id_DiskType is three characters rather than a number.
The Fast Filing System currently returns DOS0.  This is
misleading.  Under V1.4 it will return the truth, "DOS1"

*/

#include "exec/types.h"
#include "libraries/dos.h"

ULONG	Lock(); /* Declare return values */
BOOL	Info();

struct InfoData MyInfoData;
ULONG		MyLock;

#define unless(x) if(!(x))  /* The opposite of if */

void main(argc,argv)
int argc;
char *argv[];
{
	unless( argc==2 )
	    {printf("Usage: infodata \"volume:\"\n"); exit(20);}
	unless( MyLock=Lock(argv[1],SHARED_LOCK) )
	    {printf("Can't find %s\n",argv[1]); exit(20);}
	unless( Info(MyLock,&MyInfoData) )
	    {UnLock(MyLock); exit(20);}
	UnLock(MyLock);

	printf("\nInfoData read for %s\n\n",argv[1]);
	printf("id_BytesPerBlock\t=%ld\n",MyInfoData.id_BytesPerBlock);
	printf("id_NumBlocks\t\t=%ld\n",MyInfoData.id_NumBlocks);
	printf("id_NumBlocksUsed\t=%ld\n",MyInfoData.id_NumBlocksUsed);
	printf("id_DiskState\t\t=%ld\n",MyInfoData.id_DiskState);
	printf("id_InUse\t\t=%ld\n",MyInfoData.id_InUse);
	printf("id_DiskType\t\t=%c%c%c%d\n",
				      ((char *)&MyInfoData.id_DiskType)[0],
				      ((char *)&MyInfoData.id_DiskType)[1],
				      ((char *)&MyInfoData.id_DiskType)[2],
				      ((char *)&MyInfoData.id_DiskType)[3]);
	printf("Note: id_DiskType is three characters then a number.\n");
	printf("FastFilingSystem currently returns DOS0... this\n");
	printf("misleading.  Under V1.4 it will return the truth, \"DOS1\"\n");
}

