From 922ac79b2d91b6e7ecb8e75e41ae081da53b77e0 Mon Sep 17 00:00:00 2001
From: zesstra <zesstra@zesstra.de>
Date: Thu, 16 Apr 2009 00:24:38 +0200
Subject: [PATCH 10/12] Removed MSDOS filesystem semantics

Checks for MSDOS_FS and special behaviour (e.g. \\ as path separator) are
removed.

Signed-off-by: zesstra <zesstra@zesstra.de>
---
 doc/driver/predefined    |    6 ++----
 src/files.c              |    6 ------
 src/lex.c                |    3 ---
 src/main.c               |   11 -----------
 src/object.c             |   19 -------------------
 src/port.h               |    6 ------
 src/simulate.c           |   30 ------------------------------
 src/util/indent/args.c   |    5 +----
 src/util/indent/indent.c |   13 -------------
 9 files changed, 3 insertions(+), 96 deletions(-)

diff --git a/doc/driver/predefined b/doc/driver/predefined
index 27e8dbc..8ee651a 100644
--- a/doc/driver/predefined
+++ b/doc/driver/predefined
@@ -69,9 +69,6 @@ DESCRIPTION
       __LPC_ARRAY_CALLS__: call_other()s on arrays of objects enabled.
       __BOOT_TIME__      : the time() the driver was started.
 
-    If the driver is compiled for using the MS-DOS filesystem
-    conventions, __MSDOS_FS__ is defined.
-
     If the ERQ is supported, the following macros are defined:
 
       __ERQ_MAX_SEND__  : the max size of the send buffer
@@ -118,7 +115,8 @@ HISTORY
     3.3.713 added __IDNA__, __SQLITE__.
     3.3.714 added __OPENSSL__, __GNUTLS__.
     3.3.718 added __XML_DOM__.
-    3.3.719 removed __PTHREADS__ and added __GCRYPT__.
+    3.3.719 removed __PTHREADS__, AMIGA, MSDOS_FS, __BEOS__  
+		    and added __GCRYPT__.
 
 SEE ALSO
     pragma(LPC), preprocessor(LPC)
diff --git a/src/files.c b/src/files.c
index 9756d61..554469b 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1295,9 +1295,6 @@ v_read_file (svalue_t *sp, int num_arg)
         for (p2 = str; p != end; ) {
             c = *p++;
             if ( c == '\n' ) {
-#ifdef MSDOS_FS
-                if ( p2[-1] == '\r' ) p2--;
-#endif
                 if (!--len) {
                     *p2++=c;
                     break;
@@ -1336,9 +1333,6 @@ v_read_file (svalue_t *sp, int num_arg)
             for (p = p2; p != end; ) {
                 c = *p++;
                 if ( c == '\n' ) {
-#ifdef MSDOS_FS
-                    if ( p2[-1] == '\r' ) p2--;
-#endif
                     if (!--len) {
                         *p2++ = c;
                         break;
diff --git a/src/lex.c b/src/lex.c
index 2878bae..b17859a 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -818,9 +818,6 @@ init_lexer(void)
 #ifdef EVAL_COST_TRACE
     add_permanent_define("__EVAL_COST_TRACE__", -1, string_copy("1"), MY_FALSE);
 #endif
-#ifdef MSDOS_FS
-    add_permanent_define("__MSDOS_FS__", -1, string_copy("1"), MY_FALSE);
-#endif
 #ifdef HAS_IDN
     add_permanent_define("__IDNA__", -1, string_copy("1"), MY_FALSE);
 #endif
diff --git a/src/main.c b/src/main.c
index 4c7e58d..e8ba358 100644
--- a/src/main.c
+++ b/src/main.c
@@ -541,11 +541,7 @@ main (int argc, char **argv)
                      , (unsigned long)strlen(BINDIR)+6);
             }
             strcpy(erq_file, BINDIR);
-#ifndef MSDOS_FS
             strcat(erq_file, "/erq");
-#else
-            strcat(erq_file, "\\erq");
-#endif
         }
         else if (*erq_file != '/')
         {
@@ -557,11 +553,7 @@ main (int argc, char **argv)
                      , (unsigned long)(strlen(BINDIR)+2+strlen(erq_file)));
             }
             strcpy(tmp, BINDIR);
-#ifndef MSDOS_FS
             strcat(tmp, "/");
-#else
-            strcat(tmp, "\\");
-#endif
             strcat(tmp, erq_file);
             free(erq_file);
             erq_file = tmp;
@@ -2089,9 +2081,6 @@ options (void)
 #       if defined(NO_INLINES)
                               , "NO_INLINES"
 #       endif
-#       if defined(MSDOS_FS)
-                              , "MSDOS_FS"
-#       endif
 #       if defined(TRACECODE)
                               , "TRACECODE"
 #       endif
diff --git a/src/object.c b/src/object.c
index 84708aa..dff6cbb 100644
--- a/src/object.c
+++ b/src/object.c
@@ -6723,13 +6723,8 @@ v_save_object (svalue_t *sp, int numarg)
         tmp_name = name + len + sizeof save_file_suffix;
         strcpy(name, get_txt(sfile));
 
-#ifndef MSDOS_FS
         strcpy(name+len, save_file_suffix);
-#endif
         sprintf(tmp_name, "%s.tmp", name);
-#ifdef MSDOS_FS
-        strcpy(name+len, save_file_suffix);
-#endif
 
         free_mstring(sfile);
 
@@ -6871,12 +6866,7 @@ v_save_object (svalue_t *sp, int numarg)
         i = 0; /* Result from efun */
 
         unlink(name);
-#if !defined(MSDOS_FS)
         if (link(tmp_name, name) == -1)
-#else
-        close(f);
-        if (rename(tmp_name,name) < 0)
-#endif
         {
             perror(name);
             printf("%s Failed to link %s to %s\n"
@@ -6884,10 +6874,8 @@ v_save_object (svalue_t *sp, int numarg)
             add_message("Failed to save object !\n");
             i = 1;
         }
-#if !defined(MSDOS_FS)
         close(f);
         unlink(tmp_name);
-#endif
 
         /* free the error handler and the arguments (numarg + 1  from sp) and
          * push result on the stack.
@@ -8279,10 +8267,8 @@ restore_svalue (svalue_t *svp, char **pt, char delimiter)
                 return MY_FALSE;
             }
 
-#ifndef MSDOS_FS
             if (c == '\r')
                 c = '\n';
-#endif
 
             if (c == '\\')
             {
@@ -8515,13 +8501,8 @@ old_restore_string (svalue_t *v, char *str)
     if ( '\0' != (c = *cp++) )
     {
         do {
-#ifndef MSDOS_FS
             if (c == '\r')
                 cp[-1] = '\n';
-#else
-            if (c == CTRLZ)
-                cp[-1] = '\n';
-#endif
         } while ( '\0' != (c = *cp++) );
 
         if (cp[-2] == '\n' && cp[-3] == '\"')
diff --git a/src/port.h b/src/port.h
index c8f8510..240c6f6 100644
--- a/src/port.h
+++ b/src/port.h
@@ -124,8 +124,6 @@ extern int errno;
  *                to HAS_IPV6 from autoconf.
  *   USE_MYSQL    check the definition from config.h in relation
  *                to HAS_MYSQL from autoconf.
- *   MSDOS_FS     if the filesystem uses MS-DOS semantics
- *                (i.e. backslashes as directory separators)
  */
 
 #ifndef CHAR_BIT
@@ -190,10 +188,6 @@ extern int errno;
 #    undef USE_MYSQL
 #endif
 
-#if defined(CYGWIN)
-#define MSDOS_FS
-#endif
-
 /*------------------------------------------------------------------
  * Test for C99-compatible data types
  * TODO: check if we can remove these checks once (if?) we require a C99
diff --git a/src/simulate.c b/src/simulate.c
index 246b51d..c003a66 100644
--- a/src/simulate.c
+++ b/src/simulate.c
@@ -1636,36 +1636,6 @@ legal_path (const char *path)
      || path[0] == '/')
         return MY_FALSE;
 
-#ifdef MSDOS_FS
-    {
-        const char *name;
-
-        if (strchr(path,'\\'))
-            return MY_FALSE; /* better safe than sorry ... */
-        if (strchr(path,':'))
-            return MY_FALSE; /* \B: is okay for DOS .. *sigh* */
-        name = strrchr(path,'/');
-        if (NULL != name)
-            name++;
-        else
-            name = path;
-        if (!strcasecmp(name,"NUL")
-         || !strcasecmp(name,"CON")
-         || !strcasecmp(name,"PRN")
-         || !strcasecmp(name,"AUX")
-         || !strcasecmp(name,"COM1")
-         || !strcasecmp(name,"COM2")
-         || !strcasecmp(name,"COM3")
-         || !strcasecmp(name,"COM4")
-         || !strcasecmp(name,"LPT1")
-         || !strcasecmp(name,"LPT2")
-         || !strcasecmp(name,"LPT3")
-         || !strcasecmp(name,"LPT4")
-           )
-            return MY_FALSE;
-    }
-#endif
-
     return check_no_parentdirs(path);
 } /* legal_path() */
 
diff --git a/src/util/indent/args.c b/src/util/indent/args.c
index 1cac294..736b899 100644
--- a/src/util/indent/args.c
+++ b/src/util/indent/args.c
@@ -245,11 +245,8 @@ set_profile()
 {
     register FILE *f;
     char *fname;
-#ifndef MSDOS
     static char prof[] = ".indent.pro";
-#else
-    static char prof[] = "indent.pro";
-#endif
+
     char *homedir;
 
     homedir = getenv("HOME");
diff --git a/src/util/indent/indent.c b/src/util/indent/indent.c
index 784dc82..77c21a4 100644
--- a/src/util/indent/indent.c
+++ b/src/util/indent/indent.c
@@ -1335,21 +1335,8 @@ bakcopy()
     if (*p == '/')
 	p++;
     bakfile = xmalloc(40 + strlen(p));
-#ifndef MSDOS
     sprintf(bakfile, "%s.BAK", p);
-#else
-    {
-	char *here;
 
-	if ((here = strchr(p,'.')) == NULL || here <= p)
-	    sprintf(bakfile,"%s.BAK",p);
-	else {
-	    *here = 0;
-	    sprintf(bakfile,"%s.BAK",p);
-	    *here = '.';
-	}
-    }
-#endif
     errbuf = xmalloc(80 + strlen(p));
 
     sprintf(errbuf,"indent: %s",bakfile);
-- 
1.6.1

