home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol1 / dos / infodata < prev    next >
Text File  |  1990-01-26  |  2KB  |  76 lines

  1. (c)  Copyright 1989 Commodore-Amiga, Inc.   All rights reserved.
  2. The information contained herein is subject to change without notice, and 
  3. is provided "as is" without warranty of any kind, either expressed or implied.  
  4. The entire risk as to the use of this information is assumed by the user.
  5.  
  6.  
  7.  
  8.                             Infodata
  9.  
  10.                         by Bryce Nesbitt
  11.  
  12.  
  13. Infodata is an example program that will print out the block size used 
  14. by the current file system.  This can be used by programs that have internal 
  15. buffers to exactly match the size of the internal buffer to the size of the
  16. file system's buffer so that performance is enhanced.
  17.  
  18.  
  19. /* infodata: by Bryce Nesbitt  Compiles under Manx 3.6 or Lattice 4.01
  20.  
  21. --EXAMPLE OUTPUT--
  22. InfoData read for a:
  23.  
  24. id_BytesPerBlock    =512
  25. id_NumBlocks        =108288
  26. id_NumBlocksUsed    =86762
  27. id_DiskState        =82
  28. id_InUse        =527966
  29. id_DiskType        =DOS0
  30.  
  31. Note: id_DiskType is three characters rather than a number.
  32. The Fast Filing System currently returns DOS0.  This is
  33. misleading.  Under V1.4 it will return the truth, "DOS1"
  34.  
  35. */
  36.  
  37. #include "exec/types.h"
  38. #include "libraries/dos.h"
  39.  
  40. ULONG    Lock(); /* Declare return values */
  41. BOOL    Info();
  42.  
  43. struct InfoData MyInfoData;
  44. ULONG        MyLock;
  45.  
  46. #define unless(x) if(!(x))  /* The opposite of if */
  47.  
  48. void main(argc,argv)
  49. int argc;
  50. char *argv[];
  51. {
  52.     unless( argc==2 )
  53.         {printf("Usage: infodata \"volume:\"\n"); exit(20);}
  54.     unless( MyLock=Lock(argv[1],SHARED_LOCK) )
  55.         {printf("Can't find %s\n",argv[1]); exit(20);}
  56.     unless( Info(MyLock,&MyInfoData) )
  57.         {UnLock(MyLock); exit(20);}
  58.     UnLock(MyLock);
  59.  
  60.     printf("\nInfoData read for %s\n\n",argv[1]);
  61.     printf("id_BytesPerBlock\t=%ld\n",MyInfoData.id_BytesPerBlock);
  62.     printf("id_NumBlocks\t\t=%ld\n",MyInfoData.id_NumBlocks);
  63.     printf("id_NumBlocksUsed\t=%ld\n",MyInfoData.id_NumBlocksUsed);
  64.     printf("id_DiskState\t\t=%ld\n",MyInfoData.id_DiskState);
  65.     printf("id_InUse\t\t=%ld\n",MyInfoData.id_InUse);
  66.     printf("id_DiskType\t\t=%c%c%c%d\n",
  67.                       ((char *)&MyInfoData.id_DiskType)[0],
  68.                       ((char *)&MyInfoData.id_DiskType)[1],
  69.                       ((char *)&MyInfoData.id_DiskType)[2],
  70.                       ((char *)&MyInfoData.id_DiskType)[3]);
  71.     printf("Note: id_DiskType is three characters then a number.\n");
  72.     printf("FastFilingSystem currently returns DOS0... this\n");
  73.     printf("misleading.  Under V1.4 it will return the truth, \"DOS1\"\n");
  74. }
  75.  
  76.