From: Robert Pengelly Date: Wed, 19 Aug 2026 09:44:29 +0000 (+0100) Subject: Removed all PDOS related stuff X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=2cee7d446fe7ae62635615351c6fe71b3a0dec60;p=dosfstools.git Removed all PDOS related stuff --- diff --git a/common.c b/common.c index 8fc99f6..866e12b 100644 --- a/common.c +++ b/common.c @@ -9,13 +9,11 @@ #include #include -#ifndef __PDOS__ -# if defined (__GNUC__) -# include -# include -# else -# include -# endif +#if defined (__GNUC__) +# include +# include +#else +# include #endif #include "common.h" @@ -753,7 +751,7 @@ unsigned int mode_con (char *p) { unsigned short generate_datestamp (void) { -#if defined (__GNUC__) && !defined (__PDOS__) +#if defined (__GNUC__) struct timeval create_timeval; #else time_t create_time; @@ -761,7 +759,7 @@ unsigned short generate_datestamp (void) { struct tm *xctime = NULL; -#if defined (__GNUC__) && !defined (__PDOS__) +#if defined (__GNUC__) if (gettimeofday (&create_timeval, 0) == 0 && create_timeval.tv_sec != (time_t) -1) { xctime = localtime ((time_t *) &create_timeval.tv_sec); @@ -785,7 +783,7 @@ unsigned short generate_datestamp (void) { unsigned short generate_timestamp (void) { -#if defined (__GNUC__) && !defined (__PDOS__) +#if defined (__GNUC__) struct timeval create_timeval; #else time_t create_time; @@ -793,7 +791,7 @@ unsigned short generate_timestamp (void) { struct tm *xctime = NULL; -#if defined (__GNUC__) && !defined (__PDOS__) +#if defined (__GNUC__) if (gettimeofday (&create_timeval, 0) == 0 && create_timeval.tv_sec != (time_t) -1) { xctime = localtime ((time_t *) &create_timeval.tv_sec); diff --git a/mcopy.c b/mcopy.c index e7b4b3b..2591225 100644 --- a/mcopy.c +++ b/mcopy.c @@ -8,17 +8,15 @@ #include #include -#ifndef __PDOS__ -# if defined (_WIN32) -# include -# include -# elif defined (__GNUC__) -# include -# include -# include -# if defined (__CYGWIN__) -# include -# endif +#if defined (_WIN32) +# include +# include +#elif defined (__GNUC__) +# include +# include +# include +# if defined (__CYGWIN__) +# include # endif #endif @@ -442,11 +440,10 @@ static void parse_args (int *pargc, char ***pargv, int optind) { } -#ifndef __PDOS__ /** Get a single character from the terminal. */ static char getch (void) { -#if defined(_WIN32) && !defined (__PDOS__) +#if defined(_WIN32) KEY_EVENT_RECORD keyevent; INPUT_RECORD irec; @@ -511,20 +508,10 @@ static char getch (void) { } -#else - - int key; - -#if defined (__PDOS__) - - setvbuf (stdin, NULL, _IONBF, 0); - - for (;;) { - #else struct termios term; - int nbbytes; + int nbbytes, key; tcgetattr (0, &term); @@ -596,14 +583,8 @@ static char getch (void) { } -#if defined (__PDOS__) - setvbuf (stdin, NULL, _IOLBF, 0); -#else - term.c_lflag |= (ICANON | ECHO); /* turn on line buffering and echoing */ tcsetattr (0, TCSANOW, &term); - -#endif switch (key) { @@ -662,20 +643,10 @@ static char getch (void) { } -#endif - } -#endif static int check_overwrite (const char *fn) { -#if defined (__PDOS__) - - report_at (NULL, 0, REPORT_WARNING, "overwriting %s", fn); - return 1; - -#else - int ch; printf ("File %s already exists.\n", fn); @@ -697,8 +668,6 @@ static int check_overwrite (const char *fn) { return check_overwrite (fn); -#endif - } diff --git a/mkfs.c b/mkfs.c index 50696eb..bab697d 100644 --- a/mkfs.c +++ b/mkfs.c @@ -13,13 +13,11 @@ #include "report.h" #include "write7x.h" -#ifndef __PDOS__ -# if defined (__GNUC__) -# include -# include -# else -# include -# endif +#if defined (__GNUC__) +# include +# include +#else +# include #endif static int align_structures = 1; @@ -260,14 +258,7 @@ static unsigned int align_object (unsigned int sectors, unsigned int clustsize) static unsigned int generate_volume_id (void) { -#if defined (__PDOS__) - - srand (time (NULL)); - - /* rand() returns int from [0,RAND_MAX], therefor only 31-bits. */ - return (((unsigned int) (rand () & 0xFFFF)) << 16) | ((unsigned int) (rand() & 0xFFFF)); - -#elif defined (__GNUC__) +#if defined (__GNUC__) struct timeval now; diff --git a/report.c b/report.c index 8e128ef..7ac8178 100644 --- a/report.c +++ b/report.c @@ -9,16 +9,20 @@ unsigned long errors = 0; -#ifndef __PDOS__ -#if defined (_WIN32) +#if defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) +static void reset_console_color (void) { + fprintf (stderr, "\033[0m"); +} + +static void set_console_color (int color) { + fprintf (stderr, "\033[%dm", color); +} +#elif defined (_WIN32) # include static int OriginalConsoleColor = -1; -#endif static void reset_console_color (void) { -#if defined (_WIN32) - HANDLE hStdError = GetStdHandle (STD_ERROR_HANDLE); if (OriginalConsoleColor == -1) { return; } @@ -26,18 +30,10 @@ static void reset_console_color (void) { SetConsoleTextAttribute (hStdError, OriginalConsoleColor); OriginalConsoleColor = -1; -#else - - fprintf (stderr, "\033[0m"); - -#endif - } static void set_console_color (int color) { -#if defined (_WIN32) - HANDLE hStdError = GetStdHandle (STD_ERROR_HANDLE); WORD wColor; @@ -56,12 +52,6 @@ static void set_console_color (int color) { wColor = (OriginalConsoleColor & 0xF0) + (color & 0xF); SetConsoleTextAttribute (hStdError, wColor); -#else - - fprintf (stderr, "\033[%dm", color); - -#endif - } #endif @@ -93,7 +83,7 @@ static void output_message (const char *filename, unsigned long lineno, unsigned if (type == REPORT_ERROR || type == REPORT_FATAL_ERROR) { -#ifndef __PDOS__ +#if defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) || defined (_WIN32) set_console_color (COLOR_ERROR); #endif @@ -105,7 +95,7 @@ static void output_message (const char *filename, unsigned long lineno, unsigned } else if (type == REPORT_INTERNAL_ERROR) { -#ifndef __PDOS__ +#if defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) || defined (_WIN32) set_console_color (COLOR_INTERNAL_ERROR); #endif @@ -113,7 +103,7 @@ static void output_message (const char *filename, unsigned long lineno, unsigned } else if (type == REPORT_WARNING) { -#ifndef __PDOS__ +#if defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) || defined (_WIN32) set_console_color (COLOR_WARNING); #endif @@ -121,7 +111,7 @@ static void output_message (const char *filename, unsigned long lineno, unsigned } -#ifndef __PDOS__ +#if defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) || defined (_WIN32) reset_console_color (); #endif