diff --git a/setter/src/main.h b/setter/src/main.h index 24f1f1b..28416ee 100644 --- a/setter/src/main.h +++ b/setter/src/main.h @@ -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) diff --git a/setter/src/z80/dirdepth.c b/setter/src/z80/dirdepth.c new file mode 100644 index 0000000..71db29b --- /dev/null +++ b/setter/src/z80/dirdepth.c @@ -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 . + +----------------------------------------------------------------------------- +Copyright (C) 2011-2021 Natalia Portillo +*****************************************************************************/ + +#ifdef USE_FOLDERS +#include +#include +#include +#include +#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 +} diff --git a/setter/src/z80/filename.c b/setter/src/z80/filename.c new file mode 100644 index 0000000..920845d --- /dev/null +++ b/setter/src/z80/filename.c @@ -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 . + +----------------------------------------------------------------------------- +Copyright (C) 2011-2021 Natalia Portillo +*****************************************************************************/ + +#include +#include + +#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"); +} diff --git a/setter/src/z80/files.c b/setter/src/z80/files.c new file mode 100644 index 0000000..37fe41d --- /dev/null +++ b/setter/src/z80/files.c @@ -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 . + +----------------------------------------------------------------------------- +Copyright (C) 2011-2021 Natalia Portillo +*****************************************************************************/ + +#include +#include + +#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); +} diff --git a/setter/src/z80/main.c b/setter/src/z80/main.c index 413badb..d4533e2 100644 --- a/setter/src/z80/main.c +++ b/setter/src/z80/main.c @@ -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; }