From e3a0176c61b12217a9ca4db24e02b375b7c64cc7 Mon Sep 17 00:00:00 2001
From: Chase <chinkle3@illinois.edu>
Date: Mon, 24 Nov 2025 21:55:57 -0500
Subject: [PATCH] dthelp/parser: use standard ctype case functions

---
 .../dthelp/parser/canon1/build/proto.h        |  2 -
 .../dthelp/parser/canon1/eltdef/proto.h       |  2 -
 .../dthelp/parser/canon1/helptag/fproto.h     |  4 --
 .../dthelp/parser/canon1/parser/proto.h       |  2 -
 .../dthelp/parser/canon1/util/Makefile.am     |  4 +-
 .../dthelp/parser/canon1/util/basic.h         |  1 +
 cde/programs/dthelp/parser/canon1/util/cont.h |  6 ---
 .../dthelp/parser/canon1/util/conutil.c       |  7 ++--
 .../dthelp/parser/canon1/util/lower.c         | 39 -------------------
 .../dthelp/parser/canon1/util/upper.c         | 36 -----------------
 .../dthelp/parser/canon1/util/upstrcmp.c      |  6 +--
 .../dthelp/parser/pass1/build/proto.h         |  2 -
 .../dthelp/parser/pass1/eltdef/proto.h        |  2 -
 .../dthelp/parser/pass1/helptag/fproto.h      |  4 --
 .../dthelp/parser/pass1/parser/proto.h        |  2 -
 .../dthelp/parser/pass1/util/Makefile.am      |  4 +-
 cde/programs/dthelp/parser/pass1/util/basic.h |  2 +-
 cde/programs/dthelp/parser/pass1/util/cont.h  |  6 ---
 .../dthelp/parser/pass1/util/conutil.c        |  7 ++--
 cde/programs/dthelp/parser/pass1/util/lower.c | 39 -------------------
 cde/programs/dthelp/parser/pass1/util/upper.c | 36 -----------------
 .../dthelp/parser/pass1/util/upstrcmp.c       |  6 +--
 .../dthelp/parser/pass2/eltdef/proto.h        |  2 -
 .../dthelp/parser/pass2/htag2/fproto.h        |  4 --
 .../dthelp/parser/pass2/parser/proto.h        |  2 -
 .../dthelp/parser/pass2/util/Makefile.am      |  4 +-
 cde/programs/dthelp/parser/pass2/util/basic.h |  2 +-
 cde/programs/dthelp/parser/pass2/util/cont.h  |  6 ---
 .../dthelp/parser/pass2/util/conutil.c        |  7 ++--
 cde/programs/dthelp/parser/pass2/util/lower.c | 39 -------------------
 cde/programs/dthelp/parser/pass2/util/upper.c | 38 ------------------
 .../dthelp/parser/pass2/util/upstrcmp.c       |  6 +--
 32 files changed, 27 insertions(+), 302 deletions(-)
 delete mode 100644 cde/programs/dthelp/parser/canon1/util/lower.c
 delete mode 100644 cde/programs/dthelp/parser/canon1/util/upper.c
 delete mode 100644 cde/programs/dthelp/parser/pass1/util/lower.c
 delete mode 100644 cde/programs/dthelp/parser/pass1/util/upper.c
 delete mode 100644 cde/programs/dthelp/parser/pass2/util/lower.c
 delete mode 100644 cde/programs/dthelp/parser/pass2/util/upper.c

diff --git a/cde/programs/dthelp/parser/canon1/build/proto.h b/cde/programs/dthelp/parser/canon1/build/proto.h
index 97dbdbfc1..08e2935c1 100644
--- a/cde/programs/dthelp/parser/canon1/build/proto.h
+++ b/cde/programs/dthelp/parser/canon1/build/proto.h
@@ -132,8 +132,6 @@ void initialize(void);
 
 LOGICAL litproc(int delim);
 
-int main(int argc, char **argv);
-
 void makeand(LOGICAL *canbenull, TREE *root, int optional);
 
 LOGICAL makefsa(TREE *root, int optional);
diff --git a/cde/programs/dthelp/parser/canon1/eltdef/proto.h b/cde/programs/dthelp/parser/canon1/eltdef/proto.h
index 3dba71fab..587efaff4 100644
--- a/cde/programs/dthelp/parser/canon1/eltdef/proto.h
+++ b/cde/programs/dthelp/parser/canon1/eltdef/proto.h
@@ -96,8 +96,6 @@ LOGICAL m_letter(M_WCHAR c);
 
 LOGICAL litproc(int delim);
 
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void m_openchk(FILE **ptr, char *name, char *mode);
diff --git a/cde/programs/dthelp/parser/canon1/helptag/fproto.h b/cde/programs/dthelp/parser/canon1/helptag/fproto.h
index c80be7bbf..cc85137bc 100644
--- a/cde/programs/dthelp/parser/canon1/helptag/fproto.h
+++ b/cde/programs/dthelp/parser/canon1/helptag/fproto.h
@@ -72,8 +72,6 @@ LOGICAL m_letter(M_WCHAR c);
 
 void loadxref(void);
 
-int m_lower(int c);
-
 void options(LOGICAL filelenonly);
 
 void outchar(M_WCHAR textchar, FILE *outfile );
@@ -180,8 +178,6 @@ int vtype(const M_WCHAR *keyword);
 
 void xrefexpand(M_WCHAR *id);
 
-int m_upper(int c);
-
 char *GetDefaultHeaderString(char          *elementName,
   unsigned char  desiredType,
   char          *defaultString);
diff --git a/cde/programs/dthelp/parser/canon1/parser/proto.h b/cde/programs/dthelp/parser/canon1/parser/proto.h
index 9f2900e2c..ff2aa8d93 100644
--- a/cde/programs/dthelp/parser/canon1/parser/proto.h
+++ b/cde/programs/dthelp/parser/canon1/parser/proto.h
@@ -172,8 +172,6 @@ void m_longent(int context);
 LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content, 
   unsigned char *wheredef);
 
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void m_missingtagc(int c, M_HOLDTYPE dchar, LOGICAL start);
diff --git a/cde/programs/dthelp/parser/canon1/util/Makefile.am b/cde/programs/dthelp/parser/canon1/util/Makefile.am
index 4826cd82e..43214e5ed 100644
--- a/cde/programs/dthelp/parser/canon1/util/Makefile.am
+++ b/cde/programs/dthelp/parser/canon1/util/Makefile.am
@@ -10,8 +10,8 @@ fclndir_SOURCES = context.c
 
 libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c		\
 	triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c	\
-	conutil.c error.c exit.c itoa.c lower.c malloc.c openchk.c	\
-	trie.c triecnt.c upper.c whitesp.c basic.h common.h		\
+	conutil.c error.c exit.c itoa.c malloc.c openchk.c	\
+	trie.c triecnt.c whitesp.c basic.h common.h		\
 	dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h	\
 	entext.h sref.h version.h
 
diff --git a/cde/programs/dthelp/parser/canon1/util/basic.h b/cde/programs/dthelp/parser/canon1/util/basic.h
index b8057c985..01041a0d2 100644
--- a/cde/programs/dthelp/parser/canon1/util/basic.h
+++ b/cde/programs/dthelp/parser/canon1/util/basic.h
@@ -27,6 +27,7 @@
 
 /* hpux protects stdio.h from multiple includes thru stdlib.h . */
 #include <stdio.h>
+#include <ctype.h>
 
 #define TRUE 1
 #define FALSE 0
diff --git a/cde/programs/dthelp/parser/canon1/util/cont.h b/cde/programs/dthelp/parser/canon1/util/cont.h
index 4b060ec4c..4e244061b 100644
--- a/cde/programs/dthelp/parser/canon1/util/cont.h
+++ b/cde/programs/dthelp/parser/canon1/util/cont.h
@@ -65,10 +65,6 @@ void incdelim(void);
 
 void loaddelim(void);
 
-int m_lower(int c);
-
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void nextcon(LOGICAL sparse);
@@ -85,8 +81,6 @@ void skiptoend(void);
 
 void unread(int c);
 
-int m_upper(int c);
-
 void warning(char *text);
 
 void warning1(char *text, char *arg);
diff --git a/cde/programs/dthelp/parser/canon1/util/conutil.c b/cde/programs/dthelp/parser/canon1/util/conutil.c
index f17f33549..4c6b266b1 100644
--- a/cde/programs/dthelp/parser/canon1/util/conutil.c
+++ b/cde/programs/dthelp/parser/canon1/util/conutil.c
@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 #include "basic.h"
 #include "trie.h"
 
@@ -483,7 +484,7 @@ while ((c = getc(ddat)) != EOF)
 		}
 	    break;
 	    }
-	*p++ = m_upper(c);
+	*p++ = toupper(c);
 	}
     *p = M_EOS;
     /* Skip intervening white space */
@@ -520,7 +521,7 @@ while ((c = getc(ddat)) != EOF)
     m_free(mb_dname,"multi-byte string");
 
     for (i = 0 ; dname[i] ; i++)
-	dname[i] = m_lower(dname[i]);
+	dname[i] = tolower(dname[i]);
     mb_dname = MakeMByteString(dname);
 
     mb_dstring = MakeMByteString(dstring);
@@ -639,7 +640,7 @@ int ret = mbtowc(&wnl, "\n", 1);
 (void) ret;
 
 c = mb_getwc(cdat); /* use mb_getwc so we read multi-byte chars */
-if (cap && c != EOF) c = m_upper(c);
+if (cap && c != EOF) c = toupper(c);
 
 if (c == wnl) m_line++;
 
diff --git a/cde/programs/dthelp/parser/canon1/util/lower.c b/cde/programs/dthelp/parser/canon1/util/lower.c
deleted file mode 100644
index 96091df0d..000000000
--- a/cde/programs/dthelp/parser/canon1/util/lower.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them 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.
- *
- * These libraries and programs are distributed in the hope that
- * they 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 these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
-/* $XConsortium: lower.c /main/3 1995/11/08 09:52:41 rswiston $ */
-/*
-                   Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
-*/
-
-#include "basic.h"
-
-int m_lower(int c);
-
-
-
-/* Force a letter to lowercase */
-int m_lower(int c)
-  {
-    if (c >= 'A' && c <= 'Z') c += 'a' - 'A' ;
-    return(c) ;
-    }
diff --git a/cde/programs/dthelp/parser/canon1/util/upper.c b/cde/programs/dthelp/parser/canon1/util/upper.c
deleted file mode 100644
index 0515984eb..000000000
--- a/cde/programs/dthelp/parser/canon1/util/upper.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them 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.
- *
- * These libraries and programs are distributed in the hope that
- * they 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 these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
-/* $XConsortium: upper.c /main/3 1995/11/08 09:57:02 rswiston $ */
-/*
-                   Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
-*/
-
-/* Force a letter to uppercase */
-
-#include "basic.h"
-
-int m_upper(int c)
-  {
-    if (c >= 'a' && c <= 'z') c += 'A' - 'a' ;
-    return(c) ;
-    }
diff --git a/cde/programs/dthelp/parser/canon1/util/upstrcmp.c b/cde/programs/dthelp/parser/canon1/util/upstrcmp.c
index 3e8254a69..494244267 100644
--- a/cde/programs/dthelp/parser/canon1/util/upstrcmp.c
+++ b/cde/programs/dthelp/parser/canon1/util/upstrcmp.c
@@ -29,13 +29,11 @@
 
 #include "basic.h"
 
-int m_upper(int c);
-
 int m_upstrcmp(char *p, char *q)
   {
     do {
-      if (m_upper((int) *p) < m_upper((int) *q)) return(-1) ;
-      if (m_upper((int) *p) > m_upper((int) *q++)) return(1) ;
+      if (toupper((int) *p) < toupper((int) *q)) return(-1) ;
+      if (toupper((int) *p) > toupper((int) *q++)) return(1) ;
       } while (*p++) ;
     return(0) ;
     }
diff --git a/cde/programs/dthelp/parser/pass1/build/proto.h b/cde/programs/dthelp/parser/pass1/build/proto.h
index 07ebb0e6e..ecebed341 100644
--- a/cde/programs/dthelp/parser/pass1/build/proto.h
+++ b/cde/programs/dthelp/parser/pass1/build/proto.h
@@ -132,8 +132,6 @@ void initialize(void);
 
 LOGICAL litproc(int delim);
 
-int main(int argc, char **argv);
-
 void makeand(LOGICAL *canbenull, TREE *root, int optional);
 
 LOGICAL makefsa(TREE *root, int optional);
diff --git a/cde/programs/dthelp/parser/pass1/eltdef/proto.h b/cde/programs/dthelp/parser/pass1/eltdef/proto.h
index e2eb9b340..f9d4a1e3b 100644
--- a/cde/programs/dthelp/parser/pass1/eltdef/proto.h
+++ b/cde/programs/dthelp/parser/pass1/eltdef/proto.h
@@ -96,8 +96,6 @@ LOGICAL m_letter(M_WCHAR c);
 
 LOGICAL litproc(int delim);
 
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void m_openchk(FILE **ptr, char *name, char *mode);
diff --git a/cde/programs/dthelp/parser/pass1/helptag/fproto.h b/cde/programs/dthelp/parser/pass1/helptag/fproto.h
index b71946c01..02f75e9ee 100644
--- a/cde/programs/dthelp/parser/pass1/helptag/fproto.h
+++ b/cde/programs/dthelp/parser/pass1/helptag/fproto.h
@@ -71,8 +71,6 @@ LOGICAL m_letter(M_WCHAR c);
 
 void loadxref(void);
 
-int m_lower(int c);
-
 void options(LOGICAL filelenonly);
 
 void outchar(M_WCHAR textchar, FILE *outfile );
@@ -179,8 +177,6 @@ int vtype(const M_WCHAR *keyword);
 
 void xrefexpand(M_WCHAR *id);
 
-int m_upper(int c);
-
 char *GetDefaultHeaderString(char          *elementName,
   unsigned char  desiredType,
   char          *defaultString);
diff --git a/cde/programs/dthelp/parser/pass1/parser/proto.h b/cde/programs/dthelp/parser/pass1/parser/proto.h
index 3d6908859..918c5e8db 100644
--- a/cde/programs/dthelp/parser/pass1/parser/proto.h
+++ b/cde/programs/dthelp/parser/pass1/parser/proto.h
@@ -170,8 +170,6 @@ void m_longent(int context);
 LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content, 
   unsigned char *wheredef);
 
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void m_mberr1(const char *text, const char *arg);
diff --git a/cde/programs/dthelp/parser/pass1/util/Makefile.am b/cde/programs/dthelp/parser/pass1/util/Makefile.am
index 4826cd82e..43214e5ed 100644
--- a/cde/programs/dthelp/parser/pass1/util/Makefile.am
+++ b/cde/programs/dthelp/parser/pass1/util/Makefile.am
@@ -10,8 +10,8 @@ fclndir_SOURCES = context.c
 
 libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c		\
 	triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c	\
-	conutil.c error.c exit.c itoa.c lower.c malloc.c openchk.c	\
-	trie.c triecnt.c upper.c whitesp.c basic.h common.h		\
+	conutil.c error.c exit.c itoa.c malloc.c openchk.c	\
+	trie.c triecnt.c whitesp.c basic.h common.h		\
 	dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h	\
 	entext.h sref.h version.h
 
diff --git a/cde/programs/dthelp/parser/pass1/util/basic.h b/cde/programs/dthelp/parser/pass1/util/basic.h
index 04cb1f109..bcd0f5513 100644
--- a/cde/programs/dthelp/parser/pass1/util/basic.h
+++ b/cde/programs/dthelp/parser/pass1/util/basic.h
@@ -27,7 +27,7 @@
 
 /* hpux protects stdio.h from multiple includes thru stdlib.h . */
 #include <stdio.h>
-
+#include <ctype.h>
 #define TRUE 1
 #define FALSE 0
 typedef unsigned char LOGICAL;
diff --git a/cde/programs/dthelp/parser/pass1/util/cont.h b/cde/programs/dthelp/parser/pass1/util/cont.h
index 0c5e0137e..c4a6154ed 100644
--- a/cde/programs/dthelp/parser/pass1/util/cont.h
+++ b/cde/programs/dthelp/parser/pass1/util/cont.h
@@ -65,10 +65,6 @@ void incdelim(void);
 
 void loaddelim(void);
 
-int m_lower(int c);
-
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void nextcon(LOGICAL sparse);
@@ -85,8 +81,6 @@ void skiptoend(void);
 
 void unread(int c);
 
-int m_upper(int c);
-
 void warning(char *text);
 
 void warning1(char *text, char *arg);
diff --git a/cde/programs/dthelp/parser/pass1/util/conutil.c b/cde/programs/dthelp/parser/pass1/util/conutil.c
index 4fbdada5f..25bb44244 100644
--- a/cde/programs/dthelp/parser/pass1/util/conutil.c
+++ b/cde/programs/dthelp/parser/pass1/util/conutil.c
@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 #include "basic.h"
 #include "trie.h"
 
@@ -479,7 +480,7 @@ while ((c = getc(ddat)) != EOF)
 		}
 	    break;
 	    }
-	*p++ = m_upper(c);
+	*p++ = toupper(c);
 	}
     *p = M_EOS;
     /* Skip intervening white space */
@@ -516,7 +517,7 @@ while ((c = getc(ddat)) != EOF)
     m_free(mb_dname,"multi-byte string");
 
     for (i = 0 ; dname[i] ; i++)
-	dname[i] = m_lower(dname[i]);
+	dname[i] = tolower(dname[i]);
     mb_dname = MakeMByteString(dname);
 
     mb_dstring = MakeMByteString(dstring);
@@ -635,7 +636,7 @@ int ret = mbtowc(&wnl, "\n", 1);
 (void) ret;
 
 c = mb_getwc(cdat); /* use mb_getwc so we read multi-byte chars */
-if (cap && c != EOF) c = m_upper(c);
+if (cap && c != EOF) c = toupper(c);
 
 if (c == wnl) m_line++;
 
diff --git a/cde/programs/dthelp/parser/pass1/util/lower.c b/cde/programs/dthelp/parser/pass1/util/lower.c
deleted file mode 100644
index af4fedf2f..000000000
--- a/cde/programs/dthelp/parser/pass1/util/lower.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them 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.
- *
- * These libraries and programs are distributed in the hope that
- * they 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 these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
-/* $XConsortium: lower.c /main/3 1995/11/08 10:33:54 rswiston $ */
-/*
-                   Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
-*/
-
-#include "basic.h"
-
-int m_lower(int c);
-
-
-
-/* Force a letter to lowercase */
-int m_lower(int c)
-  {
-    if (c >= 'A' && c <= 'Z') c += 'a' - 'A' ;
-    return(c) ;
-    }
diff --git a/cde/programs/dthelp/parser/pass1/util/upper.c b/cde/programs/dthelp/parser/pass1/util/upper.c
deleted file mode 100644
index 160e932c9..000000000
--- a/cde/programs/dthelp/parser/pass1/util/upper.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them 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.
- *
- * These libraries and programs are distributed in the hope that
- * they 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 these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
-/* $XConsortium: upper.c /main/3 1995/11/08 10:39:26 rswiston $ */
-/*
-                   Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
-*/
-
-/* Force a letter to uppercase */
-
-#include "basic.h"
-
-int m_upper(int c)
-  {
-    if (c >= 'a' && c <= 'z') c += 'A' - 'a' ;
-    return(c) ;
-    }
diff --git a/cde/programs/dthelp/parser/pass1/util/upstrcmp.c b/cde/programs/dthelp/parser/pass1/util/upstrcmp.c
index 753d52f65..602fa5cb3 100644
--- a/cde/programs/dthelp/parser/pass1/util/upstrcmp.c
+++ b/cde/programs/dthelp/parser/pass1/util/upstrcmp.c
@@ -29,13 +29,11 @@
 
 #include "basic.h"
 
-int m_upper(int c);
-
 int m_upstrcmp(char *p, char *q)
   {
     do {
-      if (m_upper((int) *p) < m_upper((int) *q)) return(-1) ;
-      if (m_upper((int) *p) > m_upper((int) *q++)) return(1) ;
+      if (toupper((int) *p) < toupper((int) *q)) return(-1) ;
+      if (toupper((int) *p) > toupper((int) *q++)) return(1) ;
       } while (*p++) ;
     return(0) ;
     }
diff --git a/cde/programs/dthelp/parser/pass2/eltdef/proto.h b/cde/programs/dthelp/parser/pass2/eltdef/proto.h
index 2540a85dd..a9c67ec57 100644
--- a/cde/programs/dthelp/parser/pass2/eltdef/proto.h
+++ b/cde/programs/dthelp/parser/pass2/eltdef/proto.h
@@ -96,8 +96,6 @@ LOGICAL m_letter(M_WCHAR c);
 
 LOGICAL litproc(int delim);
 
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void m_openchk(FILE **ptr, char *name, char *mode);
diff --git a/cde/programs/dthelp/parser/pass2/htag2/fproto.h b/cde/programs/dthelp/parser/pass2/htag2/fproto.h
index 63994de82..0cb94e32f 100644
--- a/cde/programs/dthelp/parser/pass2/htag2/fproto.h
+++ b/cde/programs/dthelp/parser/pass2/htag2/fproto.h
@@ -25,8 +25,6 @@
 /* Function prototypes for HP Tag/TeX translator */
 
 
-int m_lower(int c);
-
 void options(LOGICAL filelenonly);
 
 void setopt(char *string, LOGICAL filelenonly);
@@ -35,8 +33,6 @@ LOGICAL setvalopt(int thisopt, char *string, LOGICAL filelenonly);
 
 char *strstr(const char *s1, const char *s2);
 
-int m_upper(int c);
-
 char *MakeMByteString(const M_WCHAR *from);
 
 M_WCHAR *MakeWideCharString(const char *from);
diff --git a/cde/programs/dthelp/parser/pass2/parser/proto.h b/cde/programs/dthelp/parser/pass2/parser/proto.h
index 3755b762b..904689ee8 100644
--- a/cde/programs/dthelp/parser/pass2/parser/proto.h
+++ b/cde/programs/dthelp/parser/pass2/parser/proto.h
@@ -168,8 +168,6 @@ void m_longent(int context);
 LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content, 
   unsigned char *wheredef);
 
-void main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void m_mberr1(const char *text, const char *arg);
diff --git a/cde/programs/dthelp/parser/pass2/util/Makefile.am b/cde/programs/dthelp/parser/pass2/util/Makefile.am
index 72821d95f..841b6bd96 100644
--- a/cde/programs/dthelp/parser/pass2/util/Makefile.am
+++ b/cde/programs/dthelp/parser/pass2/util/Makefile.am
@@ -12,8 +12,8 @@ fclndir_SOURCES = context.c
 
 libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c		\
 	triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c	\
-	conutil.c error.c exit.c itoa.c lower.c malloc.c openchk.c	\
-	trie.c triecnt.c upper.c whitesp.c basic.h common.h		\
+	conutil.c error.c exit.c itoa.c malloc.c openchk.c	\
+	trie.c triecnt.c whitesp.c basic.h common.h		\
 	dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h	\
 	entext.h sref.h version.h
 
diff --git a/cde/programs/dthelp/parser/pass2/util/basic.h b/cde/programs/dthelp/parser/pass2/util/basic.h
index 617d9d11c..fc8a1f786 100644
--- a/cde/programs/dthelp/parser/pass2/util/basic.h
+++ b/cde/programs/dthelp/parser/pass2/util/basic.h
@@ -27,7 +27,7 @@
 
 /* hpux protects stdio.h from multiple includes thru stdlib.h . */
 #include <stdio.h>
-
+#include <ctype.h>
 #define TRUE 1
 #define FALSE 0
 typedef unsigned char LOGICAL;
diff --git a/cde/programs/dthelp/parser/pass2/util/cont.h b/cde/programs/dthelp/parser/pass2/util/cont.h
index c93ae0075..ff16d854f 100644
--- a/cde/programs/dthelp/parser/pass2/util/cont.h
+++ b/cde/programs/dthelp/parser/pass2/util/cont.h
@@ -65,10 +65,6 @@ void incdelim(void);
 
 void loaddelim(void);
 
-int m_lower(int c);
-
-int main(int argc, char **argv);
-
 void *m_malloc(int size, char *msg);
 
 void nextcon(LOGICAL sparse);
@@ -85,8 +81,6 @@ void skiptoend(void);
 
 void unread(int c);
 
-int m_upper(int c);
-
 void warning(char *text);
 
 void warning1(char *text, char *arg);
diff --git a/cde/programs/dthelp/parser/pass2/util/conutil.c b/cde/programs/dthelp/parser/pass2/util/conutil.c
index 6aa93c561..ed7ba2111 100644
--- a/cde/programs/dthelp/parser/pass2/util/conutil.c
+++ b/cde/programs/dthelp/parser/pass2/util/conutil.c
@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 #include "basic.h"
 #include "trie.h"
 
@@ -482,7 +483,7 @@ while ((c = getc(ddat)) != EOF)
 		}
 	    break;
 	    }
-	*p++ = m_upper(c);
+	*p++ = toupper(c);
 	}
     *p = M_EOS;
     /* Skip intervening white space */
@@ -519,7 +520,7 @@ while ((c = getc(ddat)) != EOF)
     m_free(mb_dname,"multi-byte string");
 
     for (i = 0 ; dname[i] ; i++)
-	dname[i] = m_lower(dname[i]);
+	dname[i] = tolower(dname[i]);
     mb_dname = MakeMByteString(dname);
 
     mb_dstring = MakeMByteString(dstring);
@@ -638,7 +639,7 @@ int ret = mbtowc(&wnl, "\n", 1);
 (void) ret;
 
 c = mb_getwc(cdat); /* use mb_getwc so we read multi-byte chars */
-if (cap && c != EOF) c = m_upper(c);
+if (cap && c != EOF) c = toupper(c);
 
 if (c == wnl) m_line++;
 
diff --git a/cde/programs/dthelp/parser/pass2/util/lower.c b/cde/programs/dthelp/parser/pass2/util/lower.c
deleted file mode 100644
index 52cac2bc8..000000000
--- a/cde/programs/dthelp/parser/pass2/util/lower.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them 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.
- *
- * These libraries and programs are distributed in the hope that
- * they 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 these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
-/* $XConsortium: lower.c /main/3 1995/11/08 11:06:37 rswiston $ */
-/*
-                   Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
-*/
-
-#include "basic.h"
-
-int m_lower(int c);
-
-
-
-/* Force a letter to lowercase */
-int m_lower(int c)
-  {
-    if (c >= 'A' && c <= 'Z') c += 'a' - 'A' ;
-    return(c) ;
-    }
diff --git a/cde/programs/dthelp/parser/pass2/util/upper.c b/cde/programs/dthelp/parser/pass2/util/upper.c
deleted file mode 100644
index 8cb9181dd..000000000
--- a/cde/programs/dthelp/parser/pass2/util/upper.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them 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.
- *
- * These libraries and programs are distributed in the hope that
- * they 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 these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
-/* $XConsortium: upper.c /main/3 1995/11/08 11:09:21 rswiston $ */
-/*
-                   Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
-*/
-
-/* Force a letter to uppercase */
-
-#include "basic.h"
-
-int m_upper(int c);
-
-int m_upper(int c)
-  {
-    if (c >= 'a' && c <= 'z') c += 'A' - 'a' ;
-    return(c) ;
-    }
diff --git a/cde/programs/dthelp/parser/pass2/util/upstrcmp.c b/cde/programs/dthelp/parser/pass2/util/upstrcmp.c
index a0a307fc3..79506550b 100644
--- a/cde/programs/dthelp/parser/pass2/util/upstrcmp.c
+++ b/cde/programs/dthelp/parser/pass2/util/upstrcmp.c
@@ -29,15 +29,13 @@
 
 #include "basic.h"
 
-int m_upper(int c);
-
 int m_upstrcmp(char *p, char *q);
 
 int m_upstrcmp(char *p, char *q)
   {
     do {
-      if (m_upper((int) *p) < m_upper((int) *q)) return(-1) ;
-      if (m_upper((int) *p) > m_upper((int) *q++)) return(1) ;
+      if (toupper((int) *p) < toupper((int) *q)) return(-1) ;
+      if (toupper((int) *p) > toupper((int) *q++)) return(1) ;
       } while (*p++) ;
     return(0) ;
     }
