home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / dirnfo.exe / DIRINFO.C next >
C/C++ Source or Header  |  1994-11-28  |  2KB  |  84 lines

  1. #define NWDOS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <nwcalls.h>
  6.  
  7. void main(int argc, char *argv[])
  8. {
  9.     NWCCODE ccode;
  10.     NWCONN_HANDLE connHandle;
  11.     char    *ptr;
  12.     NWDIR_HANDLE dirHandle;
  13.     NWVOL_NUM volNumber;
  14.     DIR_SPACE_INFO spaceInfo;
  15.     int i;
  16.  
  17.     char volName[200];
  18.     NWNUMBER totalBlocks;
  19.     NWNUMBER sectorsPerBlock;
  20.     NWNUMBER availableBlocks;
  21.  
  22.     NWCONN_HANDLE newConn;
  23.     char newPath[200];
  24.     long temp;
  25.  
  26.     if (argc < 3)
  27.     {
  28.         printf ("\nUsage:  DIRINFO ServerName VolumeNumber\n\n");
  29.         return;
  30.     }
  31.  
  32.     for (i = 0; i < argc; i++)
  33.         strupr (argv[i]);
  34.  
  35.     volNumber = atoi (argv[2]);
  36.  
  37.     ccode = NWCallsInit(NULL, NULL);
  38.  
  39.     ptr = strupr(argv[1]);  /* Convert Server Name to upper case */
  40.  
  41.     ccode = NWGetConnectionHandle(ptr, 0, &connHandle, 0);
  42.  
  43.     ccode = NWGetDirSpaceInfo (connHandle,
  44.         0,
  45.         volNumber,
  46.         &spaceInfo);
  47.     if (ccode == 0)
  48.     {
  49.         printf ("\nVolume Name: %s", spaceInfo.volName);
  50.  
  51.         printf ("\nNWGetDirSpaceInfo");
  52.         printf ("\nTotal Space: %ld K",
  53.             (spaceInfo.totalBlocks * spaceInfo.sectorsPerBlock)
  54.             / 2);
  55.         printf ("\nFree Space:  %ld K",
  56.             (spaceInfo.availableBlocks * spaceInfo.sectorsPerBlock)
  57.             / 2);
  58.         printf ("\nPurgeable:   %ld K",
  59.             (spaceInfo.purgeableBlocks * spaceInfo.sectorsPerBlock)
  60.             / 2);
  61.         printf ("\nSectors per Block:  %d", spaceInfo.sectorsPerBlock);
  62.     }
  63.  
  64.     printf ("\n\nNWGetVolumeInfoWithNumber");
  65.     ccode = NWGetVolumeInfoWithNumber (connHandle,
  66.         volNumber,
  67.         volName,
  68.         &totalBlocks,
  69.         §orsPerBlock,
  70.         &availableBlocks,
  71.         NULL,
  72.         NULL,
  73.         NULL);
  74.  
  75.     if (ccode == 0)
  76.     {
  77.         temp = (long) totalBlocks * (long) sectorsPerBlock / 2;
  78.         printf ("\nTotal Space: %ld K", temp);
  79.         temp = (long) availableBlocks * (long) sectorsPerBlock / 2;
  80.         printf ("\nFree Space:  %ld K", temp);
  81.         printf ("\nSectors per Block:  %d", sectorsPerBlock);
  82.     }
  83. }
  84.