forked from alexd/metapad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
w32crt.h
executable file
·110 lines (95 loc) · 1.98 KB
/
w32crt.h
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
void __cdecl WinMainCRTStartup(void)
{
int mainret;
LPSTR lpszCommandLine;
STARTUPINFO StartupInfo;
lpszCommandLine = (LPSTR)GetCommandLine();
if (*lpszCommandLine == '"') {
lpszCommandLine++;
while(*lpszCommandLine && (*lpszCommandLine != '"'))
lpszCommandLine++;
if (*lpszCommandLine == '"')
lpszCommandLine++;
}
else {
while (*lpszCommandLine > ' ')
lpszCommandLine++;
}
while ( *lpszCommandLine && (*lpszCommandLine <= ' ') )
lpszCommandLine++;
StartupInfo.dwFlags = 0;
GetStartupInfo(&StartupInfo);
mainret = WinMain( GetModuleHandle(NULL),
NULL,
lpszCommandLine,
StartupInfo.dwFlags & STARTF_USESHOWWINDOW
? StartupInfo.wShowWindow : SW_SHOWDEFAULT );
ExitProcess(mainret);
}
/*
int __cdecl _isctype(int c , int mask)
{
if (((unsigned)(c + 1)) <= 256)
return (_pctype[c] & mask);
else
return 0;
}
*/
/*
long __cdecl atol(const char* pstr)
{
int cCurr;
long lTotal;
int iIsNeg;
while (isspace (*pstr))
++pstr;
cCurr = *pstr++;
iIsNeg = cCurr;
if (('-' == cCurr) || ('+' == cCurr))
cCurr = *pstr++;
lTotal = 0;
while (isdigit(cCurr)) {
lTotal = 10 * lTotal + (cCurr - '0');
cCurr = *pstr++;
}
if ('-' == iIsNeg)
return (-lTotal);
else
return (lTotal);
}
int __cdecl atoi(const char * pstr)
{
return ((int)atol (pstr));
}
*/
/*
int __cdecl tolower(int c)
{
if (c - 'A' + 'a' < 0)
return c;
else
return c - 'A' + 'a';
}
*/
char* __cdecl strchr(const char* str, int ch)
{
while (*str != '\0') {
if (*str == ch)
return (char*)str;
str++;
}
return NULL;
}
char* __cdecl strrchr(const char* str, int ch)
{
char* strb = (char*)str;
while (*str != '\0') {
str++;
}
while (str != strb) {
if (*str == ch)
return (char*)str;
str--;
}
return NULL;
}