NEURON
winmain.cpp
Go to the documentation of this file.
1
2
#include "windows.h"
3
#include <stdlib.h>
4
#include <
string.h
>
5
6
extern
int
main
(
int
argc
,
char
**
argv
);
7
8
/* one arg only. go to first space and then all the rest is the arg */
9
static
void
msgetarg
(
int
* pargc,
char
*** pargv) {
10
static
char
buf
[1024];
11
static
char
* av[20];
12
int
space, ac;
13
char
*
p
;
14
*pargv = av;
15
strcpy(buf, GetCommandLine());
16
#if 0
17
MessageBox(
NULL
, buf,
"msgetarg"
, MB_OK);
18
#endif
19
space = 0;
20
ac = 0;
21
av[ac++] =
buf
;
22
#if 0
23
for
(p = buf; *
p
; ++
p
) {
24
while
(*p && (*p ==
' '
|| *p ==
'\t'
)) {
25
*p++ =
'\0'
;
26
space = 1;
27
}
28
if
(space && *p) {
29
av[ac++] =
p
;
30
}
31
space = 0;
32
}
33
#else
34
for
(p = buf; *
p
; ++
p
) {
35
if
(*p ==
' '
|| *p ==
'\t'
) {
36
*p++ =
'\0'
;
37
av[ac++] =
p
;
38
break
;
39
}
40
}
41
#endif
42
*pargc = ac;
43
}
44
45
46
int
WINAPI
WinMain
(HINSTANCE hInstance, HINSTANCE hPrevInstance,
47
LPSTR lpCmdLine,
int
nCmdShow)
48
{
49
int
ret
;
50
int
argc
;
51
char
**
argv
;
52
msgetarg
(&argc, &argv);
53
ret =
main
(argc, argv);
54
return
ret
;
55
}
56
string.h
p
size_t p
Definition:
nrngsl_hc_radix2.cpp:60
msgetarg
static void msgetarg(int *pargc, char ***pargv)
Definition:
winmain.cpp:9
WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
Definition:
winmain.cpp:46
ret
#define ret
Definition:
redef.h:123
main
int main(int argc, char **argv)
Definition:
d2uenv.cpp:3
buf
char buf[512]
Definition:
init.cpp:13
argc
static int argc
Definition:
inithoc.cpp:53
NULL
return NULL
Definition:
cabcode.cpp:461
argv
static char ** argv
Definition:
inithoc.cpp:54
src
mswin
extra
winmain.cpp