Removed all PDOS related stuff
authorRobert Pengelly <robertapengelly@hotmail.com>
Wed, 19 Aug 2026 09:44:29 +0000 (10:44 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Wed, 19 Aug 2026 09:44:29 +0000 (10:44 +0100)
common.c
mcopy.c
mkfs.c
report.c

index 8fc99f6e16623f2e4481d2bc8c5131b5dd42be2a..866e12b4c56010789fc6bbf05641bd9c3bb75666 100644 (file)
--- a/common.c
+++ b/common.c
@@ -9,13 +9,11 @@
 #include    <string.h>
 #include    <time.h>
 
-#ifndef     __PDOS__
-# if     defined (__GNUC__)
-#  include  <sys/time.h>
-#  include  <unistd.h>
-# else
-#  include  <io.h>
-# endif
+#if     defined (__GNUC__)
+# include   <sys/time.h>
+# include   <unistd.h>
+#else
+# include   <io.h>
 #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 e7b4b3b5850624688992ec059ef31e8ea19978c5..259122566bc6e89f7fe8c3647b58442b143e83fb 100644 (file)
--- a/mcopy.c
+++ b/mcopy.c
@@ -8,17 +8,15 @@
 #include    <stdlib.h>
 #include    <string.h>
 
-#ifndef     __PDOS__
-# if    defined (_WIN32)
-#  include  <windows.h>
-#  include  <winioctl.h>
-# elif defined (__GNUC__)
-#  include  <sys/ioctl.h>
-#  include  <termios.h>
-#  include  <unistd.h>
-#  if   defined (__CYGWIN__)
-#   include  <sys/socket.h>
-#  endif
+#if     defined (_WIN32)
+# include   <windows.h>
+# include   <winioctl.h>
+#elif defined (__GNUC__)
+# include   <sys/ioctl.h>
+# include   <termios.h>
+# include   <unistd.h>
+# if   defined (__CYGWIN__)
+#  include  <sys/socket.h>
 # 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 50696eb608ce4989d845db7bbade6a2523fd863c..bab697de1eb1ccaa004b4ffc95f0da99066fc18f 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
 #include    "report.h"
 #include    "write7x.h"
 
-#ifndef     __PDOS__
-# if     defined (__GNUC__)
-#  include  <sys/time.h>
-#  include  <unistd.h>
-# else
-#  include  <io.h>
-# endif
+#if     defined (__GNUC__)
+# include   <sys/time.h>
+# include   <unistd.h>
+#else
+# include   <io.h>
 #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;
     
index 8e128ef31f46400f43a7afab03f4526adf5fcc2c..7ac81783cdf746714d0733d3055ccd99f6ab09ba 100644 (file)
--- 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   <windows.h>
 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