]>
Commit | Line | Data |
---|---|---|
14a3bc2f | 1 | /* libcmain.c |
369d8a8f | 2 | |
bc837d22 | 3 | Copyright 1996, 1997, 1998, 2000, 2001, 2004, 2006, 2009 Red Hat, Inc. |
369d8a8f CF |
4 | |
5 | This file is part of Cygwin. | |
6 | ||
7 | This software is a copyrighted work licensed under the terms of the | |
8 | Cygwin license. Please consult the file "CYGWIN_LICENSE" for | |
9 | details. */ | |
10 | ||
11 | #include <windows.h> | |
fc2eba36 CF |
12 | |
13 | #define SP " \t\n" | |
369d8a8f | 14 | |
329a39eb | 15 | /* Allow apps which don't have a main to work, as long as they define WinMain */ |
14a3bc2f CF |
16 | int |
17 | main () | |
369d8a8f | 18 | { |
fc2eba36 CF |
19 | HMODULE x = GetModuleHandle (0); |
20 | char *s = GetCommandLine (); | |
369d8a8f | 21 | STARTUPINFO si; |
fc2eba36 CF |
22 | char *nexts; |
23 | ||
24 | s += strspn (s, SP); | |
25 | ||
26 | if (*s != '"') | |
27 | nexts = strpbrk (s, SP); | |
28 | else | |
29 | while ((nexts = strchr (s + 1, '"')) != NULL && nexts[-1] == '\\') | |
30 | s = nexts; | |
369d8a8f | 31 | |
fc2eba36 CF |
32 | if (!nexts) |
33 | nexts = strchr (s, '\0'); | |
34 | else | |
35 | nexts += strspn (nexts + 1, SP); | |
369d8a8f CF |
36 | |
37 | GetStartupInfo (&si); | |
38 | ||
fc2eba36 | 39 | return WinMain (x, 0, nexts, |
14a3bc2f CF |
40 | ((si.dwFlags & STARTF_USESHOWWINDOW) != 0 |
41 | ? si.wShowWindow | |
42 | : SW_SHOWNORMAL)); | |
369d8a8f | 43 | } |