home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / bbs / dlp100.zip / MF.C < prev    next >
C/C++ Source or Header  |  1993-06-25  |  2KB  |  90 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "ra.h"
  4.  
  5. main()
  6. {
  7. char WorkName[41];
  8. char Path[128];
  9. char FDBPath[128];
  10. char Line[80];
  11. unsigned int  AreaNum=0;
  12. unsigned char Mask;
  13. unsigned char PathSize;
  14. int i, j;
  15.  
  16. struct FILES    FilesRec;
  17. struct FILESHDR FHdrRec;
  18. struct CONFIG ConfigRec;
  19.  
  20. RAEnvr = getenv("RA");                 // get Files.RA location
  21. strcpy (Path, RAEnvr);
  22. strcat (Path, "\\CONFIG.RA");
  23.  
  24. if((CONFIG_RA=fopen(Path,"rb"))==NULL)         // open CONFIG.RA
  25.    { printf("\n\nUnable to open %s!\n", Path);
  26.      getch();
  27.      exit(1);
  28.    }
  29.  
  30. fseek(CONFIG_RA, 3089, SEEK_SET);
  31. ConfigRec.FDBPathSize=fgetc(CONFIG_RA);
  32. fgets(FDBPath, 60, CONFIG_RA);
  33. //j=fread(&ConfigRec, sizeof(ConfigRec), 1, CONFIG_RA);
  34. //strncpy (FDBPath, ConfigRec.FDBPath, ConfigRec.FDBPathSize);
  35. if(FDBPath[ConfigRec.FDBPathSize-1] =='\\')
  36.    FDBPath[ConfigRec.FDBPathSize-1]='\0';
  37. else
  38.    FDBPath[ConfigRec.FDBPathSize]='\0';
  39.  
  40. strcat (FDBPath, "\\HDR\\FDB");
  41. fclose(CONFIG_RA);
  42.  
  43. strcpy (Path, RAEnvr);
  44. strcat (Path, "\\FILES.RA");
  45.  
  46. if((FILES_RA=fopen(Path,"rb"))==NULL)
  47.    { printf("\n\nUnable to open %s!\n", Path);
  48.      getch();
  49.      exit(1);
  50.    }
  51. strcpy (Path, FDBPath);
  52.  
  53. while(fread(&FilesRec, sizeof(FilesRec), 1, FILES_RA)==1)
  54.  { AreaNum++;
  55.    if(FilesRec.NameSize)
  56.    { strncpy (WorkName, FilesRec.Name, FilesRec.NameSize);
  57.      WorkName[FilesRec.NameSize]='\0';
  58.      fprintf(stdout, "%5u\) %-40s    \n", AreaNum, WorkName);
  59.  
  60.      strcpy (FDBPath, Path);
  61.      itoa(AreaNum, Line, 10);
  62.      strcat (FDBPath, Line);
  63.      strcat (FDBPath, ".HDR");
  64.  
  65.      if((FILES_HDR=fopen(FDBPath,"rb"))==NULL)
  66.      fprintf(stdout, "       Unable to open %s!\n", FDBPath);
  67.      else
  68.       {
  69.        while(fread(&FHdrRec, sizeof(FHdrRec), 1, FILES_HDR)==1)
  70.      if(FHdrRec.Attrib1)
  71.        { strncpy (WorkName, FHdrRec.Name, FHdrRec.NameSize);
  72.          WorkName[FHdrRec.NameSize]='\0';
  73.          Mask = 0x80;
  74.          for (i=0; i < 8; ++i)
  75.           { if (Mask & FHdrRec.Attrib1)
  76.             Line[7-i]='X';
  77.         else
  78.             Line[7-i]='-';
  79.         Mask>>= 1;
  80.           }
  81.          Line[8]='\0';
  82.          fprintf(stdout, "       %-12s   %s\n", WorkName, Line);
  83.        }
  84.       }
  85.      fclose(FILES_HDR);
  86.    }
  87.  }
  88. fclose(FILES_RA);
  89. }
  90.