2000-07-01 11:51:55 +08:00
|
|
|
/* libcmain.c
|
2000-02-18 03:38:31 +08:00
|
|
|
|
2000-07-01 11:51:55 +08:00
|
|
|
Copyright 1996, 1997, 1998, 2000 Cygnus Solutions.
|
2000-02-18 03:38:31 +08:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
/* Allow apps which don't have a main work, as long as they define WinMain */
|
2000-07-01 11:51:55 +08:00
|
|
|
int
|
|
|
|
main ()
|
2000-02-18 03:38:31 +08:00
|
|
|
{
|
|
|
|
HMODULE x = GetModuleHandleA(0);
|
|
|
|
char *s = GetCommandLineA ();
|
|
|
|
STARTUPINFO si;
|
|
|
|
|
|
|
|
/* GetCommandLineA returns the entire command line including the
|
|
|
|
program name, but WinMain is defined to accept the command
|
|
|
|
line without the program name. */
|
|
|
|
while (*s != ' ' && *s != '\0')
|
|
|
|
++s;
|
|
|
|
while (*s == ' ')
|
|
|
|
++s;
|
|
|
|
|
|
|
|
GetStartupInfo (&si);
|
|
|
|
|
2000-07-01 11:51:55 +08:00
|
|
|
return WinMain (x, 0, s,
|
|
|
|
((si.dwFlags & STARTF_USESHOWWINDOW) != 0
|
|
|
|
? si.wShowWindow
|
|
|
|
: SW_SHOWNORMAL));
|
2000-02-18 03:38:31 +08:00
|
|
|
}
|