diff --git a/setter/src/os2/32bit/frag.c b/setter/src/os2/32bit/frag.c
deleted file mode 100644
index a08899d..0000000
--- a/setter/src/os2/32bit/frag.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/****************************************************************************
-Aaru Data Preservation Suite
------------------------------------------------------------------------------
-
-Filename : os2_32.c
-Author(s) : Natalia Portillo
-
---[ Description ] -----------------------------------------------------------
-
-Contains 32-bit OS/2 code
-
---[ License ] ---------------------------------------------------------------
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
------------------------------------------------------------------------------
-Copyright (C) 2011-2021 Natalia Portillo
-*****************************************************************************/
-
-#if(defined(__I386__) || defined(__i386__) || defined(__THW_INTEL) || defined(_M_I386)) && \
- (defined(__OS2__) || defined(__os2__)) && !defined(__DOS__)
-
-#define INCL_DOSMISC
-#define INCL_DOSFILEMGR
-
-#include
-#include
-#include
-#include
-
-#include "../os2.h"
-#include "include/consts.h"
-#include "include/defs.h"
-
-void Fragmentation(const char* path, size_t clusterSize)
-{
- size_t halfCluster = clusterSize / 2;
- size_t quarterCluster = clusterSize / 4;
- size_t twoCluster = clusterSize * 2;
- size_t threeQuartersCluster = halfCluster + quarterCluster;
- size_t twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
- unsigned char* buffer;
- char drivePath[4];
- APIRET rc = 0, wRc = 0, cRc = 0;
- ULONG actionTaken = 0;
- HFILE handle;
- long i;
-
- drivePath[0] = path[0];
- drivePath[1] = ':';
- drivePath[2] = '\\';
- drivePath[3] = 0;
-
- rc = DosSetCurrentDir(drivePath);
-
- if(rc)
- {
- printf("Cannot change to specified path, not continuing.\n");
- return;
- }
-
- rc = DosCreateDir("FRAGS", NULL);
-
- if(rc)
- {
- printf("Cannot create working directory.\n");
- return;
- }
-
- rc = DosSetCurrentDir("FRAGS");
-
- rc = DosOpen((PSZ) "HALFCLST",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(halfCluster);
- memset(buffer, 0, halfCluster);
-
- for(i = 0; i < halfCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, halfCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
-
- rc = DosOpen((PSZ) "QUARCLST",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(quarterCluster);
- memset(buffer, 0, quarterCluster);
-
- for(i = 0; i < quarterCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, quarterCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
-
- rc = DosOpen((PSZ) "TWOCLST",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(twoCluster);
- memset(buffer, 0, twoCluster);
-
- for(i = 0; i < twoCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, twoCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
-
- rc = DosOpen((PSZ) "TRQTCLST",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(threeQuartersCluster);
- memset(buffer, 0, threeQuartersCluster);
-
- for(i = 0; i < threeQuartersCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, threeQuartersCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
- "TRQTCLST",
- threeQuartersCluster,
- rc,
- wRc,
- cRc);
-
- rc = DosOpen((PSZ) "TWTQCLST",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(twoAndThreeQuartCluster);
- memset(buffer, 0, twoAndThreeQuartCluster);
-
- for(i = 0; i < twoAndThreeQuartCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, twoAndThreeQuartCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
- "TWTQCLST",
- twoAndThreeQuartCluster,
- rc,
- wRc,
- cRc);
-
- rc = DosOpen((PSZ) "TWO1",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(twoCluster);
- memset(buffer, 0, twoCluster);
-
- for(i = 0; i < twoCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, twoCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
-
- rc = DosOpen((PSZ) "TWO2",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(twoCluster);
- memset(buffer, 0, twoCluster);
-
- for(i = 0; i < twoCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, twoCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
-
- rc = DosOpen((PSZ) "TWO3",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(twoCluster);
- memset(buffer, 0, twoCluster);
-
- for(i = 0; i < twoCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, twoCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tDeleting \"TWO2\".\n");
- rc = DosDelete((PSZ) "TWO2");
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
-
- rc = DosOpen((PSZ) "FRAGTHRQ",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(threeQuartersCluster);
- memset(buffer, 0, threeQuartersCluster);
-
- for(i = 0; i < threeQuartersCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, threeQuartersCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tDeleting \"TWO1\".\n");
- rc = DosDelete((PSZ) "TWO1");
- printf("\tDeleting \"TWO3\".\n");
- rc = DosDelete((PSZ) "TWO3");
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
- "FRAGTHRQ",
- threeQuartersCluster,
- rc,
- wRc,
- cRc);
-
- rc = DosOpen((PSZ) "FRAGSIXQ",
- &handle,
- &actionTaken,
- 0,
- FILE_NORMAL,
- OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS,
- OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_NO_CACHE | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- 0);
- if(!rc)
- {
- buffer = malloc(twoAndThreeQuartCluster);
- memset(buffer, 0, twoAndThreeQuartCluster);
-
- for(i = 0; i < twoAndThreeQuartCluster; i++) buffer[i] = clauniaBytes[i % CLAUNIA_SIZE];
-
- wRc = DosWrite(handle, buffer, twoAndThreeQuartCluster, &actionTaken);
- cRc = DosClose(handle);
- free(buffer);
- }
-
- printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
- "FRAGSIXQ",
- twoAndThreeQuartCluster,
- rc,
- wRc,
- cRc);
-}
-
-#endif
diff --git a/setter/src/os2/16bit/frag.c b/setter/src/os2/frag.c
similarity index 95%
rename from setter/src/os2/16bit/frag.c
rename to setter/src/os2/frag.c
index 80d9b1d..6dad31f 100644
--- a/setter/src/os2/16bit/frag.c
+++ b/setter/src/os2/frag.c
@@ -27,8 +27,7 @@ Contains 16-bit OS/2 code
Copyright (C) 2011-2021 Natalia Portillo
*****************************************************************************/
-#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) && (defined(__OS2__) || defined(__os2__)) && \
- !defined(__DOS__)
+#if((defined(__OS2__) || defined(__os2__)) && !defined(__DOS__)
#define INCL_DOSMISC
#define INCL_DOSFILEMGR
@@ -38,9 +37,9 @@ Copyright (C) 2011-2021 Natalia Portillo
#include
#include
-#include "../os2.h"
#include "include/consts.h"
#include "include/defs.h"
+#include "os2.h"
void Fragmentation(const char* path, size_t clusterSize)
{
@@ -51,8 +50,8 @@ void Fragmentation(const char* path, size_t clusterSize)
size_t twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
unsigned char* buffer;
char drivePath[4];
- USHORT rc = 0, wRc = 0, cRc = 0;
- USHORT actionTaken = 0;
+ APIRET rc = 0, wRc = 0, cRc = 0;
+ ACTION_RET actionTaken = 0;
HFILE handle;
long i;
@@ -61,7 +60,7 @@ void Fragmentation(const char* path, size_t clusterSize)
drivePath[2] = '\\';
drivePath[3] = 0;
- rc = DosChDir(drivePath, 0);
+ rc = __os2_chdir(drivePath);
if(rc)
{
@@ -69,7 +68,7 @@ void Fragmentation(const char* path, size_t clusterSize)
return;
}
- rc = DosMkDir("FRAGS", 0);
+ rc = __os2_mkdir("FRAGS");
if(rc)
{
@@ -77,7 +76,7 @@ void Fragmentation(const char* path, size_t clusterSize)
return;
}
- rc = DosChDir("FRAGS", 0);
+ rc = __os2_chdir("FRAGS");
rc = DosOpen((PSZ) "HALFCLST",
&handle,
@@ -264,7 +263,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
printf("\tDeleting \"TWO2\".\n");
- rc = DosDelete((PSZ) "TWO2", 0);
+ rc = __os2_delete((PSZ) "TWO2", 0);
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
@@ -289,9 +288,9 @@ void Fragmentation(const char* path, size_t clusterSize)
}
printf("\tDeleting \"TWO1\".\n");
- rc = DosDelete((PSZ) "TWO1", 0);
+ rc = __os2_delete((PSZ) "TWO1", 0);
printf("\tDeleting \"TWO3\".\n");
- rc = DosDelete((PSZ) "TWO3", 0);
+ rc = __os2_delete((PSZ) "TWO3", 0);
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
"FRAGTHRQ",