Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21835
Modified Files: Tag: devel_0_38 s_main.c s_path.c Log Message: added a "-rcfile" flag that allows to override(ignore) the default-settings; rcfiles are stackable (e.g. you can add another rcfile in your rcfile)
Index: s_main.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_main.c,v retrieving revision 1.7.4.15 retrieving revision 1.7.4.16 diff -C2 -d -r1.7.4.15 -r1.7.4.16 *** s_main.c 2 May 2005 07:39:49 -0000 1.7.4.15 --- s_main.c 2 May 2005 08:36:17 -0000 1.7.4.16 *************** *** 286,290 **** for (i = 0; i != argc; ++i) { ! if (!strcmp(argv[i],"-no-prefs")) defeat_presets = 1; } --- 286,290 ---- for (i = 0; i != argc; ++i) { ! if (!strcmp(argv[i],"-no-prefs") || !strcmp(argv[i], "-rcfile")) defeat_presets = 1; } *************** *** 418,421 **** --- 418,422 ----
"\nother flags:\n", + "-rcfile <file> -- read this rcfile instead of default pd-settings\n", "-path <path> -- add to file search path\n", "-nostdpath -- don't search standard ("extra") directory\n", *************** *** 814,817 **** --- 815,826 ---- } /* } tb */ + /* jmz: read an alternative rcfile { */ + else if (!strcmp(*argv, "-rcfile")) + { + sys_parsercfile(*(argv+1)); + argc -= 2; + argv += 2; + } + /* } jmz */ else if (!strcmp(*argv, "-verbose")) {
Index: s_path.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_path.c,v retrieving revision 1.3.4.4 retrieving revision 1.3.4.5 diff -C2 -d -r1.3.4.4 -r1.3.4.5 *** s_path.c 14 Dec 2004 09:56:04 -0000 1.3.4.4 --- s_path.c 2 May 2005 08:36:17 -0000 1.3.4.5 *************** *** 362,371 **** int sys_argparse(int argc, char **argv);
- #ifndef MSW - - #define STARTUPNAME ".pdrc" #define NUMARGS 1000
! int sys_rcfile(void) { FILE* file; --- 362,368 ---- int sys_argparse(int argc, char **argv);
#define NUMARGS 1000
! int sys_parsercfile(char*filename) { FILE* file; *************** *** 375,393 **** 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() */ --- 372,383 ---- char* rcargv[NUMARGS]; char* buffer; ! char buf[1000];
/* parse a startup file */
! if (!(file = fopen(filename, "r"))) return 1;
! post("reading startup file: %s", filename);
rcargv[0] = "."; /* this no longer matters to sys_argparse() */ *************** *** 446,449 **** --- 436,461 ---- return (0); } + + + #ifndef MSW + + #define STARTUPNAME ".pdrc" + + int sys_rcfile(void) + { + char fname[MAXPDSTRING], *home = getenv("HOME"); + + // parse a startup file */ + *fname = '\0'; + + strncat(fname, home? home : ".", MAXPDSTRING-10); + strcat(fname, "/"); + + strcat(fname, STARTUPNAME); + + return sys_parsercfile(fname); + } + + #endif /* MSW */