diff --git a/bin/fex b/bin/fex index aebf62d..59ec24f 100755 Binary files a/bin/fex and b/bin/fex differ diff --git a/inc/sanity.h b/inc/sanity.h index d2c92ef..1858be7 100644 --- a/inc/sanity.h +++ b/inc/sanity.h @@ -5,19 +5,13 @@ #ifndef SANITY_H #define SANITY_H -#include - #define SANITY_SUCCESS 0 // 0000 - All checks passed #define SANITY_CON_FAIL 1 // 0001 - /con check failed #define SANITY_EXE_FAIL 2 // 0010 - /exe check failed #define SANITY_UTI_FAIL 4 // 0100 - /uti check failed +#define SANITY_LIB_FAIL 8 // 1000 - /uti/lib check failed +#define SANITY_HDR_FAIL 16 // 100000 - /uti/hdr check failed -/*typedef struct { - bool conEx; - bool exeEx; - bool utiEx; -} SanityCheckResult;*/ - -const int isSysSane(); +int isSysSane(); #endif //SANITY_H diff --git a/obj/fex.o b/obj/fex.o index 0f9225c..4846d01 100644 Binary files a/obj/fex.o and b/obj/fex.o differ diff --git a/obj/sanity.o b/obj/sanity.o index 9797db5..9f386d5 100644 Binary files a/obj/sanity.o and b/obj/sanity.o differ diff --git a/src/fex.c b/src/fex.c index af07eb3..212f66d 100644 --- a/src/fex.c +++ b/src/fex.c @@ -8,8 +8,8 @@ #include #include #include -#include - +#include "config.h" +#include "debug.h" void help() { @@ -25,9 +25,7 @@ int main(int argc, char** argv) { return 1; } - const char* flagNames[] = {"Install", "Update", "Source", "Remove", "List", "Search","Verbose", "Force", "Upgrade"}; - int* flagValues[] = {&fIns, &fUpd, &fSrc, &fUin, &fLis, &fSer, &fVer, &fFrc, &fUpg}; - int flagCount = sizeof(flagNames) / sizeof(flagNames[0]); // This should match the number of flags + for(int i = 1; i < argc; i++) { if(argv[i][0] == '-') { @@ -73,6 +71,11 @@ int main(int argc, char** argv) { const int sysSanity = isSysSane(); #ifdef debugEnabled + DEBUG_PRINT("sysSanity: %d", sysSanity); + const char* flagNames[] = {"Install", "Update", "Source", "Remove", "List", "Search","Verbose", "Force", "Upgrade"}; + int* flagValues[] = {&fIns, &fUpd, &fSrc, &fUin, &fLis, &fSer, &fVer, &fFrc, &fUpg}; + int flagCount = sizeof(flagNames) / sizeof(flagNames[0]); // This should match the number of flags + for(int i = 0; i < flagCount; i++) { nprint("D", "Flag %s: %d", flagNames[i], *flagValues[i]); } diff --git a/src/sanity.c b/src/sanity.c index 26ce81a..cc376ff 100644 --- a/src/sanity.c +++ b/src/sanity.c @@ -1,7 +1,5 @@ #include -#include -#include -#include +#include "../inc/sanity.h" /* * 0: success @@ -14,34 +12,22 @@ * 7: total failure */ -/*SanityCheckResult isSane() { +int isSysSane() { struct stat conStat, exeStat, utiStat; - SanityCheckResult result = {true, true, true}; // Default to true, assume checks will pass*/ -struct stat conStat; -struct stat exeStat; -struct stat utiStat; -int result; + int result = 0; -const int isSysSane() { if (stat("/con", &conStat) != 0 || !(conStat.st_mode & S_IWUSR)) { - //result.conEx = false; result |= SANITY_CON_FAIL; } if (stat("/exe", &exeStat) != 0 || !(exeStat.st_mode & S_IWUSR)) { - //result.exeEx = false; result |= SANITY_EXE_FAIL; } if (stat("/uti", &utiStat) != 0 || !(utiStat.st_mode & S_IWUSR)) { - //result.utiEx = false; result |= SANITY_UTI_FAIL; } - /*nprint("D", "con: %d", result.conEx); - nprint("D", "exe: %d", result.exeEx); - nprint("D", "uti: %d", result.utiEx);*/ - //nprint("D", "Result: %d", sumResult); return result; }