home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
bbs
/
dlp100.zip
/
MF.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-25
|
2KB
|
90 lines
#include <stdio.h>
#include <stdlib.h>
#include "ra.h"
main()
{
char WorkName[41];
char Path[128];
char FDBPath[128];
char Line[80];
unsigned int AreaNum=0;
unsigned char Mask;
unsigned char PathSize;
int i, j;
struct FILES FilesRec;
struct FILESHDR FHdrRec;
struct CONFIG ConfigRec;
RAEnvr = getenv("RA"); // get Files.RA location
strcpy (Path, RAEnvr);
strcat (Path, "\\CONFIG.RA");
if((CONFIG_RA=fopen(Path,"rb"))==NULL) // open CONFIG.RA
{ printf("\n\nUnable to open %s!\n", Path);
getch();
exit(1);
}
fseek(CONFIG_RA, 3089, SEEK_SET);
ConfigRec.FDBPathSize=fgetc(CONFIG_RA);
fgets(FDBPath, 60, CONFIG_RA);
//j=fread(&ConfigRec, sizeof(ConfigRec), 1, CONFIG_RA);
//strncpy (FDBPath, ConfigRec.FDBPath, ConfigRec.FDBPathSize);
if(FDBPath[ConfigRec.FDBPathSize-1] =='\\')
FDBPath[ConfigRec.FDBPathSize-1]='\0';
else
FDBPath[ConfigRec.FDBPathSize]='\0';
strcat (FDBPath, "\\HDR\\FDB");
fclose(CONFIG_RA);
strcpy (Path, RAEnvr);
strcat (Path, "\\FILES.RA");
if((FILES_RA=fopen(Path,"rb"))==NULL)
{ printf("\n\nUnable to open %s!\n", Path);
getch();
exit(1);
}
strcpy (Path, FDBPath);
while(fread(&FilesRec, sizeof(FilesRec), 1, FILES_RA)==1)
{ AreaNum++;
if(FilesRec.NameSize)
{ strncpy (WorkName, FilesRec.Name, FilesRec.NameSize);
WorkName[FilesRec.NameSize]='\0';
fprintf(stdout, "%5u\) %-40s \n", AreaNum, WorkName);
strcpy (FDBPath, Path);
itoa(AreaNum, Line, 10);
strcat (FDBPath, Line);
strcat (FDBPath, ".HDR");
if((FILES_HDR=fopen(FDBPath,"rb"))==NULL)
fprintf(stdout, " Unable to open %s!\n", FDBPath);
else
{
while(fread(&FHdrRec, sizeof(FHdrRec), 1, FILES_HDR)==1)
if(FHdrRec.Attrib1)
{ strncpy (WorkName, FHdrRec.Name, FHdrRec.NameSize);
WorkName[FHdrRec.NameSize]='\0';
Mask = 0x80;
for (i=0; i < 8; ++i)
{ if (Mask & FHdrRec.Attrib1)
Line[7-i]='X';
else
Line[7-i]='-';
Mask>>= 1;
}
Line[8]='\0';
fprintf(stdout, " %-12s %s\n", WorkName, Line);
}
}
fclose(FILES_HDR);
}
}
fclose(FILES_RA);
}