blob: b59f717270e36d4c6342712fadd257d3101abacc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#include "internat.h"
#include <dos.h>
#define NULL 0
#define TRUE 0xffff
#define FALSE 0
#define KANJI TRUE
char haveinttab = FALSE;
/*
* ECS Support - This module provides support for international >7FH and
* TWO-BYTE character sets. The toupper routine uses the DOS MAP_CASE call.
* In addition, STRING.C contains a default_tab containing a default lead
* byte table for two byte character sets. If single byte operation is
* desired, modify this table as follows: ="\000". If this utility
* is run on a DOS with Function 63H support, the default table will
* be replaced by the table in the DOS. The lbtbl_ptr is the far ptr to
* which ever table is in use.
*/
long lbtbl_ptr;
char *default_tab="\201\237\340\374\000\000";
char have_lbtbl = FALSE;
struct InterTbl Currtab;
int toupper(c)
int c;
{
union REGS regs ;
if(!haveinttab) {
regs.x.ax = 0x3800 ;
regs.x.dx = (unsigned) &Currtab ;
intdos (®s, ®s) ; /* INIT the table */
haveinttab = TRUE;
}
return(IToupper(c,Currtab.casecall));
}
char *strupr(string)
char *string;
{
register char *p1;
p1 = string;
while (*p1 != NULL) {
/*
* A note about the following " & 0xFF" stuff. This is
* to prevent the damn C compiler from converting bytes
* to words with the CBW instruction which is NOT correct
* for routines like toupper
*/
#ifdef KANJI
if(testkanj(*p1 & 0xFF))
p1 += 2 ;
else
*p1++ = toupper(*p1 & 0xFF);
#else
*p1++ = toupper(*p1 & 0xFF);
#endif
}
return(string);
}
char *strpbrk(string1,string2)
char *string1;
char *string2;
{
register char *p1;
while (*string1 != NULL) {
/*
* A note about the following " & 0xFF" stuff. This is
* to prevent the damn C compiler from converting bytes
* to words with the CBW instruction which is NOT correct
* for routines like toupper
*/
#ifdef KANJI
if(testkanj(*string1 & 0xFF))
string1 += 2 ;
else {
#endif
p1 = string2;
while (*p1 != NULL) {
if(*p1++ == *string1)
return(string1);
}
string1++;
#ifdef KANJI
}
#endif
}
return(NULL); /* no matches found */
}
#ifdef KANJI
testkanj(c)
unsigned char c;
{
long *p1;
union REGS regs ;
int i;
p1 = (long *)&lbtbl_ptr ;
if (!have_lbtbl ) {
(char far *)lbtbl_ptr = (char far *)default_tab ; /* Load offset in pointer */
get_lbtbl( p1 );
have_lbtbl=TRUE;
}
if ( test_ecs( c, lbtbl_ptr ))
return(TRUE);
else
return(FALSE);
}
#endif
|