From bdad094cb53b6d8aa967b6a06c97d9bdef237f3c Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sun, 10 Aug 2003 22:46:40 +0000
Subject: [PATCH] Added required string wrappers - strlwr() and strupr()

---
 src/odoors/GNUmakefile |  1 +
 src/odoors/ODAuto.c    |  1 +
 src/odoors/ODCFile.c   |  1 +
 src/odoors/ODCmdLn.c   |  4 +---
 src/odoors/ODCore.c    |  1 +
 src/odoors/ODEmu.c     |  1 +
 src/odoors/ODInEx1.c   |  4 +---
 src/odoors/ODInEx2.c   |  1 +
 src/odoors/ODMulti.c   |  1 +
 src/odoors/ODPCB.c     |  1 +
 src/odoors/ODSpawn.c   |  2 ++
 src/odoors/ODStr.c     | 54 ++++++++++++++++++++++++++++++++++++++++++
 src/odoors/ODStr.h     | 40 +++++++++++++++++++++++++++++++
 src/odoors/ODUtil.c    |  4 +---
 14 files changed, 107 insertions(+), 9 deletions(-)
 create mode 100644 src/odoors/ODStr.c
 create mode 100644 src/odoors/ODStr.h

diff --git a/src/odoors/GNUmakefile b/src/odoors/GNUmakefile
index ceab60f2b7..997a4bf370 100644
--- a/src/odoors/GNUmakefile
+++ b/src/odoors/GNUmakefile
@@ -138,6 +138,7 @@ OBJECTS := ${OBJDIR}ODAuto${OBJFILE}\
          ${OBJDIR}ODSpawn${OBJFILE}\
          ${OBJDIR}ODStand${OBJFILE}\
          ${OBJDIR}ODStat${OBJFILE}\
+         ${OBJDIR}ODStr${OBJFILE}\
          ${OBJDIR}ODUtil${OBJFILE}\
          ${OBJDIR}ODWCat${OBJFILE}\
 	 ${OBJDIR}ODWin${OBJFILE}
diff --git a/src/odoors/ODAuto.c b/src/odoors/ODAuto.c
index a674a66906..e41f3e74af 100644
--- a/src/odoors/ODAuto.c
+++ b/src/odoors/ODAuto.c
@@ -42,6 +42,7 @@
 #include <ctype.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODTypes.h"
 #include "ODGen.h"
 #include "ODPlat.h"
diff --git a/src/odoors/ODCFile.c b/src/odoors/ODCFile.c
index ad14f3cb11..eb3a4a3a43 100644
--- a/src/odoors/ODCFile.c
+++ b/src/odoors/ODCFile.c
@@ -45,6 +45,7 @@
 #include <time.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODCore.h"
 #include "ODGen.h"
 #include "ODInEx.h"
diff --git a/src/odoors/ODCmdLn.c b/src/odoors/ODCmdLn.c
index 76b3862e3a..5d0da98ce1 100644
--- a/src/odoors/ODCmdLn.c
+++ b/src/odoors/ODCmdLn.c
@@ -52,9 +52,7 @@
 #include <ctype.h>
 
 #include "OpenDoor.h"
-#ifdef ODPLAT_NIX
-#define stricmp 	strcasecmp
-#endif
+#include "ODStr.h"
 #include "ODPlat.h"
 #include "ODCore.h"
 #include "ODInEx.h"
diff --git a/src/odoors/ODCore.c b/src/odoors/ODCore.c
index 39e61eaa21..1d4df8520b 100644
--- a/src/odoors/ODCore.c
+++ b/src/odoors/ODCore.c
@@ -80,6 +80,7 @@
 #include <errno.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODGen.h"
 #include "ODPlat.h"
 #include "ODCom.h"
diff --git a/src/odoors/ODEmu.c b/src/odoors/ODEmu.c
index b45abb0dc0..b9eda1b15d 100644
--- a/src/odoors/ODEmu.c
+++ b/src/odoors/ODEmu.c
@@ -56,6 +56,7 @@
 #include <stdarg.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODCore.h"
 #include "ODGen.h"
 #include "ODCom.h"
diff --git a/src/odoors/ODInEx1.c b/src/odoors/ODInEx1.c
index a8d7abe219..4d978f98b3 100644
--- a/src/odoors/ODInEx1.c
+++ b/src/odoors/ODInEx1.c
@@ -87,9 +87,7 @@
 #include <time.h>
 
 #include "OpenDoor.h"
-#ifdef ODPLAT_NIX
-#define strnicmp	strncasecmp
-#endif
+#include "ODStr.h"
 #include "ODCore.h"
 #include "ODGen.h"
 #include "ODScrn.h"
diff --git a/src/odoors/ODInEx2.c b/src/odoors/ODInEx2.c
index 2a1ac137e1..82000bc2e4 100644
--- a/src/odoors/ODInEx2.c
+++ b/src/odoors/ODInEx2.c
@@ -73,6 +73,7 @@
 #include <time.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODCore.h"
 #include "ODGen.h"
 #include "ODCom.h"
diff --git a/src/odoors/ODMulti.c b/src/odoors/ODMulti.c
index f2b244fdb3..a81c4822f4 100644
--- a/src/odoors/ODMulti.c
+++ b/src/odoors/ODMulti.c
@@ -48,6 +48,7 @@
 #include <stdio.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODCore.h"
 #include "ODGen.h"
 #include "ODScrn.h"
diff --git a/src/odoors/ODPCB.c b/src/odoors/ODPCB.c
index 85cc550eb9..f5b5095597 100644
--- a/src/odoors/ODPCB.c
+++ b/src/odoors/ODPCB.c
@@ -43,6 +43,7 @@
 #include <time.h>
 
 #include "OpenDoor.h"
+#include "ODStr.h"
 #include "ODCore.h"
 #include "ODGen.h"
 #include "ODScrn.h"
diff --git a/src/odoors/ODSpawn.c b/src/odoors/ODSpawn.c
index f29049a10f..db6881d078 100644
--- a/src/odoors/ODSpawn.c
+++ b/src/odoors/ODSpawn.c
@@ -58,6 +58,8 @@
 #include "OpenDoor.h"
 #ifdef ODPLAT_NIX
 #include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 #endif
 #include "ODCore.h"
 #include "ODGen.h"
diff --git a/src/odoors/ODStr.c b/src/odoors/ODStr.c
new file mode 100644
index 0000000000..15883f91c6
--- /dev/null
+++ b/src/odoors/ODStr.c
@@ -0,0 +1,54 @@
+/* OpenDoors Online Software Programming Toolkit
+ * (C) Copyright 1991 - 1999 by Brian Pirie.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ *        File: ODStr.c
+ *
+ * Description: Functions used to mainuplate strings
+ *
+ *   Revisions: Date          Ver   Who  Change
+ *              ---------------------------------------------------------------
+ *              Aug 10, 2003  6.23  SH   *nix support
+ */
+
+#include "OpenDoor.h"
+
+#ifdef ODPLAT_NIX
+#include <string.h>
+
+int
+strlwr(char *str)
+{
+  size_t i;
+  for(i=0;i<strlen(str);i++)
+  {
+    if(str[i]>64 && str[i]<=91) str[i]=str[i]|32;
+  }
+  return 0;
+}
+
+int
+strupr(char *str)
+{
+  size_t i;
+  for(i=0;i<strlen(str);i++)
+  {
+    if(str[i]>96 && str[i]<123) str[i] &= 223;
+  }
+  return 0;
+}
+#endif
diff --git a/src/odoors/ODStr.h b/src/odoors/ODStr.h
new file mode 100644
index 0000000000..fe96011f8c
--- /dev/null
+++ b/src/odoors/ODStr.h
@@ -0,0 +1,40 @@
+/* OpenDoors Online Software Programming Toolkit
+ * (C) Copyright 1991 - 1999 by Brian Pirie.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ *        File: ODStr.h
+ *
+ * Description: Functions used to maipulate strings
+ *
+ *   Revisions: Date          Ver   Who  Change
+ *              ---------------------------------------------------------------
+ *              Aug 10, 2003  6.23  SH   Initial rev.
+ */
+
+#include "OpenDoor.h"
+
+#ifndef _INC_ODSTR
+#define _INC_ODSTR
+
+#ifdef ODPLAT_NIX
+#define strnicmp      strncasecmp
+#define stricmp       strcasecmp
+int strlwr(char *str);
+int strupr(char *str);
+#endif
+
+#endif
diff --git a/src/odoors/ODUtil.c b/src/odoors/ODUtil.c
index def257bae0..df6f635948 100644
--- a/src/odoors/ODUtil.c
+++ b/src/odoors/ODUtil.c
@@ -44,9 +44,7 @@
 #include <stdio.h>
 
 #include "OpenDoor.h"
-#ifdef ODPLAT_NIX
-#define stricmp 	strcasecmp
-#endif
+#include "ODStr.h"
 #include "ODUtil.h"
 #include "ODGen.h"
 
-- 
GitLab