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

index 7c32f1815eb632f8a6664cc30a0bff0740f9b4f3..d4930b6447dd4a9d06eafad8535033d4211daacd 100644 (file)
--- a/parted.c
+++ b/parted.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 long cylinders = 0;
@@ -179,14 +177,7 @@ static void calculate_geometry (void) {
 /** Generate a unique volume id. */
 static unsigned int generate_signature (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;
     
@@ -220,9 +211,7 @@ static void get_random_bytes (void *buf, unsigned long nbytes) {
     
     unsigned long i;
     
-#if     defined (__PDOS__)
-    seed = time (NULL);
-#elif   defined (__GNUC__)
+#if     defined (__GNUC__)
 
     struct timeval now;
     seed = (getpid () << 16);
index cb60fe717f11eb18f3ba99ab19adce8cd19df7ed..1dc02977777a92fc038cd77865523eeef9eeb65f 100644 (file)
--- a/report.c
+++ b/report.c
@@ -6,16 +6,20 @@
 
 #include    "report.h"
 
-#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; }
@@ -23,18 +27,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;
     
@@ -53,12 +49,6 @@ static void set_console_color (int color) {
     wColor = (OriginalConsoleColor & 0xF0) + (color & 0xF);
     SetConsoleTextAttribute (hStdError, wColor);
 
-#else
-
-    fprintf (stderr, "\033[%dm", color);
-
-#endif
-
 }
 #endif
 
@@ -82,7 +72,7 @@ void report_at (const char *filename, unsigned long line_number, int type, const
     
     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
         
@@ -94,7 +84,7 @@ void report_at (const char *filename, unsigned long line_number, int type, const
     
     } 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
         
@@ -102,15 +92,15 @@ void report_at (const char *filename, unsigned long line_number, int type, const
     
     } else if (type == REPORT_WARNING) {
     
-        #ifndef     __PDOS__
-        set_console_color (COLOR_INTERNAL_ERROR);
+#if     defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) || defined (_WIN32)
+        set_console_color (COLOR_WARNING);
 #endif
         
         fprintf (stderr, "warning:");
     
     }
     
-#ifndef     __PDOS__
+#if     defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__) || defined (_WIN32)
     reset_console_color ();
 #endif