{
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 )
{
}
if( i_args ) *i_args = argc;
- free( psz_cmdline );
+ free( psz_orig );
return argv;
}
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
-#ifndef WIN32
+#if !defined(WIN32) && !defined(UNDER_CE)
static void SigHandler ( int i_signal );
#endif
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.
return i_ret;
}
-#ifndef WIN32
+#if !defined(WIN32) && !defined(UNDER_CE)
/*****************************************************************************
* SigHandler: system signal handler
*****************************************************************************
}
}
#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