mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Add options to write to a log and be quiet.
This commit is contained in:
@@ -30,9 +30,10 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../os2.h"
|
||||
#include "../../include/consts.h"
|
||||
#include "../../include/defs.h"
|
||||
#include "../../log.h"
|
||||
#include "../os2.h"
|
||||
|
||||
void GetOsInfo()
|
||||
{
|
||||
@@ -46,7 +47,7 @@ void GetOsInfo()
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d querying OS/2 version.\n", rc);
|
||||
log_write("Error %d querying OS/2 version.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,10 +60,10 @@ void GetOsInfo()
|
||||
MinorVer = 0;
|
||||
}
|
||||
|
||||
printf("OS information:\n");
|
||||
printf("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer);
|
||||
log_write("OS information:\n");
|
||||
log_write("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer);
|
||||
|
||||
rc = DosQSysInfo(0, (PBYTE)pathLen, sizeof(USHORT));
|
||||
|
||||
printf("\tMaximum path is %d bytes.\n", pathLen[0]);
|
||||
log_write("\tMaximum path is %d bytes.\n", pathLen[0]);
|
||||
}
|
||||
|
||||
@@ -32,9 +32,10 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "xattr.h"
|
||||
|
||||
#include "../os2.h"
|
||||
#include "../../include/consts.h"
|
||||
#include "../../include/defs.h"
|
||||
#include "../../log.h"
|
||||
#include "../os2.h"
|
||||
|
||||
void ExtendedAttributes(const char* path)
|
||||
{
|
||||
@@ -54,7 +55,7 @@ void ExtendedAttributes(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,13 +63,13 @@ void ExtendedAttributes(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = DosChDir("XATTRS", 0);
|
||||
|
||||
printf("Creating files with extended attributes.\n");
|
||||
log_write("Creating files with extended attributes.\n");
|
||||
|
||||
rc = DosOpen("COMMENTS",
|
||||
&handle,
|
||||
@@ -91,7 +92,7 @@ void ExtendedAttributes(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS", rc, wRc, cRc);
|
||||
log_write("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS", rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen("COMMENTS.CRT",
|
||||
&handle,
|
||||
@@ -114,7 +115,7 @@ void ExtendedAttributes(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS.CRT", rc, wRc, cRc);
|
||||
log_write("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS.CRT", rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen("ICON",
|
||||
&handle,
|
||||
@@ -137,5 +138,5 @@ void ExtendedAttributes(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile with icon = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "ICON", rc, wRc, cRc);
|
||||
log_write("\tFile with icon = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "ICON", rc, wRc, cRc);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,10 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../os2.h"
|
||||
#include "../../include/consts.h"
|
||||
#include "../../include/defs.h"
|
||||
#include "../../log.h"
|
||||
#include "../os2.h"
|
||||
|
||||
void GetOsInfo()
|
||||
{
|
||||
@@ -46,7 +47,7 @@ void GetOsInfo()
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d querying OS/2 version.\n", rc);
|
||||
log_write("Error %d querying OS/2 version.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,13 +62,13 @@ void GetOsInfo()
|
||||
MinorVer = aulBuffer[1];
|
||||
}
|
||||
|
||||
printf("OS information:\n");
|
||||
log_write("OS information:\n");
|
||||
|
||||
if(aulBuffer[2] > 0x20) printf("\tRunning under OS/2 %d.%d revision %c.\n", MajorVer, MinorVer, aulBuffer[2]);
|
||||
if(aulBuffer[2] > 0x20) log_write("\tRunning under OS/2 %d.%d revision %c.\n", MajorVer, MinorVer, aulBuffer[2]);
|
||||
else
|
||||
printf("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer);
|
||||
log_write("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer);
|
||||
|
||||
rc = DosQuerySysInfo(QSV_MAX_PATH_LENGTH, QSV_MAX_PATH_LENGTH, (PVOID)pathLen, sizeof(ULONG));
|
||||
|
||||
printf("\tMaximum path is %lu bytes.\n", pathLen[0]);
|
||||
log_write("\tMaximum path is %lu bytes.\n", pathLen[0]);
|
||||
}
|
||||
|
||||
@@ -34,19 +34,20 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void FileAttributes(const char* path)
|
||||
{
|
||||
char drivePath[4];
|
||||
APIRET rc = 0, wRc = 0, cRc = 0;
|
||||
HFILE handle;
|
||||
char drivePath[4];
|
||||
APIRET rc = 0, wRc = 0, cRc = 0;
|
||||
HFILE handle;
|
||||
int i;
|
||||
ACTION_RET actionTaken = 0;
|
||||
|
||||
// 32 bit
|
||||
#if(defined(__I386__) || defined(__i386__) || defined(__THW_INTEL) || defined(_M_I386))
|
||||
FILESTATUS3 fileStatus = {{0}};
|
||||
FILESTATUS3 fileStatus = {{0}};
|
||||
#endif
|
||||
|
||||
drivePath[0] = path[0];
|
||||
@@ -58,7 +59,7 @@ void FileAttributes(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,13 +67,13 @@ void FileAttributes(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = __os2_chdir("ATTRS");
|
||||
|
||||
printf("Creating attributes files.\n");
|
||||
log_write("Creating attributes files.\n");
|
||||
|
||||
for(i = 0; i < KNOWN_OS2_ATTRS; i++)
|
||||
{
|
||||
@@ -102,11 +103,11 @@ void FileAttributes(const char* path)
|
||||
#endif
|
||||
}
|
||||
|
||||
printf("\t%s: name = \"%s\", rc = %d, wRc = %d, cRc = %d\n",
|
||||
os2_attrs[i].description,
|
||||
os2_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\t%s: name = \"%s\", rc = %d, wRc = %d, cRc = %d\n",
|
||||
os2_attrs[i].description,
|
||||
os2_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void DeleteFiles(const char* path)
|
||||
@@ -52,7 +53,7 @@ void DeleteFiles(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,13 +61,13 @@ void DeleteFiles(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = __os2_chdir("DELETED");
|
||||
|
||||
printf("Creating and deleting files.\n");
|
||||
log_write("Creating and deleting files.\n");
|
||||
|
||||
for(pos = 0; pos < 64; pos++)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void DirectoryDepth(const char* path)
|
||||
@@ -50,7 +51,7 @@ void DirectoryDepth(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,13 +59,13 @@ void DirectoryDepth(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = __os2_chdir("DEPTH");
|
||||
|
||||
printf("Creating deepest directory tree.\n");
|
||||
log_write("Creating deepest directory tree.\n");
|
||||
|
||||
while(!rc)
|
||||
{
|
||||
@@ -77,5 +78,5 @@ void DirectoryDepth(const char* path)
|
||||
pos++;
|
||||
}
|
||||
|
||||
printf("\tCreated %d levels of directory hierarchy\n", pos);
|
||||
log_write("\tCreated %d levels of directory hierarchy\n", pos);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void Filenames(const char* path)
|
||||
@@ -52,7 +53,7 @@ void Filenames(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,13 +61,13 @@ void Filenames(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = __os2_chdir("FILENAME");
|
||||
|
||||
printf("Creating files with different filenames.\n");
|
||||
log_write("Creating files with different filenames.\n");
|
||||
|
||||
for(pos = 0; filenames[pos]; pos++)
|
||||
{
|
||||
@@ -87,6 +88,6 @@ void Filenames(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d\n", filenames[pos], rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d\n", filenames[pos], rc, wRc, cRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void MillionFiles(const char* path)
|
||||
@@ -52,7 +53,7 @@ void MillionFiles(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,13 +61,13 @@ void MillionFiles(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = __os2_chdir("MILLION");
|
||||
|
||||
printf("Creating lots of files.\n");
|
||||
log_write("Creating lots of files.\n");
|
||||
|
||||
for(pos = 0; pos < 1000; pos++)
|
||||
{
|
||||
@@ -85,5 +86,5 @@ void MillionFiles(const char* path)
|
||||
DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tCreated %lu files\n", pos);
|
||||
log_write("\tCreated %lu files\n", pos);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void Fragmentation(const char* path, size_t clusterSize)
|
||||
@@ -57,7 +58,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "QUARCLST",
|
||||
&handle,
|
||||
@@ -113,7 +114,8 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
|
||||
log_write(
|
||||
"\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "TWOCLST",
|
||||
&handle,
|
||||
@@ -135,7 +137,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "TRQTCLST",
|
||||
&handle,
|
||||
@@ -157,12 +159,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TRQTCLST",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TRQTCLST",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "TWTQCLST",
|
||||
&handle,
|
||||
@@ -184,12 +186,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TWTQCLST",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TWTQCLST",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "TWO1",
|
||||
&handle,
|
||||
@@ -211,7 +213,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "TWO2",
|
||||
&handle,
|
||||
@@ -233,7 +235,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "TWO3",
|
||||
&handle,
|
||||
@@ -255,10 +257,10 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tDeleting \"TWO2\".\n");
|
||||
log_write("\tDeleting \"TWO2\".\n");
|
||||
rc = __os2_delete((PSZ) "TWO2", 0);
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "FRAGTHRQ",
|
||||
&handle,
|
||||
@@ -280,17 +282,17 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tDeleting \"TWO1\".\n");
|
||||
log_write("\tDeleting \"TWO1\".\n");
|
||||
rc = __os2_delete((PSZ) "TWO1", 0);
|
||||
printf("\tDeleting \"TWO3\".\n");
|
||||
log_write("\tDeleting \"TWO3\".\n");
|
||||
rc = __os2_delete((PSZ) "TWO3", 0);
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"FRAGTHRQ",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"FRAGTHRQ",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
rc = DosOpen((PSZ) "FRAGSIXQ",
|
||||
&handle,
|
||||
@@ -312,10 +314,10 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"FRAGSIXQ",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"FRAGSIXQ",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
#define DATETIME_FORMAT "This file is dated %04d/%02d/%02d %02d:%02d:%02d for %s\n"
|
||||
@@ -62,7 +63,7 @@ void Timestamps(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot change to specified path, not continuing.\n");
|
||||
log_write("Cannot change to specified path, not continuing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,13 +71,13 @@ void Timestamps(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Cannot create working directory.\n");
|
||||
log_write("Cannot create working directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = __os2_chdir("TIMES");
|
||||
|
||||
printf("Creating timestamped files.\n");
|
||||
log_write("Creating timestamped files.\n");
|
||||
|
||||
rc = DosOpen((PSZ) "MAXCTIME",
|
||||
&handle,
|
||||
@@ -112,7 +113,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAXCTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAXCTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MINCTIME",
|
||||
&handle,
|
||||
@@ -148,7 +149,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MINCTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MINCTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y19CTIME",
|
||||
&handle,
|
||||
@@ -184,7 +185,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19CTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19CTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y2KCTIME",
|
||||
&handle,
|
||||
@@ -220,7 +221,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19CTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19CTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MAXWTIME",
|
||||
&handle,
|
||||
@@ -256,7 +257,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAXWTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAXWTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MINWTIME",
|
||||
&handle,
|
||||
@@ -292,7 +293,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MINWTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MINWTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y19WTIME",
|
||||
&handle,
|
||||
@@ -328,7 +329,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19WTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19WTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y2KWTIME",
|
||||
&handle,
|
||||
@@ -364,7 +365,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2KWTIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2KWTIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MAXATIME",
|
||||
&handle,
|
||||
@@ -400,7 +401,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAXATIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAXATIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MINATIME",
|
||||
&handle,
|
||||
@@ -436,7 +437,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MINATIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MINATIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y19ATIME",
|
||||
&handle,
|
||||
@@ -472,7 +473,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19ATIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19ATIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y2KATIME",
|
||||
&handle,
|
||||
@@ -508,7 +509,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2KATIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2KATIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MAX_TIME",
|
||||
&handle,
|
||||
@@ -548,7 +549,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAX_TIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MAX_TIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "MIN_TIME",
|
||||
&handle,
|
||||
@@ -588,7 +589,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MIN_TIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "MIN_TIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y19_TIME",
|
||||
&handle,
|
||||
@@ -628,7 +629,7 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19_TIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y19_TIME", rc, wRc, cRc, tRc);
|
||||
|
||||
rc = DosOpen((PSZ) "Y2K_TIME",
|
||||
&handle,
|
||||
@@ -668,5 +669,5 @@ void Timestamps(const char* path)
|
||||
cRc = DosClose(handle);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2K_TIME", rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2K_TIME", rc, wRc, cRc, tRc);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "os2.h"
|
||||
|
||||
void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
@@ -59,14 +60,14 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
|
||||
rc = DosQFSAttach((PSZ)path, 0, FSAIL_QUERYNAME, (PVOID)&bData, &cbData, 0);
|
||||
#else // 32 bit
|
||||
rc = DosQueryFSAttach((PSZ)path, 0, FSAIL_QUERYNAME, (PVOID)&bData, &cbData);
|
||||
rc = DosQueryFSAttach((PSZ)path, 0, FSAIL_QUERYNAME, (PVOID)&bData, &cbData);
|
||||
#endif
|
||||
|
||||
printf("Volume information:\n");
|
||||
printf("\tPath: %s\n", path);
|
||||
printf("\tDrive number: %d\n", driveNo - 1);
|
||||
log_write("Volume information:\n");
|
||||
log_write("\tPath: %s\n", path);
|
||||
log_write("\tDrive number: %d\n", driveNo - 1);
|
||||
|
||||
if(rc) printf("Error %d requesting volume information.\n", rc);
|
||||
if(rc) log_write("Error %d requesting volume information.\n", rc);
|
||||
else
|
||||
{
|
||||
// 16 bit
|
||||
@@ -75,7 +76,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
#else // 32 bit
|
||||
fsdName = &bData[8 + (USHORT)bData[2] + 1];
|
||||
#endif
|
||||
printf("\tFSD name: %s\n", fsdName);
|
||||
log_write("\tFSD name: %s\n", fsdName);
|
||||
}
|
||||
|
||||
pfsAllocateBuffer = (PFSALLOCATE)malloc(sizeof(FSALLOCATE));
|
||||
@@ -87,19 +88,19 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
rc = DosQueryFSInfo(driveNo, FSIL_ALLOC, (PBYTE)pfsAllocateBuffer, sizeof(FSALLOCATE));
|
||||
#endif
|
||||
|
||||
if(rc) printf("Error %d requesting volume information.\n", rc);
|
||||
if(rc) log_write("Error %d requesting volume information.\n", rc);
|
||||
else
|
||||
{
|
||||
printf("\tBytes per sector: %u\n", pfsAllocateBuffer->cbSector);
|
||||
printf("\tSectors per cluster: %lu (%lu bytes)\n",
|
||||
pfsAllocateBuffer->cSectorUnit,
|
||||
pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector);
|
||||
printf("\tClusters: %lu (%lu bytes)\n",
|
||||
pfsAllocateBuffer->cUnit,
|
||||
pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector * pfsAllocateBuffer->cUnit);
|
||||
printf("\tFree clusters: %lu (%lu bytes)\n",
|
||||
pfsAllocateBuffer->cUnitAvail,
|
||||
pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector * pfsAllocateBuffer->cUnitAvail);
|
||||
log_write("\tBytes per sector: %u\n", pfsAllocateBuffer->cbSector);
|
||||
log_write("\tSectors per cluster: %lu (%lu bytes)\n",
|
||||
pfsAllocateBuffer->cSectorUnit,
|
||||
pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector);
|
||||
log_write("\tClusters: %lu (%lu bytes)\n",
|
||||
pfsAllocateBuffer->cUnit,
|
||||
pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector * pfsAllocateBuffer->cUnit);
|
||||
log_write("\tFree clusters: %lu (%lu bytes)\n",
|
||||
pfsAllocateBuffer->cUnitAvail,
|
||||
pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector * pfsAllocateBuffer->cUnitAvail);
|
||||
|
||||
*clusterSize = pfsAllocateBuffer->cSectorUnit * pfsAllocateBuffer->cbSector;
|
||||
}
|
||||
@@ -115,17 +116,17 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
rc = DosQueryFSInfo(driveNo, FSIL_VOLSER, (PBYTE)pfsInfo, sizeof(FSINFO));
|
||||
#endif
|
||||
|
||||
if(rc) printf("Error %d requesting volume information.\n", rc);
|
||||
if(rc) log_write("Error %d requesting volume information.\n", rc);
|
||||
else
|
||||
{
|
||||
printf("\tVolume label: %s\n", pfsInfo->vol.szVolLabel);
|
||||
printf("\tVolume created on %d/%02d/%02d %02d:%02d:%02d\n",
|
||||
pfsInfo->fdateCreation.year + 1980,
|
||||
pfsInfo->fdateCreation.month - 1,
|
||||
pfsInfo->fdateCreation.day,
|
||||
pfsInfo->ftimeCreation.hours,
|
||||
pfsInfo->ftimeCreation.minutes,
|
||||
pfsInfo->ftimeCreation.twosecs * 2);
|
||||
log_write("\tVolume label: %s\n", pfsInfo->vol.szVolLabel);
|
||||
log_write("\tVolume created on %d/%02d/%02d %02d:%02d:%02d\n",
|
||||
pfsInfo->fdateCreation.year + 1980,
|
||||
pfsInfo->fdateCreation.month - 1,
|
||||
pfsInfo->fdateCreation.day,
|
||||
pfsInfo->ftimeCreation.hours,
|
||||
pfsInfo->ftimeCreation.minutes,
|
||||
pfsInfo->ftimeCreation.twosecs * 2);
|
||||
}
|
||||
|
||||
free(pfsInfo);
|
||||
|
||||
Reference in New Issue
Block a user