Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16203
Modified Files: Tag: desiredata s_main.c Log Message: removed some MAXPDSTRING
Index: s_main.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_main.c,v retrieving revision 1.7.4.17.2.22.2.26 retrieving revision 1.7.4.17.2.22.2.27 diff -C2 -d -r1.7.4.17.2.22.2.26 -r1.7.4.17.2.22.2.27 *** s_main.c 20 Jul 2007 04:22:47 -0000 1.7.4.17.2.22.2.26 --- s_main.c 20 Jul 2007 05:40:50 -0000 1.7.4.17.2.22.2.27 *************** *** 310,315 **** by consulting the variable INSTALL_PREFIX. In MSW, we don't try to use INSTALL_PREFIX. */ void sys_findprogdir(char *progname) { - char sbuf[MAXPDSTRING]; - char sbuf2[MAXPDSTRING]; char *lastslash; #ifdef UNISTD --- 310,313 ---- *************** *** 317,330 **** #endif /* find out by what string Pd was invoked; put answer in "sbuf". */ #ifdef MSW ! GetModuleFileName(NULL, sbuf, sizeof(sbuf2)); ! sbuf[MAXPDSTRING-1] = 0; sys_unbashfilename(sbuf,sbuf); #endif /* MSW */ #ifdef UNISTD ! strncpy(sbuf, progname, MAXPDSTRING); ! sbuf[MAXPDSTRING-1] = 0; #endif lastslash = strrchr(sbuf, '/'); if (lastslash) { /* bash last slash to zero so that sbuf is directory pd was in, e.g., ~/pd/bin */ --- 315,331 ---- #endif /* find out by what string Pd was invoked; put answer in "sbuf". */ + char *sbuf; #ifdef MSW ! int len = GetModuleFileName(NULL, sbuf, 0); ! sbuf = malloc(len+1); ! GetModuleFileName(NULL, sbuf, len); ! sbuf[len] = 0; sys_unbashfilename(sbuf,sbuf); #endif /* MSW */ #ifdef UNISTD ! sbuf = strdup(progname); #endif lastslash = strrchr(sbuf, '/'); + char *sbuf2; if (lastslash) { /* bash last slash to zero so that sbuf is directory pd was in, e.g., ~/pd/bin */ *************** *** 333,339 **** lastslash = strrchr(sbuf, '/'); if (lastslash) { ! strncpy(sbuf2, sbuf, lastslash-sbuf); ! sbuf2[lastslash-sbuf] = 0; ! } else strcpy(sbuf2, ".."); } else { /* no slashes found. Try INSTALL_PREFIX. */ strcpy(sbuf2, INSTALL_PREFIX); --- 334,339 ---- lastslash = strrchr(sbuf, '/'); if (lastslash) { ! asprintf(&sbuf2, "%.*s", lastslash-sbuf, sbuf); ! } else sbuf2 = strdup(".."); } else { /* no slashes found. Try INSTALL_PREFIX. */ strcpy(sbuf2, INSTALL_PREFIX); *************** *** 344,347 **** --- 344,348 ---- sys_libdir = stat(sbuf, &statbuf)>=0 ? symprintf("%s/lib/pd",sbuf2) : gensym(sbuf2); #endif + free(sbuf); }