all: Remove support for obsolete systems

https://gitlab.freedesktop.org/poppler/poppler/issues/709
diff --git a/goo/gdir.h b/goo/gdir.h
index 7d39c49..b9b8e2b 100644
--- a/goo/gdir.h
+++ b/goo/gdir.h
@@ -77,13 +77,8 @@
 #if defined(_WIN32)
   WIN32_FIND_DATAA ffd;
   HANDLE hnd;
-#elif defined(ACORN)
-#elif defined(MACOS)
 #else
   DIR *dir;			// the DIR structure from opendir()
-#ifdef VMS
-  bool needParent;		// need to return an entry for [-]
-#endif
 #endif
 };
 
diff --git a/goo/gfile.cc b/goo/gfile.cc
index e7710b5..eae5120 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -37,21 +37,12 @@
 #include <config.h>
 
 #ifndef _WIN32
-#  if defined(MACOS)
-#    include <sys/stat.h>
-#  elif !defined(ACORN)
-#    include <sys/types.h>
-#    include <sys/stat.h>
-#    include <fcntl.h>
-#  endif
+#  include <sys/types.h>
+#  include <sys/stat.h>
+#  include <fcntl.h>
 #  include <limits.h>
 #  include <string.h>
-#  if !defined(VMS) && !defined(ACORN) && !defined(MACOS)
-#    include <pwd.h>
-#  endif
-#  if defined(VMS) && (__DECCXX_VER < 50200000)
-#    include <unixlib.h>
-#  endif
+#  include <pwd.h>
 #endif // _WIN32
 #include <stdio.h>
 #include <limits>
@@ -108,47 +99,7 @@
 //------------------------------------------------------------------------
 
 GooString *appendToPath(GooString *path, const char *fileName) {
-#if defined(VMS)
-  //---------- VMS ----------
-  //~ this should handle everything necessary for file
-  //~ requesters, but it's certainly not complete
-  char *p0, *p1, *p2;
-  char *q1;
-
-  p0 = path->c_str();
-  p1 = p0 + path->getLength() - 1;
-  if (!strcmp(fileName, "-")) {
-    if (*p1 == ']') {
-      for (p2 = p1; p2 > p0 && *p2 != '.' && *p2 != '['; --p2) ;
-      if (*p2 == '[')
-	++p2;
-      path->del(p2 - p0, p1 - p2);
-    } else if (*p1 == ':') {
-      path->append("[-]");
-    } else {
-      path->clear();
-      path->append("[-]");
-    }
-  } else if ((q1 = strrchr(fileName, '.')) && !strncmp(q1, ".DIR;", 5)) {
-    if (*p1 == ']') {
-      path->insert(p1 - p0, '.');
-      path->insert(p1 - p0 + 1, fileName, q1 - fileName);
-    } else if (*p1 == ':') {
-      path->append('[');
-      path->append(']');
-      path->append(fileName, q1 - fileName);
-    } else {
-      path->clear();
-      path->append(fileName, q1 - fileName);
-    }
-  } else {
-    if (*p1 != ']' && *p1 != ':')
-      path->clear();
-    path->append(fileName);
-  }
-  return path;
-
-#elif defined(_WIN32)
+#ifdef _WIN32
   //---------- Win32 ----------
   GooString *tmp;
   char buf[256];
@@ -163,80 +114,6 @@
   path->append(buf);
   return path;
 
-#elif defined(ACORN)
-  //---------- RISCOS ----------
-  char *p;
-  int i;
-
-  path->append(".");
-  i = path->getLength();
-  path->append(fileName);
-  for (p = path->c_str() + i; *p; ++p) {
-    if (*p == '/') {
-      *p = '.';
-    } else if (*p == '.') {
-      *p = '/';
-    }
-  }
-  return path;
-
-#elif defined(MACOS)
-  //---------- MacOS ----------
-  char *p;
-  int i;
-
-  path->append(":");
-  i = path->getLength();
-  path->append(fileName);
-  for (p = path->c_str() + i; *p; ++p) {
-    if (*p == '/') {
-      *p = ':';
-    } else if (*p == '.') {
-      *p = ':';
-    }
-  }
-  return path;
-
-#elif defined(__EMX__)
-  //---------- OS/2+EMX ----------
-  int i;
-
-  // appending "." does nothing
-  if (!strcmp(fileName, "."))
-    return path;
-
-  // appending ".." goes up one directory
-  if (!strcmp(fileName, "..")) {
-    for (i = path->getLength() - 2; i >= 0; --i) {
-      if (path->getChar(i) == '/' || path->getChar(i) == '\\' ||
-	  path->getChar(i) == ':')
-	break;
-    }
-    if (i <= 0) {
-      if (path->getChar(0) == '/' || path->getChar(0) == '\\') {
-	path->del(1, path->getLength() - 1);
-      } else if (path->getLength() >= 2 && path->getChar(1) == ':') {
-	path->del(2, path->getLength() - 2);
-      } else {
-	path->clear();
-	path->append("..");
-      }
-    } else {
-      if (path->getChar(i-1) == ':')
-	++i;
-      path->del(i, path->getLength() - i);
-    }
-    return path;
-  }
-
-  // otherwise, append "/" and new path component
-  if (path->getLength() > 0 &&
-      path->getChar(path->getLength() - 1) != '/' &&
-      path->getChar(path->getLength() - 1) != '\\')
-    path->append('/');
-  path->append(fileName);
-  return path;
-
 #else
   //---------- Unix ----------
   int i;
@@ -534,11 +411,7 @@
 }
 
 GooFile* GooFile::open(const GooString *fileName) {
-#ifdef VMS
-  int fd = ::open(fileName->c_str(), Q_RDONLY, "ctx=stm");
-#else
   int fd = openFileDescriptor(fileName->c_str(), O_RDONLY);
-#endif
   
   return fd < 0 ? nullptr : new GooFile(fd);
 }
@@ -566,11 +439,8 @@
 //------------------------------------------------------------------------
 
 GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) {
-#ifdef VMS
-  char *p;
-#elif defined(_WIN32)
+#ifdef _WIN32
   DWORD fa;
-#elif defined(ACORN)
 #else
   struct stat st;
 #endif
@@ -580,12 +450,6 @@
   fullPath = new GooString(dirPath);
   appendToPath(fullPath, nameA);
   if (doStat) {
-#ifdef VMS
-    if (!strcmp(nameA, "-") ||
-	((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5)))
-      dir = true;
-#elif defined(ACORN)
-#else
 #ifdef _WIN32
     fa = GetFileAttributesA(fullPath->c_str());
     dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY));
@@ -593,7 +457,6 @@
     if (stat(fullPath->c_str(), &st) == 0)
       dir = S_ISDIR(st.st_mode);
 #endif
-#endif
   }
 }
 
@@ -605,32 +468,25 @@
 GDir::GDir(const char *name, bool doStatA) {
   path = new GooString(name);
   doStat = doStatA;
-#if defined(_WIN32)
+#ifdef _WIN32
   GooString *tmp;
 
   tmp = path->copy();
   tmp->append("/*.*");
   hnd = FindFirstFileA(tmp->c_str(), &ffd);
   delete tmp;
-#elif defined(ACORN)
-#elif defined(MACOS)
 #else
   dir = opendir(name);
-#ifdef VMS
-  needParent = strchr(name, '[') != NULL;
-#endif
 #endif
 }
 
 GDir::~GDir() {
   delete path;
-#if defined(_WIN32)
+#ifdef _WIN32
   if (hnd != INVALID_HANDLE_VALUE) {
     FindClose(hnd);
     hnd = INVALID_HANDLE_VALUE;
   }
-#elif defined(ACORN)
-#elif defined(MACOS)
 #else
   if (dir)
     closedir(dir);
@@ -640,7 +496,7 @@
 GDirEntry *GDir::getNextEntry() {
   GDirEntry *e = nullptr;
 
-#if defined(_WIN32)
+#ifdef _WIN32
   if (hnd != INVALID_HANDLE_VALUE) {
     e = new GDirEntry(path->c_str(), ffd.cFileName, doStat);
     if (!FindNextFileA(hnd, &ffd)) {
@@ -648,21 +504,6 @@
       hnd = INVALID_HANDLE_VALUE;
     }
   }
-#elif defined(ACORN)
-#elif defined(MACOS)
-#elif defined(VMS)
-  struct dirent *ent;
-  if (dir) {
-    if (needParent) {
-      e = new GDirEntry(path->c_str(), "-", doStat);
-      needParent = false;
-      return e;
-    }
-    ent = readdir(dir);
-    if (ent) {
-      e = new GDirEntry(path->c_str(), ent->d_name, doStat);
-    }
-  }
 #else
   struct dirent *ent;
   if (dir) {
@@ -689,13 +530,8 @@
   tmp->append("/*.*");
   hnd = FindFirstFileA(tmp->c_str(), &ffd);
   delete tmp;
-#elif defined(ACORN)
-#elif defined(MACOS)
 #else
   if (dir)
     rewinddir(dir);
-#ifdef VMS
-  needParent = strchr(path->c_str(), '[') != NULL;
-#endif
 #endif
 }
diff --git a/goo/gfile.h b/goo/gfile.h
index e6ab2d9..ace17be 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -51,15 +51,10 @@
 #    endif
 #    include <windows.h>
 #  endif
-#elif defined(ACORN)
-#elif defined(MACOS)
-#  include <ctime.h>
 #else
 #  include <unistd.h>
 #  include <sys/types.h>
-#  if defined(VMS)
-#    include "vms_dirent.h"
-#  elif defined(HAVE_DIRENT_H)
+#  if defined(HAVE_DIRENT_H)
 #    include <dirent.h>
 #    define NAMLEN(d) strlen((d)->d_name)
 #  else
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index e639bd4..60d3ca9 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -402,8 +402,6 @@
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
   textEOL = eolDOS;
-#elif defined(MACOS)
-  textEOL = eolMac;
 #else
   textEOL = eolUnix;
 #endif
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index b17c351..9a7adc1 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -86,11 +86,6 @@
 #include "PSOutputDev.h"
 #include "PDFDoc.h"
 
-#ifdef MACOS
-// needed for setting type/creator of MacOS files
-#include "ICSupport.h"
-#endif
-
 // the MSVC math.h doesn't define this
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
@@ -1471,9 +1466,6 @@
       }
     }
     if (fileType == psFile) {
-#ifdef MACOS
-      ICS_MapRefNumAndAssign((short)((FILE *)outputStream)->handle);
-#endif
       fclose((FILE *)outputStream);
     }
 #ifdef HAVE_POPEN
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 195232f..4f5db27 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -77,12 +77,6 @@
 #include "SplashOutputDev.h"
 #include <algorithm>
 
-#ifdef VMS
-#if (__VMS_VER < 70000000)
-extern "C" int unlink(char *filename);
-#endif
-#endif
-
 static const double s_minLineWidth = 0.0;
 
 static inline void convertGfxColor(SplashColorPtr dest,
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 68c4f11..cc855df 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -82,14 +82,6 @@
 static bool setDJSYSFLAGS = false;
 #endif
 
-#ifdef VMS
-#ifdef __GNUC__
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-#endif
-
 //------------------------------------------------------------------------
 // Stream (base class)
 //------------------------------------------------------------------------
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 0c35b42..c336788 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -75,11 +75,6 @@
 #include "Annot.h"
 #include "UTF.h"
 
-#ifdef MACOS
-// needed for setting type/creator of MacOS files
-#include "ICSupport.h"
-#endif
-
 //------------------------------------------------------------------------
 // parameters
 //------------------------------------------------------------------------
@@ -5674,9 +5669,6 @@
 
 TextOutputDev::~TextOutputDev() {
   if (needClose) {
-#ifdef MACOS
-    ICS_MapRefNumAndAssign((short)((FILE *)outputStream)->handle);
-#endif
     fclose((FILE *)outputStream);
   }
   if (text) {
diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc
index 109e1a0..727cf25 100644
--- a/splash/SplashFTFontEngine.cc
+++ b/splash/SplashFTFontEngine.cc
@@ -36,12 +36,6 @@
 #include "SplashFTFontFile.h"
 #include "SplashFTFontEngine.h"
 
-#ifdef VMS
-#if (__VMS_VER < 70000000)
-extern "C" int unlink(char *filename);
-#endif
-#endif
-
 //------------------------------------------------------------------------
 // SplashFTFontEngine
 //------------------------------------------------------------------------
diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc
index 627f3b0..907de8b 100644
--- a/splash/SplashFontEngine.cc
+++ b/splash/SplashFontEngine.cc
@@ -44,18 +44,6 @@
 #include "SplashFont.h"
 #include "SplashFontEngine.h"
 
-#ifdef VMS
-#if (__VMS_VER < 70000000)
-extern "C" int unlink(char *filename);
-#endif
-#endif
-
-#ifdef VMS
-#if (__VMS_VER < 70000000)
-extern "C" int unlink(char *filename);
-#endif
-#endif
-
 //------------------------------------------------------------------------
 // SplashFontEngine
 //------------------------------------------------------------------------
diff --git a/splash/SplashFontFile.cc b/splash/SplashFontFile.cc
index bf41cbe..c91c99e 100644
--- a/splash/SplashFontFile.cc
+++ b/splash/SplashFontFile.cc
@@ -30,12 +30,6 @@
 #include "SplashFontFile.h"
 #include "SplashFontFileID.h"
 
-#ifdef VMS
-#if (__VMS_VER < 70000000)
-extern "C" int unlink(char *filename);
-#endif
-#endif
-
 //------------------------------------------------------------------------
 // SplashFontFile
 //------------------------------------------------------------------------
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 3f28fb2..caf125e 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -964,11 +964,7 @@
     // print info
     long long filesize = 0;
 
-#ifdef VMS
-    f = fopen(fileName->c_str(), "rb", "ctx=stm");
-#else
     f = fopen(fileName->c_str(), "rb");
-#endif
     if (f) {
       Gfseek(f, 0, SEEK_END);
       filesize = Gftell(f);