diff --git a/.clang-format b/.clang-format index e43dc09..b33cb50 100644 --- a/.clang-format +++ b/.clang-format @@ -11,7 +11,7 @@ AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: true +AllowShortIfStatementsOnASingleLine: Always AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -58,14 +58,21 @@ ForEachMacros: - BOOST_FOREACH IncludeBlocks: Regroup IncludeCategories: - - Regex: '<[[:alnum:].]+>' - Priority: -1 - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 + - Regex: '^()' + Priority: -3 + SortPriority: -4 + - Regex: '^()' + Priority: -3 + SortPriority: -3 + - Regex: '^(<.*)' + Priority: -2 + SortPriority: -2 + - Regex: '^("(win32|windows))' + Priority: 1 + SortPriority: -1 - Regex: '.*' Priority: 1 + SortPriority: 1 IncludeIsMainRegex: '(Test)?$' IndentCaseLabels: true IndentPPDirectives: None @@ -88,7 +95,7 @@ PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right +PointerAlignment: Left ReflowComments: true SortIncludes: true SortUsingDeclarations: true diff --git a/setter/CMakeLists.txt b/setter/CMakeLists.txt index 7de82fe..3d3ad25 100644 --- a/setter/CMakeLists.txt +++ b/setter/CMakeLists.txt @@ -3,4 +3,4 @@ project(setter C) set(CMAKE_C_STANDARD 90) -add_executable(setter src/consts.h src/defs.h src/main.h src/dosos2.h src/os2_16.h src/os2_32.h src/main.c src/dos.c src/os2_16.c src/os2_32.c src/win32.c src/win32.h src/unix/unix.c src/macos.c src/macos.h src/unix/unix.h src/linux/linux.c src/linux/linux.h src/netware.c src/netware.h) \ No newline at end of file +add_executable(setter src/include/consts.h src/include/defs.h src/main.h src/dosos2.h src/os2_16.h src/os2_32.h src/main.c src/dos.c src/os2_16.c src/os2_32.c src/win32.c src/win32.h src/unix/unix.c src/macos.c src/macos.h src/unix/unix.h src/linux/linux.c src/linux/linux.h src/netware.c src/netware.h) \ No newline at end of file diff --git a/setter/src/dos.c b/setter/src/dos.c index 8157fad..08a00d3 100644 --- a/setter/src/dos.c +++ b/setter/src/dos.c @@ -42,9 +42,9 @@ Copyright (C) 2011-2021 Natalia Portillo #include "dos.h" -#include "consts.h" -#include "defs.h" #include "dosos2.h" +#include "include/consts.h" +#include "include/defs.h" void GetOsInfo() { @@ -87,14 +87,14 @@ void GetOsInfo() printf("\tRunning under DOS %d.%d\n", major, minor); } -void GetVolumeInfo(const char *path, size_t *clusterSize) +void GetVolumeInfo(const char* path, size_t* clusterSize) { union REGS regs; struct SREGS sregs; char drivePath[4]; char driveNo = path[0] - '@'; struct diskfree_t oldFreeSpace; - Fat32FreeSpace * freeSpace = malloc(sizeof(Fat32FreeSpace)); + Fat32FreeSpace* freeSpace = malloc(sizeof(Fat32FreeSpace)); memset(freeSpace, 0, sizeof(Fat32FreeSpace)); @@ -146,7 +146,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) } } -void FileAttributes(const char *path) +void FileAttributes(const char* path) { char driveNo = path[0] - '@'; unsigned total, actionTaken; @@ -173,7 +173,7 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)noAttributeText, strlen(noAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)noAttributeText, strlen(noAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("NONE", _A_NORMAL); } @@ -184,7 +184,7 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARCHIVE", _A_ARCH); } @@ -195,7 +195,7 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("SYSTEM", _A_SYSTEM); } @@ -206,7 +206,7 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("HIDDEN", _A_HIDDEN); } @@ -217,7 +217,7 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("READONLY", _A_RDONLY); } @@ -228,8 +228,8 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("HIDDREAD", _A_HIDDEN | _A_RDONLY); } @@ -244,8 +244,8 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("SYSTREAD", _A_SYSTEM | _A_RDONLY); } @@ -260,8 +260,8 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("SYSTHIDD", _A_SYSTEM | _A_HIDDEN); } @@ -276,9 +276,9 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("SYSRDYHD", _A_SYSTEM | _A_RDONLY | _A_HIDDEN); } @@ -293,8 +293,8 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARCHREAD", _A_ARCH | _A_RDONLY); } @@ -309,8 +309,8 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARCHHIDD", _A_ARCH | _A_HIDDEN); } @@ -325,9 +325,9 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARCHDRDY", _A_ARCH | _A_HIDDEN | _A_RDONLY); } @@ -342,8 +342,8 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARCHSYST", _A_ARCH | _A_SYSTEM); } @@ -358,9 +358,9 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARSYSRDY", _A_ARCH | _A_SYSTEM | _A_RDONLY); } @@ -375,9 +375,9 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARCSYSHD", _A_ARCH | _A_SYSTEM | _A_HIDDEN); } @@ -392,10 +392,10 @@ void FileAttributes(const char *path) if(!rc) { - wRc = _dos_write(handle, (void *)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)systemAttributeText, strlen(systemAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); - wRc = _dos_write(handle, (void *)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)archivedAttributeText, strlen(archivedAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)systemAttributeText, strlen(systemAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)hiddenAttributeText, strlen(hiddenAttributeText), &actionTaken); + wRc = _dos_write(handle, (void*)readonlyAttributeText, strlen(readonlyAttributeText), &actionTaken); cRc = _dos_close(handle); rc = _dos_setfileattr("ARSYHDRD", _A_ARCH | _A_SYSTEM | _A_HIDDEN | _A_RDONLY); } @@ -408,19 +408,19 @@ void FileAttributes(const char *path) cRc); } -void FilePermissions(const char *path) +void FilePermissions(const char* path) { /* Do nothing, not supported by target operating system */ } -void ExtendedAttributes(const char *path) +void ExtendedAttributes(const char* path) { /* Do nothing, not supported by target operating system */ } -void ResourceFork(const char *path) +void ResourceFork(const char* path) { /* Do nothing, not supported by target operating system */ } -void Filenames(const char *path) +void Filenames(const char* path) { char driveNo = path[0] - '@'; int rc = 0, wRc = 0, cRc = 0; @@ -464,7 +464,7 @@ void Filenames(const char *path) #define DATETIME_FORMAT "This file is dated %04d/%02d/%02d %02d:%02d:%02d for %s\n" -void Timestamps(const char *path) +void Timestamps(const char* path) { char driveNo = path[0] - '@'; int rc = 0, wRc = 0, cRc = 0, tRc = 0; @@ -832,7 +832,7 @@ void Timestamps(const char *path) printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2KATIME", rc, wRc, cRc, tRc); } -void DirectoryDepth(const char *path) +void DirectoryDepth(const char* path) { char driveNo = path[0] - '@'; int rc = 0; @@ -871,14 +871,14 @@ void DirectoryDepth(const char *path) printf("\tCreated %d levels of directory hierarchy\n", pos); } -void Fragmentation(const char *path, size_t clusterSize) +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; + unsigned char* buffer; char driveNo = path[0] - '@'; int rc = 0, wRc = 0, cRc = 0; unsigned total, actionTaken = 0; @@ -1079,15 +1079,15 @@ void Fragmentation(const char *path, size_t clusterSize) cRc); } -void Sparse(const char *path) +void Sparse(const char* path) { /* Do nothing, not supported by target operating system */ } -void Links(const char *path) +void Links(const char* path) { /* Do nothing, not supported by target operating system */ } -void MillionFiles(const char *path) +void MillionFiles(const char* path) { char driveNo = path[0] - '@'; int rc = 0; @@ -1126,7 +1126,7 @@ void MillionFiles(const char *path) printf("\tCreated %llu files\n", pos); } -void DeleteFiles(const char *path) +void DeleteFiles(const char* path) { char driveNo = path[0] - '@'; int rc = 0; diff --git a/setter/src/consts.h b/setter/src/include/consts.h similarity index 100% rename from setter/src/consts.h rename to setter/src/include/consts.h diff --git a/setter/src/defs.h b/setter/src/include/defs.h similarity index 100% rename from setter/src/defs.h rename to setter/src/include/defs.h diff --git a/setter/src/linux/linux.c b/setter/src/linux/linux.c index ae75676..e0d9f6d 100644 --- a/setter/src/linux/linux.c +++ b/setter/src/linux/linux.c @@ -31,7 +31,7 @@ Copyright (C) 2011-2021 Natalia Portillo #if defined(__linux__) || defined(__LINUX__) || defined(__gnu_linux) -#include "../consts.h" +#include "../include/consts.h" #define _GNU_SOURCE #include #include diff --git a/setter/src/macos.c b/setter/src/macos.c index 7e17e9a..e253a38 100644 --- a/setter/src/macos.c +++ b/setter/src/macos.c @@ -31,11 +31,6 @@ Copyright (C) 2011-2021 Natalia Portillo #if defined(macintosh) -#include "macos.h" - -#include "consts.h" -#include "defs.h" - #include #include #include @@ -48,6 +43,11 @@ Copyright (C) 2011-2021 Natalia Portillo #include #include +#include "macos.h" + +#include "include/consts.h" +#include "include/defs.h" + void GetOsInfo() { int32_t gestaltResponse; @@ -86,7 +86,7 @@ void GetOsInfo() } } -void GetVolumeInfo(const char *path, size_t *clusterSize) +void GetVolumeInfo(const char* path, size_t* clusterSize) { OSErr rc; Str255 str255; @@ -107,7 +107,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) int bigVol = 0; *clusterSize = 0; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); rc = Gestalt(gestaltFSAttr, &gestaltResponse); if(!rc) @@ -194,7 +194,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) } } -void FileAttributes(const char *path) +void FileAttributes(const char* path) { OSErr rc, wRc, cRc; Str255 str255; @@ -204,10 +204,10 @@ void FileAttributes(const char *path) int32_t dirId; FInfo finderInfo; int32_t count; - HFileInfo * fpb; + HFileInfo* fpb; CInfoPBRec cipbr; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -219,7 +219,7 @@ void FileAttributes(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pATTRS", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pATTRS", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -836,9 +836,13 @@ void FileAttributes(const char *path) printf("\tFile has all flags bits set: name = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "ALL", rc, wRc, cRc); } -void FilePermissions(const char *path) { /* Do nothing, not supported by target operating system */ } +void FilePermissions(const char* path) +{ /* Do nothing, not supported by target operating system */ +} -void ExtendedAttributes(const char *path) { /* Do nothing, not supported by target operating system */ } +void ExtendedAttributes(const char* path) +{ /* Do nothing, not supported by target operating system */ +} static OSErr SaveResourceToNewFile(int16_t vRefNum, int32_t dirID, @@ -846,7 +850,7 @@ static OSErr SaveResourceToNewFile(int16_t vRefNum, ResType type, int16_t resId, Str255 resName, - unsigned char *buffer, + unsigned char* buffer, size_t length) { Handle h; @@ -878,7 +882,7 @@ static OSErr SaveResourceToNewFile(int16_t vRefNum, return rc; } -void ResourceFork(const char *path) +void ResourceFork(const char* path) { OSErr rc, wRc, cRc, rRc, rRc2, rRc3; Str255 str255; @@ -888,10 +892,10 @@ void ResourceFork(const char *path) int32_t dirId; FInfo finderInfo; int32_t count; - HFileInfo * fpb; + HFileInfo* fpb; CInfoPBRec cipbr; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -903,7 +907,7 @@ void ResourceFork(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pRSRC", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pRSRC", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -922,7 +926,7 @@ void ResourceFork(const char *path) rtIcons, -16455, "\pIcon resource", - (unsigned char *)IcnsResource, + (unsigned char*)IcnsResource, sizeof(IcnsResource)); rc = HOpenDF(refNum, dirId, "\pICON", 0, &refFile); if(!rc) @@ -953,7 +957,7 @@ void ResourceFork(const char *path) ftPICTFile, 29876, "\pPicture resource", - (unsigned char *)PictResource, + (unsigned char*)PictResource, sizeof(PictResource)); rc = HOpenDF(refNum, dirId, "\pPICT", 0, &refFile); if(!rc) @@ -983,7 +987,7 @@ void ResourceFork(const char *path) rtVersion, 1, "\pVersion resource", - (unsigned char *)VersResource, + (unsigned char*)VersResource, sizeof(VersResource)); rc = HOpenDF(refNum, dirId, "\pVERSION", 0, &refFile); if(!rc) @@ -1013,7 +1017,7 @@ void ResourceFork(const char *path) rtIcons, -16455, "\pIcon resource", - (unsigned char *)IcnsResource, + (unsigned char*)IcnsResource, sizeof(IcnsResource)); rRc2 = SaveResourceToNewFile(refNum, dirId, @@ -1021,7 +1025,7 @@ void ResourceFork(const char *path) ftPICTFile, 29876, "\pPicture resource", - (unsigned char *)PictResource, + (unsigned char*)PictResource, sizeof(PictResource)); rRc3 = SaveResourceToNewFile(refNum, dirId, @@ -1029,7 +1033,7 @@ void ResourceFork(const char *path) rtVersion, 1, "\pVersion resource", - (unsigned char *)VersResource, + (unsigned char*)VersResource, sizeof(VersResource)); rc = HOpenDF(refNum, dirId, "\pALL", 0, &refFile); if(!rc) @@ -1054,7 +1058,7 @@ void ResourceFork(const char *path) rRc3); } -void Filenames(const char *path) +void Filenames(const char* path) { OSErr rc, wRc, cRc; Str255 str255; @@ -1067,7 +1071,7 @@ void Filenames(const char *path) char message[300]; int pos = 0; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -1079,7 +1083,7 @@ void Filenames(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pFILENAME", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pFILENAME", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -1103,7 +1107,7 @@ void Filenames(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, FILENAME_FORMAT, filenames[pos]); + sprintf((char*)message, FILENAME_FORMAT, filenames[pos]); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); @@ -1114,7 +1118,7 @@ void Filenames(const char *path) } } -void Timestamps(const char *path) +void Timestamps(const char* path) { OSErr rc, wRc, cRc, tRc; Str255 str255; @@ -1124,11 +1128,11 @@ void Timestamps(const char *path) int32_t dirId; FInfo finderInfo; int32_t count; - HFileInfo * fpb; + HFileInfo* fpb; CInfoPBRec cipbr; char message[300]; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -1140,7 +1144,7 @@ void Timestamps(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pTIMES", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pTIMES", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -1156,13 +1160,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MAXDATETIME, "creation"); + sprintf((char*)message, DATETIME_FORMAT, MAXDATETIME, "creation"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMAXCTIME"; fpb->ioDirID = dirId; @@ -1184,13 +1188,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MAXDATETIME, "modification"); + sprintf((char*)message, DATETIME_FORMAT, MAXDATETIME, "modification"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMAXMTIME"; fpb->ioDirID = dirId; @@ -1212,13 +1216,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MAXDATETIME, "backup"); + sprintf((char*)message, DATETIME_FORMAT, MAXDATETIME, "backup"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMAXBTIME"; fpb->ioDirID = dirId; @@ -1240,13 +1244,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MINDATETIME, "creation"); + sprintf((char*)message, DATETIME_FORMAT, MINDATETIME, "creation"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMINCTIME"; fpb->ioDirID = dirId; @@ -1268,13 +1272,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MINDATETIME, "modification"); + sprintf((char*)message, DATETIME_FORMAT, MINDATETIME, "modification"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMINMTIME"; fpb->ioDirID = dirId; @@ -1296,13 +1300,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MINDATETIME, "backup"); + sprintf((char*)message, DATETIME_FORMAT, MINDATETIME, "backup"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMINBTIME"; fpb->ioDirID = dirId; @@ -1324,13 +1328,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y2KDATETIME, "creation"); + sprintf((char*)message, DATETIME_FORMAT, Y2KDATETIME, "creation"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY2KCTIME"; fpb->ioDirID = dirId; @@ -1352,13 +1356,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y2KDATETIME, "modification"); + sprintf((char*)message, DATETIME_FORMAT, Y2KDATETIME, "modification"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY2KMTIME"; fpb->ioDirID = dirId; @@ -1380,13 +1384,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y2KDATETIME, "backup"); + sprintf((char*)message, DATETIME_FORMAT, Y2KDATETIME, "backup"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY2KBTIME"; fpb->ioDirID = dirId; @@ -1408,13 +1412,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y1KDATETIME, "creation"); + sprintf((char*)message, DATETIME_FORMAT, Y1KDATETIME, "creation"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY1KCTIME"; fpb->ioDirID = dirId; @@ -1436,13 +1440,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y1KDATETIME, "modification"); + sprintf((char*)message, DATETIME_FORMAT, Y1KDATETIME, "modification"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY1KMTIME"; fpb->ioDirID = dirId; @@ -1464,13 +1468,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y1KDATETIME, "backup"); + sprintf((char*)message, DATETIME_FORMAT, Y1KDATETIME, "backup"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY1KBTIME"; fpb->ioDirID = dirId; @@ -1492,13 +1496,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MAXDATETIME, "all"); + sprintf((char*)message, DATETIME_FORMAT, MAXDATETIME, "all"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMAXTIME"; fpb->ioDirID = dirId; @@ -1520,13 +1524,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, MINDATETIME, "all"); + sprintf((char*)message, DATETIME_FORMAT, MINDATETIME, "all"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pMINTIME"; fpb->ioDirID = dirId; @@ -1548,13 +1552,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, NONDATETIME, "all"); + sprintf((char*)message, DATETIME_FORMAT, NONDATETIME, "all"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pNOTIME"; fpb->ioDirID = dirId; @@ -1576,13 +1580,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y2KDATETIME, "all"); + sprintf((char*)message, DATETIME_FORMAT, Y2KDATETIME, "all"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY2KTIME"; fpb->ioDirID = dirId; @@ -1604,13 +1608,13 @@ void Timestamps(const char *path) if(!rc) { memset(&message, 0, 300); - sprintf((char *)message, DATETIME_FORMAT, Y1KDATETIME, "all"); + sprintf((char*)message, DATETIME_FORMAT, Y1KDATETIME, "all"); count = strlen(message); wRc = FSWrite(refFile, &count, message); cRc = FSClose(refFile); } memset(&cipbr, 0, sizeof(CInfoPBRec)); - fpb = (HFileInfo *)&cipbr; + fpb = (HFileInfo*)&cipbr; fpb->ioVRefNum = refNum; fpb->ioNamePtr = "\pY1KTIME"; fpb->ioDirID = dirId; @@ -1626,7 +1630,7 @@ void Timestamps(const char *path) printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y1KTIME", rc, wRc, cRc, tRc); } -void DirectoryDepth(const char *path) +void DirectoryDepth(const char* path) { OSErr rc, wRc, cRc; Str255 str255; @@ -1639,7 +1643,7 @@ void DirectoryDepth(const char *path) char filename[9]; int pos = 0; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -1651,7 +1655,7 @@ void DirectoryDepth(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pDEPTH", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pDEPTH", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -1663,7 +1667,7 @@ void DirectoryDepth(const char *path) while(!rc) { memset(&filename, 0, 9); - sprintf((char *)filename, "%08d", pos); + sprintf((char*)filename, "%08d", pos); str255[0] = 8; memcpy(str255 + 1, filename, 8); @@ -1677,14 +1681,14 @@ void DirectoryDepth(const char *path) printf("\tCreated %d levels of directory hierarchy\n", pos); } -void Fragmentation(const char *path, size_t clusterSize) +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; + unsigned char* buffer; OSErr rc, wRc, cRc; Str255 str255; HVolumeParam hpb; @@ -1694,7 +1698,7 @@ void Fragmentation(const char *path, size_t clusterSize) int32_t count; long i; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -1706,7 +1710,7 @@ void Fragmentation(const char *path, size_t clusterSize) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pFRAGS", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pFRAGS", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -1935,11 +1939,13 @@ void Fragmentation(const char *path, size_t clusterSize) cRc); } -void Sparse(const char *path) { /* Do nothing, not supported by target operating system */ } +void Sparse(const char* path) +{ /* Do nothing, not supported by target operating system */ +} static pascal OSErr - CreateAliasFile(const FSSpec *targetFile, const FSSpec *aliasFile, OSType fileCreator, OSType fileType) + CreateAliasFile(const FSSpec* targetFile, const FSSpec* aliasFile, OSType fileCreator, OSType fileType) { short rsrcID; short aliasRefnum; @@ -1972,7 +1978,7 @@ static pascal OSErr return err; } -void Links(const char *path) +void Links(const char* path) { int32_t gestaltResponse; OSErr rc, wRc, cRc, oRc, aRc; @@ -1993,7 +1999,7 @@ void Links(const char *path) return; } - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -2005,7 +2011,7 @@ void Links(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pLINKS", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pLINKS", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -2017,7 +2023,7 @@ void Links(const char *path) for(pos = 0; pos < 64; pos++) { memset(&filename, 0, 9); - sprintf((char *)filename, "TARGET%02d", pos); + sprintf((char*)filename, "TARGET%02d", pos); str255[0] = 8; memcpy(str255 + 1, filename, 8); @@ -2039,7 +2045,7 @@ void Links(const char *path) memcpy(targetSpec.name + 1, filename, 8); memset(&filename, 0, 9); - sprintf((char *)filename, "ALIAS_%02d", pos); + sprintf((char*)filename, "ALIAS_%02d", pos); memset(&aliasSpec, 0, sizeof(FSSpec)); aliasSpec.vRefNum = refNum; aliasSpec.parID = dirId; @@ -2054,7 +2060,7 @@ void Links(const char *path) printf("pos = %d, rc = %d, wRc = %d, cRc = %d, oRc = %d, aRc = %d\n", pos, rc, wRc, cRc, oRc, aRc); } -void MillionFiles(const char *path) +void MillionFiles(const char* path) { OSErr rc, wRc, cRc; Str255 str255; @@ -2067,7 +2073,7 @@ void MillionFiles(const char *path) char filename[9]; int pos = 0; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -2079,7 +2085,7 @@ void MillionFiles(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pMILLION", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pMILLION", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -2091,7 +2097,7 @@ void MillionFiles(const char *path) for(pos = 0; pos < 5000; pos++) { memset(&filename, 0, 9); - sprintf((char *)filename, "%08d", pos); + sprintf((char*)filename, "%08d", pos); str255[0] = 8; memcpy(str255 + 1, filename, 8); @@ -2103,7 +2109,7 @@ void MillionFiles(const char *path) printf("\tCreated %d files\n", pos); } -void DeleteFiles(const char *path) +void DeleteFiles(const char* path) { OSErr rc, wRc, cRc; Str255 str255; @@ -2116,7 +2122,7 @@ void DeleteFiles(const char *path) char filename[9]; int pos = 0; - snprintf((char *)str255, 255, "%s", path); + snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; @@ -2128,7 +2134,7 @@ void DeleteFiles(const char *path) } refNum = hpb.ioVRefNum; - rc = DirCreate(refNum, fsRtDirID, (unsigned char *)"\pDELETED", &dirId); + rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pDELETED", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); @@ -2140,7 +2146,7 @@ void DeleteFiles(const char *path) for(pos = 0; pos < 64; pos++) { memset(&filename, 0, 9); - sprintf((char *)filename, "%08d", pos); + sprintf((char*)filename, "%08d", pos); str255[0] = 8; memcpy(str255 + 1, filename, 8); diff --git a/setter/src/main.c b/setter/src/main.c index 7526f9f..fff8d08 100644 --- a/setter/src/main.c +++ b/setter/src/main.c @@ -29,18 +29,19 @@ Contains global definitions Copyright (C) 2011-2021 Natalia Portillo *****************************************************************************/ -#include "main.h" -#include "defs.h" - #include #include +#include "main.h" + +#include "include/defs.h" + #if defined(macintosh) #include #include #endif -int main(int argc, char **argv) +int main(int argc, char** argv) { size_t clusterSize = 0; diff --git a/setter/src/netware.c b/setter/src/netware.c index 202e5c8..34b6454 100644 --- a/setter/src/netware.c +++ b/setter/src/netware.c @@ -33,76 +33,76 @@ Copyright (C) 2011-2021 Natalia Portillo #include "netware.h" -#include "consts.h" -#include "defs.h" +#include "include/consts.h" +#include "include/defs.h" void GetOsInfo() { // TODO: Implement } -void GetVolumeInfo(const char *path, size_t *clusterSize) +void GetVolumeInfo(const char* path, size_t* clusterSize) { // TODO: Implement *clusterSize = 0; } -void FileAttributes(const char *path) +void FileAttributes(const char* path) { // TODO: Implement } -void FilePermissions(const char *path) +void FilePermissions(const char* path) { // TODO: Implement } -void ExtendedAttributes(const char *path) +void ExtendedAttributes(const char* path) { // TODO: Implement } -void ResourceFork(const char *path) +void ResourceFork(const char* path) { // TODO: Implement } -void Filenames(const char *path) +void Filenames(const char* path) { // TODO: Implement } -void Timestamps(const char *path) +void Timestamps(const char* path) { // TODO: Implement } -void DirectoryDepth(const char *path) +void DirectoryDepth(const char* path) { // TODO: Implement } -void Fragmentation(const char *path, size_t clusterSize) +void Fragmentation(const char* path, size_t clusterSize) { // TODO: Implement } -void Sparse(const char *path) +void Sparse(const char* path) { // TODO: Implement } -void Links(const char *path) +void Links(const char* path) { // TODO: Implement } -void MillionFiles(const char *path) +void MillionFiles(const char* path) { // TODO: Implement } -void DeleteFiles(const char *path) +void DeleteFiles(const char* path) { // TODO: Implement } diff --git a/setter/src/os2_16.c b/setter/src/os2_16.c index e508232..c77e12f 100644 --- a/setter/src/os2_16.c +++ b/setter/src/os2_16.c @@ -42,9 +42,9 @@ Copyright (C) 2011-2021 Natalia Portillo #include "os2_16.h" -#include "consts.h" -#include "defs.h" #include "dosos2.h" +#include "include/consts.h" +#include "include/defs.h" void GetOsInfo() { @@ -79,14 +79,14 @@ void GetOsInfo() printf("\tMaximum path is %d bytes.\n", pathLen[0]); } -void GetVolumeInfo(const char *path, size_t *clusterSize) +void GetVolumeInfo(const char* path, size_t* clusterSize) { USHORT rc; BYTE bData[64]; USHORT cbData = sizeof(bData); PFSALLOCATE pfsAllocateBuffer; USHORT driveNo = path[0] - '@'; - char * fsdName; + char* fsdName; PFSINFO pfsInfo; if(driveNo > 32) driveNo -= 32; @@ -147,7 +147,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) free(pfsInfo); } -void FileAttributes(const char *path) +void FileAttributes(const char* path) { char drivePath[4]; USHORT rc = 0, wRc = 0, cRc = 0; @@ -530,11 +530,11 @@ void FileAttributes(const char *path) cRc); } -void FilePermissions(const char *path) +void FilePermissions(const char* path) { /* Do nothing, not supported by target operating system */ } -void ExtendedAttributes(const char *path) +void ExtendedAttributes(const char* path) { char drivePath[4]; USHORT rc = 0, wRc = 0, cRc = 0; @@ -638,11 +638,11 @@ void ExtendedAttributes(const char *path) printf("\tFile with icon = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "ICON", rc, wRc, cRc); } -void ResourceFork(const char *path) +void ResourceFork(const char* path) { /* Do nothing, not supported by target operating system */ } -void Filenames(const char *path) +void Filenames(const char* path) { char drivePath[4]; USHORT rc = 0, wRc = 0, cRc = 0; @@ -701,7 +701,7 @@ void Filenames(const char *path) #define DATETIME_FORMAT "This file is dated %04d/%02d/%02d %02d:%02d:%02d for %s\n" -void Timestamps(const char *path) +void Timestamps(const char* path) { char drivePath[4]; USHORT rc = 0, wRc = 0, cRc = 0, tRc = 0; @@ -1328,7 +1328,7 @@ void Timestamps(const char *path) printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2K_TIME", rc, wRc, cRc, tRc); } -void DirectoryDepth(const char *path) +void DirectoryDepth(const char* path) { char drivePath[4]; USHORT rc = 0; @@ -1374,14 +1374,14 @@ void DirectoryDepth(const char *path) printf("\tCreated %d levels of directory hierarchy\n", pos); } -void Fragmentation(const char *path, size_t clusterSize) +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; + unsigned char* buffer; char drivePath[4]; USHORT rc = 0, wRc = 0, cRc = 0; USHORT actionTaken = 0; @@ -1660,15 +1660,15 @@ void Fragmentation(const char *path, size_t clusterSize) cRc); } -void Links(const char *path) +void Links(const char* path) { /* Do nothing, not supported by target operating system */ } -void Sparse(const char *path) +void Sparse(const char* path) { /* Do nothing, not supported by target operating system */ } -void MillionFiles(const char *path) +void MillionFiles(const char* path) { char drivePath[4]; USHORT rc = 0; @@ -1722,7 +1722,7 @@ void MillionFiles(const char *path) printf("\tCreated %lu files\n", pos); } -void DeleteFiles(const char *path) +void DeleteFiles(const char* path) { char drivePath[4]; USHORT rc = 0; diff --git a/setter/src/os2_32.c b/setter/src/os2_32.c index f300430..f5600f3 100644 --- a/setter/src/os2_32.c +++ b/setter/src/os2_32.c @@ -40,9 +40,9 @@ Copyright (C) 2011-2021 Natalia Portillo #include #include -#include "consts.h" -#include "defs.h" #include "dosos2.h" +#include "include/consts.h" +#include "include/defs.h" #include "os2_16.h" void GetOsInfo() @@ -74,8 +74,7 @@ void GetOsInfo() printf("OS information:\n"); - if(aulBuffer[2] > 0x20) - printf("\tRunning under OS/2 %d.%d revision %c.\n", MajorVer, MinorVer, aulBuffer[2]); + if(aulBuffer[2] > 0x20) printf("\tRunning under OS/2 %d.%d revision %c.\n", MajorVer, MinorVer, aulBuffer[2]); else printf("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer); @@ -84,14 +83,14 @@ void GetOsInfo() printf("\tMaximum path is %lu bytes.\n", pathLen[0]); } -void GetVolumeInfo(const char *path, size_t *clusterSize) +void GetVolumeInfo(const char* path, size_t* clusterSize) { APIRET rc; BYTE bData[64]; ULONG cbData = sizeof(bData); PFSALLOCATE pfsAllocateBuffer; ULONG driveNo = path[0] - '@'; - char * fsdName; + char* fsdName; PFSINFO pfsInfo; if(driveNo > 32) driveNo -= 32; @@ -152,7 +151,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) free(pfsInfo); } -void FileAttributes(const char *path) +void FileAttributes(const char* path) { char drivePath[4]; APIRET rc = 0, wRc = 0, cRc = 0; @@ -552,19 +551,19 @@ void FileAttributes(const char *path) cRc); } -void FilePermissions(const char *path) +void FilePermissions(const char* path) { /* Do nothing, not supported by target operating system */ } -void ExtendedAttributes(const char *path) +void ExtendedAttributes(const char* path) { /* TODO: Implement */ } -void ResourceFork(const char *path) +void ResourceFork(const char* path) { /* Do nothing, not supported by target operating system */ } -void Filenames(const char *path) +void Filenames(const char* path) { char drivePath[4]; APIRET rc = 0, wRc = 0, cRc = 0; @@ -623,7 +622,7 @@ void Filenames(const char *path) #define DATETIME_FORMAT "This file is dated %04d/%02d/%02d %02d:%02d:%02d for %s\n" -void Timestamps(const char *path) +void Timestamps(const char* path) { char drivePath[4]; APIRET rc = 0, wRc = 0, cRc = 0, tRc = 0; @@ -1250,7 +1249,7 @@ void Timestamps(const char *path) printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", "Y2K_TIME", rc, wRc, cRc, tRc); } -void DirectoryDepth(const char *path) +void DirectoryDepth(const char* path) { char drivePath[4]; APIRET rc = 0; @@ -1296,14 +1295,14 @@ void DirectoryDepth(const char *path) printf("\tCreated %d levels of directory hierarchy\n", pos); } -void Fragmentation(const char *path, size_t clusterSize) +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; + unsigned char* buffer; char drivePath[4]; APIRET rc = 0, wRc = 0, cRc = 0; ULONG actionTaken = 0; @@ -1582,16 +1581,16 @@ void Fragmentation(const char *path, size_t clusterSize) cRc); } -void Sparse(const char *path) +void Sparse(const char* path) { /* Do nothing, not supported by target operating system */ } -void Links(const char *path) +void Links(const char* path) { // TODO: Check if can ask WPS to make Shadow } -void MillionFiles(const char *path) +void MillionFiles(const char* path) { char drivePath[4]; APIRET rc = 0; @@ -1645,7 +1644,7 @@ void MillionFiles(const char *path) printf("\tCreated %lu files\n", pos); } -void DeleteFiles(const char *path) +void DeleteFiles(const char* path) { char drivePath[4]; APIRET rc = 0; diff --git a/setter/src/unix/unix.c b/setter/src/unix/unix.c index d8832eb..6fecdd5 100644 --- a/setter/src/unix/unix.c +++ b/setter/src/unix/unix.c @@ -36,20 +36,19 @@ Copyright (C) 2011-2021 Natalia Portillo #include #include #include +#include +#include +#include +#include #include #include #include "unix.h" -#include "../consts.h" -#include "../defs.h" +#include "../include/consts.h" +#include "../include/defs.h" #include "../linux/linux.h" -#include -#include -#include -#include - void GetOsInfo() { struct utsname buf; diff --git a/setter/src/win32.c b/setter/src/win32.c index e5d7934..6619519 100644 --- a/setter/src/win32.c +++ b/setter/src/win32.c @@ -36,15 +36,16 @@ Copyright (C) 2011-2021 Natalia Portillo #define _CRT_SECURE_NO_WARNINGS 1 +#include + #include #include #include -#include #include "win32.h" -#include "consts.h" -#include "defs.h" +#include "include/consts.h" +#include "include/defs.h" static DWORD dwMaxNameSize = MAX_PATH + 1; static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE; @@ -56,7 +57,7 @@ void GetOsInfo() WIN_OSVERSIONINFO verInfo; BOOL ret; DWORD error; - void * func; + void* func; kernel32 = LoadLibraryA("KERNEL32.DLL"); memset(&verInfo, 0, sizeof(WIN_OSVERSIONINFO)); @@ -115,8 +116,7 @@ void GetOsInfo() { if(verInfo.dwMinorVersion == 10) { - if(verInfo.dwBuildNumber == 2222) - printf("\tRunning under Windows 98 SE"); + if(verInfo.dwBuildNumber == 2222) printf("\tRunning under Windows 98 SE"); else printf("\tRunning under Windows 98"); } @@ -200,7 +200,7 @@ void GetOsInfo() } } -void GetVolumeInfo(const char *path, size_t *clusterSize) +void GetVolumeInfo(const char* path, size_t* clusterSize) { BOOL ret; DWORD error; @@ -218,7 +218,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) ULARGE_INTEGER qwFreeBytesAvailableToCaller; ULARGE_INTEGER qwTotalNumberOfBytes; ULARGE_INTEGER qwTotalNumberOfFreeBytes; - void * func; + void* func; *clusterSize = 0; @@ -496,7 +496,7 @@ void GetVolumeInfo(const char *path, size_t *clusterSize) free(lpRootPathName); } -void FileAttributes(const char *path) +void FileAttributes(const char* path) { BOOL ret; DWORD error; @@ -507,7 +507,7 @@ void FileAttributes(const char *path) DWORD rc, wRc, cRc, aRc, eRc; WIN_OSVERSIONINFO verInfo; DWORD defaultCompression = COMPRESSION_FORMAT_DEFAULT; - void * func; + void* func; HMODULE advapi32; lpRootPathName = malloc(dwMaxNameSize); @@ -556,8 +556,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)noAttributeText, strlen(noAttributeText), &dwNumberOfBytesWritten, NULL); @@ -572,8 +571,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -589,8 +587,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); @@ -605,8 +602,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -621,8 +617,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -639,8 +634,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -655,8 +649,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -673,8 +666,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -697,8 +689,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -721,8 +712,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -746,8 +736,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -770,8 +759,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -795,8 +783,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -818,8 +805,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -842,8 +828,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -865,8 +850,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -886,8 +870,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -910,8 +893,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -933,8 +915,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -957,8 +938,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -981,8 +961,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1006,8 +985,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1032,8 +1010,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1065,8 +1042,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1097,8 +1073,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1128,8 +1103,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1160,8 +1134,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1194,8 +1167,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1227,8 +1199,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1261,8 +1232,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1295,8 +1265,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1328,8 +1297,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1361,8 +1329,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1408,8 +1375,7 @@ void FileAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1443,8 +1409,7 @@ void FileAttributes(const char *path) aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1474,8 +1439,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1508,8 +1472,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1542,8 +1505,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1576,8 +1538,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1611,8 +1572,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1645,8 +1605,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1683,8 +1642,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1721,8 +1679,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1760,8 +1717,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1799,8 +1755,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)encryptedAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1836,8 +1791,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1875,8 +1829,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); @@ -1915,8 +1868,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -1955,8 +1907,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -1996,8 +1947,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -2036,8 +1986,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -2077,8 +2026,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -2119,8 +2067,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = @@ -2162,8 +2109,7 @@ void FileAttributes(const char *path) cRc = 0; aRc = 0; eRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile( @@ -2203,17 +2149,17 @@ void FileAttributes(const char *path) FreeLibrary(advapi32); } -void FilePermissions(const char *path) +void FilePermissions(const char* path) { /* Do nothing, not supported by target operating system */ } -void ExtendedAttributes(const char *path) +void ExtendedAttributes(const char* path) { BOOL ret; DWORD error; WIN_OSVERSIONINFO verInfo; HMODULE ntdll; - void * func; + void* func; DWORD dwNumberOfBytesWritten; DWORD rc, wRc, cRc, rRc; char message[300]; @@ -2340,15 +2286,13 @@ void ExtendedAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); sprintf(message, "This files has an optional .COMMENTS EA\n"); ret = WriteFile(h, message, strlen(message), &dwNumberOfBytesWritten, NULL); - if(!ret) - wRc = GetLastError(); + if(!ret) wRc = GetLastError(); else { eaData = malloc(sizeof(CommentsEA)); @@ -2366,7 +2310,7 @@ void ExtendedAttributes(const char *path) for(i = 0; i < sizeof(CommentsEA); i++) { - if(((unsigned char *)eaData)[i] != CommentsEA[i]) + if(((unsigned char*)eaData)[i] != CommentsEA[i]) { cmp = FALSE; break; @@ -2404,15 +2348,13 @@ void ExtendedAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); sprintf(message, "This files has a critical .COMMENTS EA\n"); ret = WriteFile(h, message, strlen(message), &dwNumberOfBytesWritten, NULL); - if(!ret) - wRc = GetLastError(); + if(!ret) wRc = GetLastError(); else { eaData = malloc(sizeof(CommentsEACritical)); @@ -2430,7 +2372,7 @@ void ExtendedAttributes(const char *path) for(i = 0; i < sizeof(CommentsEACritical); i++) { - if(((unsigned char *)eaData)[i] != CommentsEACritical[i]) + if(((unsigned char*)eaData)[i] != CommentsEACritical[i]) { cmp = FALSE; break; @@ -2468,15 +2410,13 @@ void ExtendedAttributes(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); sprintf(message, "This files has an optional .ICON EA\n"); ret = WriteFile(h, message, strlen(message), &dwNumberOfBytesWritten, NULL); - if(!ret) - wRc = GetLastError(); + if(!ret) wRc = GetLastError(); else { eaData = malloc(sizeof(IconEA)); @@ -2494,7 +2434,7 @@ void ExtendedAttributes(const char *path) for(i = 0; i < sizeof(IconEA); i++) { - if(((unsigned char *)eaData)[i] != IconEA[i]) + if(((unsigned char*)eaData)[i] != IconEA[i]) { cmp = FALSE; break; @@ -2520,7 +2460,7 @@ void ExtendedAttributes(const char *path) FreeLibrary(ntdll); } -void ResourceFork(const char *path) +void ResourceFork(const char* path) { BOOL ret; DWORD error; @@ -2599,8 +2539,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)tinyAdsText, strlen(tinyAdsText), &dwNumberOfBytesWritten, NULL); @@ -2620,8 +2559,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)smallAdsText, strlen(smallAdsText), &dwNumberOfBytesWritten, NULL); @@ -2651,8 +2589,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)mediumAdsText, strlen(mediumAdsText), &dwNumberOfBytesWritten, NULL); @@ -2683,8 +2620,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)bigAdsText, strlen(bigAdsText), &dwNumberOfBytesWritten, NULL); @@ -2713,8 +2649,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)tinyAdsText, strlen(tinyAdsText), &dwNumberOfBytesWritten, NULL); @@ -2734,8 +2669,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)smallAdsText, strlen(smallAdsText), &dwNumberOfBytesWritten, NULL); @@ -2766,8 +2700,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)mediumAdsText, strlen(mediumAdsText), &dwNumberOfBytesWritten, NULL); @@ -2799,8 +2732,7 @@ void ResourceFork(const char *path) rc = 0; wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { ret = WriteFile(h, (LPCVOID)bigAdsText, strlen(bigAdsText), &dwNumberOfBytesWritten, NULL); @@ -2827,7 +2759,7 @@ void ResourceFork(const char *path) cRc); } -void Filenames(const char *path) +void Filenames(const char* path) { BOOL ret; DWORD error; @@ -2888,8 +2820,7 @@ void Filenames(const char *path) wRc = 0; cRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -2906,7 +2837,7 @@ void Filenames(const char *path) } } -void Timestamps(const char *path) +void Timestamps(const char* path) { char message[300]; BOOL ret; @@ -2967,8 +2898,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -2992,8 +2922,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3017,8 +2946,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3042,8 +2970,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3067,8 +2994,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3092,8 +3018,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3117,8 +3042,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3142,8 +3066,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3167,8 +3090,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3192,8 +3114,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3217,8 +3138,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3242,8 +3162,7 @@ void Timestamps(const char *path) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -3263,7 +3182,7 @@ void Timestamps(const char *path) printf("\tFile name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, tRc = %lu\n", "Y2KMTIME", rc, wRc, cRc, tRc); } -void DirectoryDepth(const char *path) +void DirectoryDepth(const char* path) { BOOL ret; DWORD error; @@ -3328,14 +3247,14 @@ void DirectoryDepth(const char *path) printf("\tCreated %ld levels of directory hierarchy\n", pos); } -void Fragmentation(const char *path, size_t clusterSize) +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; + unsigned char* buffer; size_t i; BOOL ret; DWORD error; @@ -3390,8 +3309,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(halfCluster); @@ -3414,8 +3332,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(quarterCluster); @@ -3439,8 +3356,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(twoCluster); @@ -3463,8 +3379,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(threeQuartersCluster); @@ -3492,8 +3407,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(twoAndThreeQuartCluster); @@ -3521,8 +3435,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(twoCluster); @@ -3545,8 +3458,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(twoCluster); @@ -3569,8 +3481,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(twoCluster); @@ -3597,8 +3508,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(threeQuartersCluster); @@ -3633,8 +3543,7 @@ void Fragmentation(const char *path, size_t clusterSize) wRc = 0; cRc = 0; tRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(twoAndThreeQuartCluster); @@ -3658,7 +3567,7 @@ void Fragmentation(const char *path, size_t clusterSize) cRc); } -void Sparse(const char *path) +void Sparse(const char* path) { BOOL ret; DWORD error; @@ -3671,7 +3580,7 @@ void Sparse(const char *path) DWORD rc, wRc, cRc, sRc, zRc; WINNT_FILE_ZERO_DATA_INFORMATION zeroData; HANDLE h; - unsigned char * buffer; + unsigned char* buffer; int i; DWORD dwNumberOfBytesWritten; @@ -3772,8 +3681,7 @@ void Sparse(const char *path) cRc = 0; sRc = 0; zRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(4096 * 3); @@ -3848,8 +3756,7 @@ void Sparse(const char *path) cRc = 0; sRc = 0; zRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { buffer = malloc(4096 * 30); @@ -3919,12 +3826,12 @@ void Sparse(const char *path) zRc); } -void Links(const char *path) +void Links(const char* path) { BOOL ret; DWORD error; WIN_OSVERSIONINFO verInfo; - void * func; + void* func; DWORD dwNumberOfBytesWritten; DWORD rc, wRc, cRc, lRc; char message[300]; @@ -4025,8 +3932,7 @@ void Links(const char *path) wRc = 0; cRc = 0; lRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -4067,8 +3973,7 @@ void Links(const char *path) wRc = 0; cRc = 0; lRc = 0; - if(h == INVALID_HANDLE_VALUE) - rc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); else { memset(message, 0, 300); @@ -4087,7 +3992,7 @@ void Links(const char *path) } } -void MillionFiles(const char *path) +void MillionFiles(const char* path) { char filename[9]; DWORD pos = 0; @@ -4153,7 +4058,7 @@ void MillionFiles(const char *path) printf("\tCreated %lu files\n", pos); } -void DeleteFiles(const char *path) +void DeleteFiles(const char* path) { char filename[9]; DWORD pos = 0;