Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28736
Modified Files: Tag: devel_0_37 s_main.c s_path.c Log Message: improved .rc (stolen from impd)
Index: s_main.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_main.c,v retrieving revision 1.1.1.4.2.19 retrieving revision 1.1.1.4.2.20 diff -C2 -d -r1.1.1.4.2.19 -r1.1.1.4.2.20 *** s_main.c 9 Oct 2004 07:42:34 -0000 1.1.1.4.2.19 --- s_main.c 19 Oct 2004 11:14:48 -0000 1.1.1.4.2.20 *************** *** 75,78 **** --- 75,79 ---- static int sys_version; int sys_oldtclversion; /* hack to warn g_rtext.c about old text sel */ + char *rcfilename;
int sys_nmidiout = 1; *************** *** 267,275 **** pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ - #ifdef UNIX sys_rcfile(); /* parse the startup file */ ! #endif ! if (sys_argparse(argc, argv)) /* parse cmd line */ ! return (1); sys_afterargparse(); /* post-argparse settings */ if (sys_verbose || sys_version) fprintf(stderr, "%scompiled %s %s\n", --- 268,273 ---- pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ sys_rcfile(); /* parse the startup file */ ! if (sys_argparse(argc, argv)) return (1); /* parse cmd line */ sys_afterargparse(); /* post-argparse settings */ if (sys_verbose || sys_version) fprintf(stderr, "%scompiled %s %s\n",
Index: s_path.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_path.c,v retrieving revision 1.1.1.2.2.3 retrieving revision 1.1.1.2.2.4 diff -C2 -d -r1.1.1.2.2.3 -r1.1.1.2.2.4 *** s_path.c 5 Mar 2004 20:58:09 -0000 1.1.1.2.2.3 --- s_path.c 19 Oct 2004 11:14:49 -0000 1.1.1.2.2.4 *************** *** 21,24 **** --- 21,25 ---- #endif #ifdef MSW + #include <windows.h> #include <io.h> #endif *************** *** 303,341 **** }
! /* Startup file reading for linux and MACOSX. This should be replaced by a better mechanism. This should be integrated with the audio, MIDI, and path dialog system. */
- #ifdef UNIX - - #define STARTUPNAME ".pdrc" #define NUMARGS 1000 - int sys_argparse(int argc, char **argv); ! ! int sys_rcfile(void) ! { ! FILE* file; ! int i; ! int k; ! int rcargc; ! char* rcargv[NUMARGS]; ! char* buffer; ! char fname[MAXPDSTRING], buf[1000], *home = getenv("HOME"); ! ! /* parse a startup file */ ! ! *fname = '\0'; ! ! strncat(fname, home? home : ".", MAXPDSTRING-10); ! strcat(fname, "/"); ! ! strcat(fname, STARTUPNAME); ! ! if (!(file = fopen(fname, "r"))) ! return 1; ! ! post("reading startup file: %s", fname); ! rcargv[0] = "."; /* this no longer matters to sys_argparse() */
--- 304,317 ---- }
! /* Startup file reading. This should be replaced by a better mechanism. This should be integrated with the audio, MIDI, and path dialog system. */
#define NUMARGS 1000 int sys_argparse(int argc, char **argv); ! static int sys_this_rcfile(FILE *file) { ! int i,rcargc; ! char *rcargv[NUMARGS]; ! char buf[1000]; rcargv[0] = "."; /* this no longer matters to sys_argparse() */
*************** *** 366,380 **** } } ! //end of support for comments added by Tim Blechmann !
! if (i >= NUMARGS-1) ! fprintf(stderr, "startup file too long; extra args dropped\n"); rcargv[i] = 0; - rcargc = i; - /* parse the options */ - fclose(file); if (sys_verbose) --- 342,351 ---- } } ! //end of comments
! if (i>=NUMARGS-1) post("startup file too long; extra args dropped\n"); rcargv[i] = 0; rcargc = i; /* parse the options */ fclose(file); if (sys_verbose) *************** *** 391,399 **** { post("error parsing RC arguments"); ! return (1); } ! return (0); } ! #endif /* UNIX */
/* start an audio settings dialog window */ --- 362,403 ---- { post("error parsing RC arguments"); ! return 1; } ! return 0; } ! ! EXTERN char *rcfilename; ! ! int sys_rcfile(void) ! { ! FILE* file; ! int i,j,ndirs=0; ! char fname[MAXPDSTRING]; ! static char *fnames[] = {".pdrc","pd.ini",0}; ! static char *dnames[] = {0,0,0}; ! #ifdef UNIX ! char *home = getenv("HOME"); ! #endif ! #ifdef MSW ! char home[256]; ! GetEnvironmentVariable("USERPROFILE", home, 255); ! #endif ! dnames[ndirs++] = home ? home : "."; ! dnames[ndirs++] = sys_libdir->s_name; ! /* find a startup file */ ! for (i=0; dnames[i]; i++) { ! for (j=0; fnames[j]; j++) { ! int n = snprintf(fname,MAXPDSTRING,"%s/%s", dnames[i], fnames[j]); ! if (n>=MAXPDSTRING) {post("sys_rcfile: buffer overflow"); return 1;} ! file = fopen(fname, "r"); ! if (file) { ! post("reading startup file: %s", fname); ! rcfilename = strdup(fname); ! return sys_this_rcfile(file); ! } ! } ! } ! return 0; ! }
/* start an audio settings dialog window */