blob: 3a2d74a8c780554c91dd7fbcd16133a302aba709 (
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
|
#include "types.h"
#include "internat.h"
#include <dos.h>
/* #define KANJI TRUE */
char haveinttab = 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;
{
if((c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFC))
return(TRUE);
else
return(FALSE);
}
#endif
|