mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Merge OS/2 deleted code.
This commit is contained in:
@@ -1,98 +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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
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 <os2.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "../os2.h"
|
|
||||||
#include "include/consts.h"
|
|
||||||
#include "include/defs.h"
|
|
||||||
|
|
||||||
void DeleteFiles(const char* path)
|
|
||||||
{
|
|
||||||
char drivePath[4];
|
|
||||||
APIRET rc = 0;
|
|
||||||
char filename[9];
|
|
||||||
short pos = 0;
|
|
||||||
ULONG actionTaken = 0;
|
|
||||||
HFILE handle;
|
|
||||||
|
|
||||||
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("DELETED", NULL);
|
|
||||||
|
|
||||||
if(rc)
|
|
||||||
{
|
|
||||||
printf("Cannot create working directory.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = DosSetCurrentDir("DELETED");
|
|
||||||
|
|
||||||
printf("Creating and deleting files.\n");
|
|
||||||
|
|
||||||
for(pos = 0; pos < 64; pos++)
|
|
||||||
{
|
|
||||||
memset(&filename, 0, 9);
|
|
||||||
sprintf(&filename, "%X", pos);
|
|
||||||
rc = DosOpen(&filename,
|
|
||||||
&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) break;
|
|
||||||
|
|
||||||
DosClose(handle);
|
|
||||||
DosDelete(&filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -27,8 +27,7 @@ Contains 16-bit OS/2 code
|
|||||||
Copyright (C) 2011-2021 Natalia Portillo
|
Copyright (C) 2011-2021 Natalia Portillo
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) && (defined(__OS2__) || defined(__os2__)) && \
|
#if((defined(__OS2__) || defined(__os2__)) && !defined(__DOS__)
|
||||||
!defined(__DOS__)
|
|
||||||
|
|
||||||
#define INCL_DOSMISC
|
#define INCL_DOSMISC
|
||||||
#define INCL_DOSFILEMGR
|
#define INCL_DOSFILEMGR
|
||||||
@@ -38,25 +37,25 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../os2.h"
|
|
||||||
#include "include/consts.h"
|
#include "include/consts.h"
|
||||||
#include "include/defs.h"
|
#include "include/defs.h"
|
||||||
|
#include "os2.h"
|
||||||
|
|
||||||
void DeleteFiles(const char* path)
|
void DeleteFiles(const char* path)
|
||||||
{
|
{
|
||||||
char drivePath[4];
|
char drivePath[4];
|
||||||
USHORT rc = 0;
|
APIRET rc = 0;
|
||||||
char filename[9];
|
char filename[9];
|
||||||
short pos = 0;
|
short pos = 0;
|
||||||
USHORT actionTaken = 0;
|
ACTION_RET actionTaken = 0;
|
||||||
HFILE handle;
|
HFILE handle;
|
||||||
|
|
||||||
drivePath[0] = path[0];
|
drivePath[0] = path[0];
|
||||||
drivePath[1] = ':';
|
drivePath[1] = ':';
|
||||||
drivePath[2] = '\\';
|
drivePath[2] = '\\';
|
||||||
drivePath[3] = 0;
|
drivePath[3] = 0;
|
||||||
|
|
||||||
rc = DosChDir(drivePath, 0);
|
rc = __os2_chdir(drivePath);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
@@ -64,7 +63,7 @@ void DeleteFiles(const char* path)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = DosMkDir("DELETED", 0);
|
rc = __os2_mkdir("DELETED");
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
@@ -72,7 +71,7 @@ void DeleteFiles(const char* path)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = DosChDir("DELETED", 0);
|
rc = __os2_chdir("DELETED");
|
||||||
|
|
||||||
printf("Creating and deleting files.\n");
|
printf("Creating and deleting files.\n");
|
||||||
|
|
||||||
@@ -91,7 +90,7 @@ void DeleteFiles(const char* path)
|
|||||||
if(rc) break;
|
if(rc) break;
|
||||||
|
|
||||||
DosClose(handle);
|
DosClose(handle);
|
||||||
DosDelete(&filename, 0);
|
__os2_delete(&filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,11 +262,13 @@ unsigned char IconEA[3516] = {
|
|||||||
|
|
||||||
#define __os2_chdir(path) DosChDir(path, 0)
|
#define __os2_chdir(path) DosChDir(path, 0)
|
||||||
#define __os2_mkdir(path) DosMkDir(path, 0)
|
#define __os2_mkdir(path) DosMkDir(path, 0)
|
||||||
|
#define __os2_delete(path) DosDelete(path, 0);
|
||||||
|
|
||||||
#else // 32 bit
|
#else // 32 bit
|
||||||
|
|
||||||
#define __os2_chdir(path) DosSetCurrentDir(path)
|
#define __os2_chdir(path) DosSetCurrentDir(path)
|
||||||
#define __os2_mkdir(path) DosCreateDir(path, NULL)
|
#define __os2_mkdir(path) DosCreateDir(path, NULL)
|
||||||
|
#define __os2_delete(path) DosDelete(path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user