List argument works, started on removal

This commit is contained in:
TriantaTV 2022-11-08 21:22:07 -06:00
parent ea2669da23
commit 1ef2de13a0

View File

@ -96,7 +96,25 @@ void AddToArchive(char* archiveName, char* fileName)
void RemoveFromArchive(char* archiveName, char* fileName)
{
;
ssize_t readSize;
int archiveFile = open(archiveName, O_RDWR | O_CREAT, 0644);
if (archiveFile < 0)
{
fprintf(stderr, "%s failed to open.\n", archiveName);
exit(1);
}
if (!IsFileArchived(archiveFile, fileName))
{
fprintf(stderr, "File not found.\n");
exit(1);
}
HeaderStruct moduleHeader;
readSize = read(archiveFile, &moduleHeader, sizeof(moduleHeader));
while (readSize > 0)
{
;
}
return;
}
void ListArchive(char* archiveName)
@ -110,11 +128,16 @@ void ListArchive(char* archiveName)
exit(1);
}
HeaderStruct moduleHeader;
readSize = read(archiveFile, &moduleHeader, sizeof(moduleHeader));
while (readSize > 0)
{
moduleSize = (long long) moduleHeader.moduleInfo.st_size;
printf("Name: %s | Size: %lld\n", moduleHeader.moduleName, moduleSize);
char moduleData[moduleSize];
read(archiveFile, &moduleData, moduleSize);
readSize = read(archiveFile, &moduleHeader, sizeof(moduleHeader));
}
return;
}
void ExtractArchive(char* argv[])