mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Implement fssetter for Z80 based computers.
This commit is contained in:
@@ -148,8 +148,6 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#define OS_NAME "Syllable"
|
||||
#elif defined(__osf__) || defined(__osf)
|
||||
#define OS_NAME "Tru64 UNIX"
|
||||
#elif defined(__TRS80__)
|
||||
#define OS_NAME "TRS 80"
|
||||
#elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__)
|
||||
#define OS_NAME "Ultrix"
|
||||
#elif defined(VMS) || defined(__VMS)
|
||||
|
||||
63
setter/src/z80/dirdepth.c
Normal file
63
setter/src/z80/dirdepth.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
Aaru Data Preservation Suite
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
--[ 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
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef USE_FOLDERS
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "../include/defs.h"
|
||||
|
||||
void DirectoryDepth(const char* path)
|
||||
{
|
||||
#ifdef USE_FOLDERS
|
||||
int ret;
|
||||
char filename[9];
|
||||
long pos = 0;
|
||||
|
||||
printf("Please insert the \"DEPTH\" disk.\n");
|
||||
printf("Press Y to continue, any other key exits.\n");
|
||||
ret = getchar();
|
||||
|
||||
if(ret != 'Y' && ret != 'y') return;
|
||||
|
||||
while(!ret)
|
||||
{
|
||||
memset(filename, 0, 9);
|
||||
sprintf(filename, "%08ld", pos);
|
||||
ret = mkdir(filename, 0755);
|
||||
|
||||
if(!ret) ret = chdir(filename);
|
||||
|
||||
pos++;
|
||||
|
||||
// This can continue until the disk fills, the kernel crashes, or some other nasty success
|
||||
if(pos >= 1000) break;
|
||||
}
|
||||
|
||||
printf("\tCreated %ld levels of directory hierarchy\n", pos);
|
||||
#endif
|
||||
}
|
||||
67
setter/src/z80/filename.c
Normal file
67
setter/src/z80/filename.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/****************************************************************************
|
||||
Aaru Data Preservation Suite
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
--[ 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
|
||||
*****************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
|
||||
void Filenames(const char* path)
|
||||
{
|
||||
int ret;
|
||||
FILE* h;
|
||||
int rc, wRc, cRc;
|
||||
int pos;
|
||||
|
||||
printf("Please insert the \"FILENAME\" disk.\n");
|
||||
printf("Press Y to continue, any other key exits.\n");
|
||||
ret = getchar();
|
||||
|
||||
if(ret != 'Y' && ret != 'y') return;
|
||||
|
||||
printf("Creating files with different filenames.\n");
|
||||
|
||||
for(pos = 0; filenames[pos]; pos++)
|
||||
{
|
||||
h = fopen(filenames[pos], "w+");
|
||||
rc = 0;
|
||||
wRc = 0;
|
||||
cRc = 0;
|
||||
|
||||
if(!h) { rc = errno; }
|
||||
else
|
||||
{
|
||||
ret = fprintf(h, FILENAME_FORMAT, filenames[pos]);
|
||||
if(ret < 0) { wRc = errno; }
|
||||
|
||||
ret = fclose(h);
|
||||
if(ret) { cRc = errno; }
|
||||
}
|
||||
|
||||
printf("%d:%d,%d,%d-", pos, rc, wRc, cRc);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
57
setter/src/z80/files.c
Normal file
57
setter/src/z80/files.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
Aaru Data Preservation Suite
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
--[ 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
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
|
||||
void MillionFiles(const char* path)
|
||||
{
|
||||
char filename[9];
|
||||
long pos = 0;
|
||||
FILE* h;
|
||||
int ret;
|
||||
|
||||
printf("Please insert the \"FILES\" disk.\n");
|
||||
printf("Press Y to continue, any other key exits.\n");
|
||||
ret = getchar();
|
||||
|
||||
if(ret != 'Y' && ret != 'y') return;
|
||||
|
||||
printf("Creating lots of files.\n");
|
||||
|
||||
for(pos = 0; pos < 1000; pos++)
|
||||
{
|
||||
memset(filename, 0, 9);
|
||||
sprintf(filename, "%08ld", pos);
|
||||
|
||||
h = fopen(filename, "w+");
|
||||
if(h == NULL) { break; }
|
||||
|
||||
fclose(h);
|
||||
}
|
||||
|
||||
printf("\tCreated %ld files\n", pos);
|
||||
}
|
||||
@@ -26,12 +26,40 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../main.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
|
||||
#ifdef USE_FOLDERS
|
||||
#define NO_DISKS 3
|
||||
#define DISK_NAMES_TAIL " and \"DEPTH\","
|
||||
#else
|
||||
#define NO_DISKS 2
|
||||
#define DISK_NAMES_TAIL ","
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int c;
|
||||
|
||||
printf("Aaru Filesystem Tester (Setter) %s\n", AARU_FSTESTER_VERSION);
|
||||
printf("%s\n", AARU_COPYRIGHT);
|
||||
printf("Running in %s (%s)\n", OS_NAME, OS_ARCH);
|
||||
printf("\n");
|
||||
|
||||
// Limit output to 40 columns
|
||||
printf("This software needs %d disks labeled\n", NO_DISKS);
|
||||
printf("\"FILES\", \"FILENAME\"%s\n", DISK_NAMES_TAIL);
|
||||
printf("to be inserted into the drive where");
|
||||
printf("this disk is now.\n");
|
||||
printf("Press the Y key to continue\n");
|
||||
printf("any other key exists.\n");
|
||||
|
||||
c = getchar();
|
||||
|
||||
if(c != 'Y' && c != 'y') return 1;
|
||||
|
||||
MillionFiles("");
|
||||
Filenames("");
|
||||
DirectoryDepth("");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user