Commit 698feb97 authored by Gildas Bazin's avatar Gildas Bazin

* src/vlc.c: ported to WinCE.

parent ddf6a273
......@@ -621,12 +621,12 @@ char **vlc_parse_cmdline( const char *psz_cmdline, int *i_args )
{
int argc = 0;
char **argv = 0;
char *s, *psz_parser, *psz_arg;
char *s, *psz_parser, *psz_arg, *psz_orig;
int i_bcount = 0;
if( !psz_cmdline ) return 0;
psz_cmdline = strdup( psz_cmdline );
psz_arg = psz_parser = s = psz_cmdline;
psz_orig = strdup( psz_cmdline );
psz_arg = psz_parser = s = psz_orig;
while( *s )
{
......@@ -686,6 +686,6 @@ char **vlc_parse_cmdline( const char *psz_cmdline, int *i_args )
}
if( i_args ) *i_args = argc;
free( psz_cmdline );
free( psz_orig );
return argv;
}
......@@ -41,7 +41,7 @@
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
#ifndef WIN32
#if !defined(WIN32) && !defined(UNDER_CE)
static void SigHandler ( int i_signal );
#endif
......@@ -80,7 +80,7 @@ int main( int i_argc, char *ppsz_argv[] )
return i_ret;
}
#ifndef WIN32
#if !defined(WIN32) && !defined(UNDER_CE)
/* Set the signal handlers. SIGTERM is not intercepted, because we need at
* least one method to kill the program when all other methods failed, and
* when we don't want to use SIGKILL.
......@@ -113,7 +113,7 @@ int main( int i_argc, char *ppsz_argv[] )
return i_ret;
}
#ifndef WIN32
#if !defined(WIN32) && !defined(UNDER_CE)
/*****************************************************************************
* SigHandler: system signal handler
*****************************************************************************
......@@ -155,3 +155,30 @@ static void SigHandler( int i_signal )
}
}
#endif
#if defined(UNDER_CE)
/*****************************************************************************
* WinMain: parse command line, start interface and spawn threads. (WinCE only)
*****************************************************************************/
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow )
{
char **argv, psz_cmdline[MAX_PATH];
int argc, i_ret;
WideCharToMultiByte( CP_ACP, WC_DEFAULTCHAR, lpCmdLine, -1,
psz_cmdline, MAX_PATH, NULL, NULL );
argv = vlc_parse_cmdline( psz_cmdline, &argc );
argv = realloc( argv, (argc + 1) * sizeof(char *) );
if( !argv ) return -1;
if( argc ) memmove( argv + 1, argv, argc );
argv[0] = strdup(""); /* Fake program path */
i_ret = main( argc, argv );
/* No need to free the argv memory */
return i_ret;
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment