2000-07-01 11:51:55 +08:00
|
|
|
/* libcmain.c
|
2000-02-18 03:38:31 +08:00
|
|
|
|
2001-09-12 04:01:02 +08:00
|
|
|
Copyright 1996, 1997, 1998, 2000, 2001 Red Hat, Inc.
|
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>
|
2004-12-10 05:28:32 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define SP " \t\n"
|
2000-02-18 03:38:31 +08:00
|
|
|
|
|
|
|
/* 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
|
|
|
{
|
2004-12-10 05:28:32 +08:00
|
|
|
HMODULE x = GetModuleHandle (0);
|
|
|
|
char *s = GetCommandLine ();
|
2000-02-18 03:38:31 +08:00
|
|
|
STARTUPINFO si;
|
2004-12-10 05:28:32 +08:00
|
|
|
char *nexts;
|
|
|
|
|
|
|
|
s += strspn (s, SP);
|
|
|
|
|
|
|
|
if (*s != '"')
|
|
|
|
nexts = strpbrk (s, SP);
|
|
|
|
else
|
|
|
|
while ((nexts = strchr (s + 1, '"')) != NULL && nexts[-1] == '\\')
|
|
|
|
s = nexts;
|
2000-02-18 03:38:31 +08:00
|
|
|
|
2004-12-10 05:28:32 +08:00
|
|
|
if (!nexts)
|
|
|
|
nexts = strchr (s, '\0');
|
|
|
|
else
|
|
|
|
nexts += strspn (nexts + 1, SP);
|
2000-02-18 03:38:31 +08:00
|
|
|
|
|
|
|
GetStartupInfo (&si);
|
|
|
|
|
2004-12-10 05:28:32 +08:00
|
|
|
return WinMain (x, 0, nexts,
|
2000-07-01 11:51:55 +08:00
|
|
|
((si.dwFlags & STARTF_USESHOWWINDOW) != 0
|
|
|
|
? si.wShowWindow
|
|
|
|
: SW_SHOWNORMAL));
|
2000-02-18 03:38:31 +08:00
|
|
|
}
|