dthelp/parser: use standard ctype case functions

This commit is contained in:
Chase
2025-11-24 21:55:57 -05:00
committed by Jon Trulson
parent 48aaa75f11
commit 9d9f3f9380
32 changed files with 27 additions and 302 deletions

View File

@@ -132,8 +132,6 @@ void initialize(void);
LOGICAL litproc(int delim); LOGICAL litproc(int delim);
int main(int argc, char **argv);
void makeand(LOGICAL *canbenull, TREE *root, int optional); void makeand(LOGICAL *canbenull, TREE *root, int optional);
LOGICAL makefsa(TREE *root, int optional); LOGICAL makefsa(TREE *root, int optional);

View File

@@ -96,8 +96,6 @@ LOGICAL m_letter(M_WCHAR c);
LOGICAL litproc(int delim); LOGICAL litproc(int delim);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void m_openchk(FILE **ptr, char *name, char *mode); void m_openchk(FILE **ptr, char *name, char *mode);

View File

@@ -72,8 +72,6 @@ LOGICAL m_letter(M_WCHAR c);
void loadxref(void); void loadxref(void);
int m_lower(int c);
void options(LOGICAL filelenonly); void options(LOGICAL filelenonly);
void outchar(M_WCHAR textchar, FILE *outfile ); void outchar(M_WCHAR textchar, FILE *outfile );
@@ -180,8 +178,6 @@ int vtype(const M_WCHAR *keyword);
void xrefexpand(M_WCHAR *id); void xrefexpand(M_WCHAR *id);
int m_upper(int c);
char *GetDefaultHeaderString(char *elementName, char *GetDefaultHeaderString(char *elementName,
unsigned char desiredType, unsigned char desiredType,
char *defaultString); char *defaultString);

View File

@@ -172,8 +172,6 @@ void m_longent(int context);
LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content, LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content,
unsigned char *wheredef); unsigned char *wheredef);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void m_missingtagc(int c, M_HOLDTYPE dchar, LOGICAL start); void m_missingtagc(int c, M_HOLDTYPE dchar, LOGICAL start);

View File

@@ -10,8 +10,8 @@ fclndir_SOURCES = context.c
libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \
triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.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 \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \
trie.c triecnt.c upper.c whitesp.c basic.h common.h \ trie.c triecnt.c whitesp.c basic.h common.h \
dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \ dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \
entext.h sref.h version.h entext.h sref.h version.h

View File

@@ -27,6 +27,7 @@
/* hpux protects stdio.h from multiple includes thru stdlib.h . */ /* hpux protects stdio.h from multiple includes thru stdlib.h . */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0

View File

@@ -65,10 +65,6 @@ void incdelim(void);
void loaddelim(void); void loaddelim(void);
int m_lower(int c);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void nextcon(LOGICAL sparse); void nextcon(LOGICAL sparse);
@@ -85,8 +81,6 @@ void skiptoend(void);
void unread(int c); void unread(int c);
int m_upper(int c);
void warning(char *text); void warning(char *text);
void warning1(char *text, char *arg); void warning1(char *text, char *arg);

View File

@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "basic.h" #include "basic.h"
#include "trie.h" #include "trie.h"
@@ -483,7 +484,7 @@ while ((c = getc(ddat)) != EOF)
} }
break; break;
} }
*p++ = m_upper(c); *p++ = toupper(c);
} }
*p = M_EOS; *p = M_EOS;
/* Skip intervening white space */ /* Skip intervening white space */
@@ -520,7 +521,7 @@ while ((c = getc(ddat)) != EOF)
m_free(mb_dname,"multi-byte string"); m_free(mb_dname,"multi-byte string");
for (i = 0 ; dname[i] ; i++) for (i = 0 ; dname[i] ; i++)
dname[i] = m_lower(dname[i]); dname[i] = tolower(dname[i]);
mb_dname = MakeMByteString(dname); mb_dname = MakeMByteString(dname);
mb_dstring = MakeMByteString(dstring); mb_dstring = MakeMByteString(dstring);
@@ -639,7 +640,7 @@ int ret = mbtowc(&wnl, "\n", 1);
(void) ret; (void) ret;
c = mb_getwc(cdat); /* use mb_getwc so we read multi-byte chars */ 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++; if (c == wnl) m_line++;

View File

@@ -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) ;
}

View File

@@ -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) ;
}

View File

@@ -29,13 +29,11 @@
#include "basic.h" #include "basic.h"
int m_upper(int c);
int m_upstrcmp(char *p, char *q) int m_upstrcmp(char *p, char *q)
{ {
do { do {
if (m_upper((int) *p) < m_upper((int) *q)) return(-1) ; if (toupper((int) *p) < toupper((int) *q)) return(-1) ;
if (m_upper((int) *p) > m_upper((int) *q++)) return(1) ; if (toupper((int) *p) > toupper((int) *q++)) return(1) ;
} while (*p++) ; } while (*p++) ;
return(0) ; return(0) ;
} }

View File

@@ -132,8 +132,6 @@ void initialize(void);
LOGICAL litproc(int delim); LOGICAL litproc(int delim);
int main(int argc, char **argv);
void makeand(LOGICAL *canbenull, TREE *root, int optional); void makeand(LOGICAL *canbenull, TREE *root, int optional);
LOGICAL makefsa(TREE *root, int optional); LOGICAL makefsa(TREE *root, int optional);

View File

@@ -96,8 +96,6 @@ LOGICAL m_letter(M_WCHAR c);
LOGICAL litproc(int delim); LOGICAL litproc(int delim);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void m_openchk(FILE **ptr, char *name, char *mode); void m_openchk(FILE **ptr, char *name, char *mode);

View File

@@ -71,8 +71,6 @@ LOGICAL m_letter(M_WCHAR c);
void loadxref(void); void loadxref(void);
int m_lower(int c);
void options(LOGICAL filelenonly); void options(LOGICAL filelenonly);
void outchar(M_WCHAR textchar, FILE *outfile ); void outchar(M_WCHAR textchar, FILE *outfile );
@@ -179,8 +177,6 @@ int vtype(const M_WCHAR *keyword);
void xrefexpand(M_WCHAR *id); void xrefexpand(M_WCHAR *id);
int m_upper(int c);
char *GetDefaultHeaderString(char *elementName, char *GetDefaultHeaderString(char *elementName,
unsigned char desiredType, unsigned char desiredType,
char *defaultString); char *defaultString);

View File

@@ -170,8 +170,6 @@ void m_longent(int context);
LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content, LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content,
unsigned char *wheredef); unsigned char *wheredef);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void m_mberr1(const char *text, const char *arg); void m_mberr1(const char *text, const char *arg);

View File

@@ -10,8 +10,8 @@ fclndir_SOURCES = context.c
libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \
triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.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 \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \
trie.c triecnt.c upper.c whitesp.c basic.h common.h \ trie.c triecnt.c whitesp.c basic.h common.h \
dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \ dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \
entext.h sref.h version.h entext.h sref.h version.h

View File

@@ -27,7 +27,7 @@
/* hpux protects stdio.h from multiple includes thru stdlib.h . */ /* hpux protects stdio.h from multiple includes thru stdlib.h . */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
typedef unsigned char LOGICAL; typedef unsigned char LOGICAL;

View File

@@ -65,10 +65,6 @@ void incdelim(void);
void loaddelim(void); void loaddelim(void);
int m_lower(int c);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void nextcon(LOGICAL sparse); void nextcon(LOGICAL sparse);
@@ -85,8 +81,6 @@ void skiptoend(void);
void unread(int c); void unread(int c);
int m_upper(int c);
void warning(char *text); void warning(char *text);
void warning1(char *text, char *arg); void warning1(char *text, char *arg);

View File

@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "basic.h" #include "basic.h"
#include "trie.h" #include "trie.h"
@@ -479,7 +480,7 @@ while ((c = getc(ddat)) != EOF)
} }
break; break;
} }
*p++ = m_upper(c); *p++ = toupper(c);
} }
*p = M_EOS; *p = M_EOS;
/* Skip intervening white space */ /* Skip intervening white space */
@@ -516,7 +517,7 @@ while ((c = getc(ddat)) != EOF)
m_free(mb_dname,"multi-byte string"); m_free(mb_dname,"multi-byte string");
for (i = 0 ; dname[i] ; i++) for (i = 0 ; dname[i] ; i++)
dname[i] = m_lower(dname[i]); dname[i] = tolower(dname[i]);
mb_dname = MakeMByteString(dname); mb_dname = MakeMByteString(dname);
mb_dstring = MakeMByteString(dstring); mb_dstring = MakeMByteString(dstring);
@@ -635,7 +636,7 @@ int ret = mbtowc(&wnl, "\n", 1);
(void) ret; (void) ret;
c = mb_getwc(cdat); /* use mb_getwc so we read multi-byte chars */ 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++; if (c == wnl) m_line++;

View File

@@ -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) ;
}

View File

@@ -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) ;
}

View File

@@ -29,13 +29,11 @@
#include "basic.h" #include "basic.h"
int m_upper(int c);
int m_upstrcmp(char *p, char *q) int m_upstrcmp(char *p, char *q)
{ {
do { do {
if (m_upper((int) *p) < m_upper((int) *q)) return(-1) ; if (toupper((int) *p) < toupper((int) *q)) return(-1) ;
if (m_upper((int) *p) > m_upper((int) *q++)) return(1) ; if (toupper((int) *p) > toupper((int) *q++)) return(1) ;
} while (*p++) ; } while (*p++) ;
return(0) ; return(0) ;
} }

View File

@@ -96,8 +96,6 @@ LOGICAL m_letter(M_WCHAR c);
LOGICAL litproc(int delim); LOGICAL litproc(int delim);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void m_openchk(FILE **ptr, char *name, char *mode); void m_openchk(FILE **ptr, char *name, char *mode);

View File

@@ -25,8 +25,6 @@
/* Function prototypes for HP Tag/TeX translator */ /* Function prototypes for HP Tag/TeX translator */
int m_lower(int c);
void options(LOGICAL filelenonly); void options(LOGICAL filelenonly);
void setopt(char *string, 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); char *strstr(const char *s1, const char *s2);
int m_upper(int c);
char *MakeMByteString(const M_WCHAR *from); char *MakeMByteString(const M_WCHAR *from);
M_WCHAR *MakeWideCharString(const char *from); M_WCHAR *MakeWideCharString(const char *from);

View File

@@ -168,8 +168,6 @@ void m_longent(int context);
LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content, LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content,
unsigned char *wheredef); unsigned char *wheredef);
void main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void m_mberr1(const char *text, const char *arg); void m_mberr1(const char *text, const char *arg);

View File

@@ -12,8 +12,8 @@ fclndir_SOURCES = context.c
libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \
triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.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 \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \
trie.c triecnt.c upper.c whitesp.c basic.h common.h \ trie.c triecnt.c whitesp.c basic.h common.h \
dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \ dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \
entext.h sref.h version.h entext.h sref.h version.h

View File

@@ -27,7 +27,7 @@
/* hpux protects stdio.h from multiple includes thru stdlib.h . */ /* hpux protects stdio.h from multiple includes thru stdlib.h . */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
typedef unsigned char LOGICAL; typedef unsigned char LOGICAL;

View File

@@ -65,10 +65,6 @@ void incdelim(void);
void loaddelim(void); void loaddelim(void);
int m_lower(int c);
int main(int argc, char **argv);
void *m_malloc(int size, char *msg); void *m_malloc(int size, char *msg);
void nextcon(LOGICAL sparse); void nextcon(LOGICAL sparse);
@@ -85,8 +81,6 @@ void skiptoend(void);
void unread(int c); void unread(int c);
int m_upper(int c);
void warning(char *text); void warning(char *text);
void warning1(char *text, char *arg); void warning1(char *text, char *arg);

View File

@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "basic.h" #include "basic.h"
#include "trie.h" #include "trie.h"
@@ -482,7 +483,7 @@ while ((c = getc(ddat)) != EOF)
} }
break; break;
} }
*p++ = m_upper(c); *p++ = toupper(c);
} }
*p = M_EOS; *p = M_EOS;
/* Skip intervening white space */ /* Skip intervening white space */
@@ -519,7 +520,7 @@ while ((c = getc(ddat)) != EOF)
m_free(mb_dname,"multi-byte string"); m_free(mb_dname,"multi-byte string");
for (i = 0 ; dname[i] ; i++) for (i = 0 ; dname[i] ; i++)
dname[i] = m_lower(dname[i]); dname[i] = tolower(dname[i]);
mb_dname = MakeMByteString(dname); mb_dname = MakeMByteString(dname);
mb_dstring = MakeMByteString(dstring); mb_dstring = MakeMByteString(dstring);
@@ -638,7 +639,7 @@ int ret = mbtowc(&wnl, "\n", 1);
(void) ret; (void) ret;
c = mb_getwc(cdat); /* use mb_getwc so we read multi-byte chars */ 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++; if (c == wnl) m_line++;

View File

@@ -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) ;
}

View File

@@ -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) ;
}

View File

@@ -29,15 +29,13 @@
#include "basic.h" #include "basic.h"
int m_upper(int c);
int m_upstrcmp(char *p, char *q); int m_upstrcmp(char *p, char *q);
int m_upstrcmp(char *p, char *q) int m_upstrcmp(char *p, char *q)
{ {
do { do {
if (m_upper((int) *p) < m_upper((int) *q)) return(-1) ; if (toupper((int) *p) < toupper((int) *q)) return(-1) ;
if (m_upper((int) *p) > m_upper((int) *q++)) return(1) ; if (toupper((int) *p) > toupper((int) *q++)) return(1) ;
} while (*p++) ; } while (*p++) ;
return(0) ; return(0) ;
} }