Welcome to mirror list, hosted at ThFree Co, Russian Federation.

libcmain.c « lib « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c2b3ef0d3043ae2ea3028e1a89e428c33af46e8e (plain)
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
/* libcmain.c

   Copyright 1996, 1997, 1998, 2000 Cygnus Solutions.

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 */
int
main ()
{
  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);

  return WinMain (x, 0, s,
		  ((si.dwFlags & STARTF_USESHOWWINDOW) != 0
		   ? si.wShowWindow
		   : SW_SHOWNORMAL));
}