2018-01-11 17:53:37 +00:00
|
|
|
/****************************************************************************
|
2020-03-01 16:56:27 +00:00
|
|
|
Aaru Data Preservation Suite
|
2018-01-11 17:53:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
2021-03-14 19:14:41 +00:00
|
|
|
Author(s) : Natalia Portillo
|
2018-01-11 17:53:37 +00:00
|
|
|
|
|
|
|
|
--[ 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,
|
2021-03-09 04:42:30 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-01-11 17:53:37 +00:00
|
|
|
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/>.
|
|
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
2020-12-31 23:13:50 +00:00
|
|
|
Copyright (C) 2011-2021 Natalia Portillo
|
2018-01-11 17:53:37 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2019-04-28 19:37:59 +01:00
|
|
|
#include <stddef.h>
|
2019-01-27 20:33:59 +00:00
|
|
|
#include <stdio.h>
|
2021-03-14 22:55:55 +00:00
|
|
|
#include <string.h>
|
2019-01-27 20:33:59 +00:00
|
|
|
|
2021-03-09 04:39:19 +00:00
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
|
|
#include "include/defs.h"
|
2021-03-14 22:55:55 +00:00
|
|
|
#include "log.h"
|
2021-03-09 04:39:19 +00:00
|
|
|
|
2021-03-12 13:38:11 +00:00
|
|
|
#if defined(macintosh) && defined(__MWERKS__)
|
2018-02-18 06:48:49 +00:00
|
|
|
#include <SIOUX.h>
|
2019-01-27 20:33:59 +00:00
|
|
|
#include <console.h>
|
2018-02-18 06:48:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
2021-03-09 04:39:19 +00:00
|
|
|
int main(int argc, char** argv)
|
2018-01-11 17:53:37 +00:00
|
|
|
{
|
|
|
|
|
size_t clusterSize = 0;
|
2021-03-14 22:55:55 +00:00
|
|
|
int i;
|
|
|
|
|
int quiet = 0;
|
|
|
|
|
int log = 0;
|
|
|
|
|
char* target = NULL;
|
2018-01-11 17:53:37 +00:00
|
|
|
|
2021-03-12 13:38:11 +00:00
|
|
|
#if defined(macintosh) && defined(__MWERKS__)
|
2018-02-18 06:48:49 +00:00
|
|
|
argc = ccommand(&argv);
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-03-14 22:55:55 +00:00
|
|
|
log_write("Aaru Filesystem Tester (Setter) %s\n", AARU_FSTESTER_VERSION);
|
|
|
|
|
log_write("%s\n", AARU_COPYRIGHT);
|
2018-01-11 17:53:37 +00:00
|
|
|
|
2021-03-14 22:55:55 +00:00
|
|
|
for(i = 1; i < argc; i++)
|
|
|
|
|
{
|
|
|
|
|
if(strncmp(argv[i], "--log", 5) == 0 || strncmp(argv[i], "-l", 2) == 0) log = 1;
|
|
|
|
|
else if(strncmp(argv[i], "--quiet", 7) == 0 || strncmp(argv[i], "-q", 2) == 0)
|
|
|
|
|
quiet = 1;
|
|
|
|
|
else if(argv[i][0] == '-')
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "Unknown parameter %s.\n", argv[i]);
|
|
|
|
|
fprintf(stderr, "Usage %s [--log] [--quiet] <path>\n", argv[0]);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else if(target != NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "Cannot set more than one target.\n");
|
|
|
|
|
fprintf(stderr, "Usage %s [--log] [--quiet] <path>\n", argv[0]);
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
target = argv[i];
|
|
|
|
|
}
|
2018-01-11 17:53:37 +00:00
|
|
|
|
2021-03-14 22:56:55 +00:00
|
|
|
if(target == NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "Please specify a target path.\n");
|
|
|
|
|
fprintf(stderr, "Usage %s [--log] [--quiet] <path>\n", argv[0]);
|
|
|
|
|
return -3;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-14 22:55:55 +00:00
|
|
|
log_set_quiet(quiet);
|
|
|
|
|
|
|
|
|
|
if(log)
|
2018-01-11 17:53:37 +00:00
|
|
|
{
|
2021-03-14 22:55:55 +00:00
|
|
|
log = !log_open(quiet);
|
|
|
|
|
|
|
|
|
|
if(log)
|
|
|
|
|
{
|
|
|
|
|
log_write("Parameters:");
|
|
|
|
|
for(i = 0; i < argc; i++) log_write(" %s", argv[i]);
|
|
|
|
|
log_write("\n");
|
|
|
|
|
}
|
2018-01-11 17:53:37 +00:00
|
|
|
}
|
|
|
|
|
|
2021-03-14 22:55:55 +00:00
|
|
|
log_write("Running in %s (%s)\n", OS_NAME, OS_ARCH);
|
|
|
|
|
log_write("\n");
|
|
|
|
|
|
2018-01-11 17:53:37 +00:00
|
|
|
GetOsInfo();
|
2021-03-15 02:01:54 +00:00
|
|
|
GetVolumeInfo(target, &clusterSize);
|
|
|
|
|
FileAttributes(target);
|
|
|
|
|
FilePermissions(target);
|
|
|
|
|
ExtendedAttributes(target);
|
|
|
|
|
ResourceFork(target);
|
|
|
|
|
Filenames(target);
|
|
|
|
|
Timestamps(target);
|
|
|
|
|
Links(target);
|
|
|
|
|
DirectoryDepth(target);
|
|
|
|
|
Fragmentation(target, clusterSize);
|
|
|
|
|
Sparse(target);
|
|
|
|
|
MillionFiles(target);
|
|
|
|
|
DeleteFiles(target);
|
|
|
|
|
GetVolumeInfo(target, &clusterSize);
|
2018-01-11 17:53:37 +00:00
|
|
|
|
2021-03-14 22:55:55 +00:00
|
|
|
log_close();
|
2018-01-11 17:53:37 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|