aboutsummaryrefslogtreecommitdiff
path: root/pd/src/s_entry.c
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2004-11-11 04:58:21 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2004-11-11 04:58:21 +0000
commit6e17759e69d5d51bafebc4e5e44e1ee5dbaf58fe (patch)
treeae58db56873db98e0255a0a33c431bb14b51192b /pd/src/s_entry.c
parent7ca685c4bc0b2881555f317db6408ae488fe05aa (diff)
More bug fixes... version 0.38 test10.
svn path=/trunk/; revision=2259
Diffstat (limited to 'pd/src/s_entry.c')
-rw-r--r--pd/src/s_entry.c62
1 files changed, 5 insertions, 57 deletions
diff --git a/pd/src/s_entry.c b/pd/src/s_entry.c
index e81e45c6..eb49cfc1 100644
--- a/pd/src/s_entry.c
+++ b/pd/src/s_entry.c
@@ -1,78 +1,26 @@
/* In MSW, this is all there is to pd; the rest sits in a "pdlib" dll so
that externs can link back to functions defined in pd. */
-#include <stdio.h>
-
int sys_main(int argc, char **argv);
#ifdef MSW
#include <windows.h>
#include <stdio.h>
-#include <malloc.h>
-
-#define MAXARGS 1024
-#define MAXARGLEN 1024
-/* jsarlo { */
-int tokenizeCommandLineString(char *clString, char **tokens)
-{
- int i, charCount = 0;
- int tokCount= 0;
- int quoteOpen = 0;
-
- for (i = 0; i < (int)strlen(clString); i++)
- {
- if (clString[i] == '"')
- {
- quoteOpen = !quoteOpen;
- }
- else if (clString[i] == ' ' && !quoteOpen)
- {
- tokens[tokCount][charCount] = 0;
- tokCount++;
- charCount = 0;
- }
- else
- {
- tokens[tokCount][charCount] = clString[i];
- charCount++;
- }
- }
- tokens[tokCount][charCount] = 0;
- tokCount++;
- return tokCount;
-}
-
-int WINAPI WinMain(HINSTANCE hInstance,
+int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
-{
- int i, argc;
- char *argv[MAXARGS];
-
- __try
- {
- for (i = 0; i < MAXARGS; i++)
- {
- argv[i] = (char *)malloc(MAXARGLEN * sizeof(char));
- }
- GetModuleFileName(NULL, argv[0], MAXARGLEN);
- argc = tokenizeCommandLineString(lpCmdLine, argv + 1) + 1;
- sys_main(argc, argv);
- for (i = 0; i < MAXARGS; i++)
- {
- free(argv[i]);
- }
+{
+ __try {
+ sys_main(__argc,__argv);
}
__finally
- {
+ {
printf("caught an exception; stopping\n");
}
}
-/* } jsarlo */
-
#else /* not MSW */
int main(int argc, char **argv)
{