From 18c47474a668d7bbbabd525686355c16a45f6ec4 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Fri, 29 Jul 2005 19:01:22 +0000 Subject: Mac to work with tcl/tk 8.4.5; pd extension added automatically in saveas bug fix writing aiff gfiles bug fix (tcl error messages when starting open dialogs) svn path=/trunk/; revision=3385 --- pd/src/s_inter.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'pd/src/s_inter.c') diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c index 3e9ded5f..f77b5e84 100644 --- a/pd/src/s_inter.c +++ b/pd/src/s_inter.c @@ -468,6 +468,8 @@ static void socketreceiver_getudp(t_socketreceiver *x, int fd) } } +void sys_exit(void); + void socketreceiver_read(t_socketreceiver *x, int fd) { if (x->sr_udp) /* UDP ("datagram") socket protocol */ @@ -506,7 +508,8 @@ void socketreceiver_read(t_socketreceiver *x, int fd) if (x == sys_socketreceiver) { fprintf(stderr, "pd: exiting\n"); - sys_bail(0); + sys_exit(); + return; } else { @@ -1028,28 +1031,51 @@ int sys_startgui(const char *guidir) #ifdef MACOSX char *homedir = getenv("HOME"), filename[250]; struct stat statbuf; + /* first look for Wish bundled with and renamed "Pd" */ sprintf(filename, "%s/../../MacOS/Pd", guidir); if (stat(filename, &statbuf) >= 0) goto foundit; if (!homedir || strlen(homedir) > 150) goto nohomedir; + /* Look for Wish in user's Applications. Might or might + not be names "Wish Shell", and might or might not be + in "Utilities" subdir. */ sprintf(filename, "%s/Applications/Utilities/Wish shell.app/Contents/MacOS/Wish Shell", homedir); if (stat(filename, &statbuf) >= 0) goto foundit; + sprintf(filename, + "%s/Applications/Utilities/Wish.app/Contents/MacOS/Wish", + homedir); + if (stat(filename, &statbuf) >= 0) + goto foundit; sprintf(filename, "%s/Applications/Wish shell.app/Contents/MacOS/Wish Shell", homedir); if (stat(filename, &statbuf) >= 0) goto foundit; + sprintf(filename, + "%s/Applications/Wish.app/Contents/MacOS/Wish", + homedir); + if (stat(filename, &statbuf) >= 0) + goto foundit; nohomedir: + /* Perform the same search among system applications. */ strcpy(filename, "/Applications/Utilities/Wish Shell.app/Contents/MacOS/Wish Shell"); if (stat(filename, &statbuf) >= 0) goto foundit; + strcpy(filename, + "/Applications/Utilities/Wish.app/Contents/MacOS/Wish"); + if (stat(filename, &statbuf) >= 0) + goto foundit; strcpy(filename, "/Applications/Wish Shell.app/Contents/MacOS/Wish Shell"); + if (stat(filename, &statbuf) >= 0) + goto foundit; + strcpy(filename, + "/Applications/Wish.app/Contents/MacOS/Wish"); foundit: sprintf(cmdbuf, "\"%s\" %s/pd.tk %d\n", filename, guidir, portno); #else @@ -1235,9 +1261,9 @@ void sys_bail(int n) sys_close_midi(); fprintf(stderr, "... done.\n"); #endif - exit(1); + exit(n); } - else _exit(n); + else _exit(1); } void glob_quit(void *dummy) -- cgit v1.2.1