From f06fe8bef4964656f56975a97b448c1c788e7cf3 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Tue, 6 Jan 2009 19:36:42 +0000 Subject: 0.42-2 (bug fixes) svn path=/trunk/; revision=10477 --- pd/src/t_tkcmd.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'pd/src/t_tkcmd.c') diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c index 6d863c15..b8cac71e 100644 --- a/pd/src/t_tkcmd.c +++ b/pd/src/t_tkcmd.c @@ -333,7 +333,7 @@ gotit: ; #ifdef STARTGUI -#define DEBUGCONNECT +/* #define DEBUGCONNECT */ #ifdef DEBUGCONNECT static FILE *debugfd; @@ -621,12 +621,26 @@ int Pdtcl_Init(Tcl_Interp *interp) int portno = 0, i; if (argv) { + /* search for arg of form "-guiport %d"; if so we're the + child. For some reason, the second version is too stringent + a test on MSW so the first, incorrect one, is conditionally + used. */ +#ifdef MSW for (i = 0; i < (int)strlen(argv) - 1; i++) if (argv[i] >= '0' && argv[i] <= '9') { portno = atoi(argv+i); break; } +#else + for (i = 0; i < (int)strlen(argv) - 3; i++) + if (argv[i] == ' ' && + argv[i+1] >= '0' && argv[i+1] <= '9') + { + portno = atoi(argv+i+1); + break; + } +#endif } if (portno) pdgui_setsock(portno); -- cgit v1.2.1