-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathapiemu.c
72 lines (61 loc) · 1.51 KB
/
apiemu.c
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
/****************************************************************************
*
* This code is Public Domain.
*
* ========================================================================
*
* Description: API emulations:
* gcc: strupr()
* OW: CharUpperA()
*
****************************************************************************/
#if defined(__UNIX__)
/* v2.12: _splitpath()/_makepath() removed */
char *strupr( char *str )
/***********************/
{
char *p;
unsigned char c;
p = str;
while( (c = *p) ) {
c -= 'a';
if( c <= 'z' - 'a' ) {
c += 'A';
*p = c;
}
++p;
}
return( str );
}
#endif
/* emulations for Open Watcom */
#if defined(__WATCOMC__) && !defined(__UNIX__)
#ifdef __FLAT__
#ifndef DEBUG_OUT /* OW v1.8 WDW has a problem with locally defined imports */
union cu {
int c;
char *p;
};
/* this is an emulation of the Win32 function which is called
* by the OW runtime. It's the only USER32 function used.
* By defining it here the binary will just need KERNEL32 to load.
*/
char * _stdcall CharUpperA( char *lpsz )
/**************************************/
{
union cu p;
p.p = lpsz;
if ( p.c < 0x10000 )
if ( p.c >= 'a' )
return( (char *)p.c - 0x20 );
else
return( (char *)p.c );
else
for ( ; *p.p; p.p++ )
if ( *p.p >= 'a' )
*p.p = *p.p - 0x20;
return( lpsz );
}
#endif
#endif
#endif