Commit 3c415a1a authored by pokergaming's avatar pokergaming
Browse files

more reformatting (tabs to spaces, lining up curly braces, no line wraps, etc.)

parent 94606760
...@@ -53,21 +53,21 @@ static void sys_initloadpreferences( void) ...@@ -53,21 +53,21 @@ static void sys_initloadpreferences( void)
{ {
char filenamebuf[FILENAME_MAX], *homedir = getenv("HOME"); char filenamebuf[FILENAME_MAX], *homedir = getenv("HOME");
int fd, length; int fd, length;
char user_prefs_file[FILENAME_MAX]; /* user prefs file */ char user_prefs_file[FILENAME_MAX]; /* user prefs file */
/* default prefs embedded in the package */ /* default prefs embedded in the package */
char default_prefs_file[FILENAME_MAX]; char default_prefs_file[FILENAME_MAX];
struct stat statbuf; struct stat statbuf;
snprintf(default_prefs_file, FILENAME_MAX, "%s/default.pdl2ork", snprintf(default_prefs_file, FILENAME_MAX, "%s/default.pdl2ork",
sys_libdir->s_name); sys_libdir->s_name);
if (homedir) if (homedir)
snprintf(user_prefs_file, FILENAME_MAX, "%s/.pdl2ork", homedir); snprintf(user_prefs_file, FILENAME_MAX, "%s/.pdl2ork", homedir);
if (stat(user_prefs_file, &statbuf) == 0) if (stat(user_prefs_file, &statbuf) == 0)
strncpy(filenamebuf, user_prefs_file, FILENAME_MAX); strncpy(filenamebuf, user_prefs_file, FILENAME_MAX);
else if (stat(default_prefs_file, &statbuf) == 0) else if (stat(default_prefs_file, &statbuf) == 0)
strncpy(filenamebuf, default_prefs_file, FILENAME_MAX); strncpy(filenamebuf, default_prefs_file, FILENAME_MAX);
else else
return; return;
filenamebuf[FILENAME_MAX-1] = 0; filenamebuf[FILENAME_MAX-1] = 0;
if ((fd = open(filenamebuf, 0)) < 0) if ((fd = open(filenamebuf, 0)) < 0)
...@@ -240,38 +240,38 @@ static int sys_getpreference(const char *key, char *value, int size) ...@@ -240,38 +240,38 @@ static int sys_getpreference(const char *key, char *value, int size)
{ {
char cmdbuf[256]; char cmdbuf[256];
int nread = 0, nleft = size; int nread = 0, nleft = size;
char default_prefs[FILENAME_MAX]; // default prefs embedded in the package char default_prefs[FILENAME_MAX]; // default prefs embedded in the package
char embedded_prefs[FILENAME_MAX]; // overrides others for standalone app char embedded_prefs[FILENAME_MAX]; // overrides others for standalone app
char embedded_prefs_file[FILENAME_MAX]; char embedded_prefs_file[FILENAME_MAX];
char user_prefs_file[FILENAME_MAX]; char user_prefs_file[FILENAME_MAX];
char *homedir = getenv("HOME"); char *homedir = getenv("HOME");
struct stat statbuf; struct stat statbuf;
/* the 'defaults' command expects the filename without .plist at the end */ /* the 'defaults' command expects the filename without .plist at the end */
snprintf(default_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork.default", snprintf(default_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork.default",
sys_libdir->s_name); sys_libdir->s_name);
snprintf(embedded_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork", snprintf(embedded_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork",
sys_libdir->s_name); sys_libdir->s_name);
snprintf(embedded_prefs_file, FILENAME_MAX, "%s.plist", embedded_prefs); snprintf(embedded_prefs_file, FILENAME_MAX, "%s.plist", embedded_prefs);
snprintf(user_prefs_file, FILENAME_MAX, snprintf(user_prefs_file, FILENAME_MAX,
"%s/Library/Preferences/org.puredata.pdl2ork.plist", homedir); "%s/Library/Preferences/org.puredata.pdl2ork.plist", homedir);
if (stat(embedded_prefs_file, &statbuf) == 0) if (stat(embedded_prefs_file, &statbuf) == 0)
{ {
snprintf(cmdbuf, FILENAME_MAX + 20, snprintf(cmdbuf, FILENAME_MAX + 20,
"defaults read '%s' %s 2> /dev/null\n", embedded_prefs, key); "defaults read '%s' %s 2> /dev/null\n", embedded_prefs, key);
strncpy(current_prefs, embedded_prefs, FILENAME_MAX); strncpy(current_prefs, embedded_prefs, FILENAME_MAX);
} }
else if (stat(user_prefs_file, &statbuf) == 0) else if (stat(user_prefs_file, &statbuf) == 0)
{ {
snprintf(cmdbuf, FILENAME_MAX + 20, snprintf(cmdbuf, FILENAME_MAX + 20,
"defaults read org.puredata.pdl2ork %s 2> /dev/null\n", key); "defaults read org.puredata.pdl2ork %s 2> /dev/null\n", key);
strcpy(current_prefs, "org.puredata.pdl2ork"); strcpy(current_prefs, "org.puredata.pdl2ork");
} }
else else
{ {
snprintf(cmdbuf, FILENAME_MAX + 20, snprintf(cmdbuf, FILENAME_MAX + 20,
"defaults read '%s' %s 2> /dev/null\n", default_prefs, key); "defaults read '%s' %s 2> /dev/null\n", default_prefs, key);
strcpy(current_prefs, "org.puredata.pdl2ork"); strcpy(current_prefs, "org.puredata.pdl2ork");
} }
FILE *fp = popen(cmdbuf, "r"); FILE *fp = popen(cmdbuf, "r");
while (nread < size) while (nread < size)
{ {
......
...@@ -705,9 +705,9 @@ void sys_vgui(char *fmt, ...) ...@@ -705,9 +705,9 @@ void sys_vgui(char *fmt, ...)
msglen = sys_guibufsize - sys_guibufhead; msglen = sys_guibufsize - sys_guibufhead;
} }
if (sys_debuglevel & DEBUG_MESSUP) { if (sys_debuglevel & DEBUG_MESSUP) {
//blargh(); //blargh();
fprintf(stderr, "%s", sys_guibuf + sys_guibufhead); fprintf(stderr, "%s", sys_guibuf + sys_guibufhead);
} }
sys_guibufhead += msglen; sys_guibufhead += msglen;
sys_bytessincelastping += msglen; sys_bytessincelastping += msglen;
} }
...@@ -861,8 +861,8 @@ void sys_unqueuegui(void *client) ...@@ -861,8 +861,8 @@ void sys_unqueuegui(void *client)
int sys_pollgui(void) int sys_pollgui(void)
{ {
// return (sys_domicrosleep(0, 1) || sys_poll_togui()); // return (sys_domicrosleep(0, 1) || sys_poll_togui());
// "fix" for sluggish gui proposed by Miller on 12/16/2012 // "fix" for sluggish gui proposed by Miller on 12/16/2012
return (sys_domicrosleep(0, 1) + sys_poll_togui()); return (sys_domicrosleep(0, 1) + sys_poll_togui());
} }
...@@ -1182,7 +1182,7 @@ int sys_startgui(const char *guidir) ...@@ -1182,7 +1182,7 @@ int sys_startgui(const char *guidir)
if (sys_hipriority == -1) if (sys_hipriority == -1)
sys_hipriority = 1; //(!getuid() || !geteuid()); sys_hipriority = 1; //(!getuid() || !geteuid());
sprintf(cmdbuf, "%s/pd-watchdog\n", guidir); sprintf(cmdbuf, "%s/pd-watchdog\n", guidir);
if (sys_hipriority) if (sys_hipriority)
{ {
/* To prevent lockup, we fork off a watchdog process with /* To prevent lockup, we fork off a watchdog process with
...@@ -1326,16 +1326,19 @@ extern int do_not_redraw; ...@@ -1326,16 +1326,19 @@ extern int do_not_redraw;
void glob_quit(void *dummy) void glob_quit(void *dummy)
{ {
//If we're going to try to cleanly close everything here, we should do the same for all open /* If we're going to try to cleanly close everything here, we should
//patches and that is currently not the case, so for the time being, let's just leave OS to deal do the same for all open patches and that is currently not the case,
//with freeing of all memory when the program exits... so for the time being, let's just leave OS to deal with freeing of all
memory when the program exits... */
//let's try to cleanly remove invisible template canvases
//if (garray_arraytemplatecanvas) canvas_free( (t_canvas *)garray_arraytemplatecanvas); /* Let's try to cleanly remove invisible template canvases */
//if (garray_floattemplatecanvas) canvas_free( (t_canvas *)garray_floattemplatecanvas); //if (garray_arraytemplatecanvas)
canvas_suspend_dsp(); // canvas_free((t_canvas *)garray_arraytemplatecanvas);
do_not_redraw = 1; //if (garray_floattemplatecanvas)
glob_closeall(0, 1); // canvas_free( (t_canvas *)garray_floattemplatecanvas);
canvas_suspend_dsp();
do_not_redraw = 1;
glob_closeall(0, 1);
sys_vgui("exit\n"); sys_vgui("exit\n");
if (!sys_nogui) if (!sys_nogui)
{ {
......
...@@ -47,11 +47,11 @@ int sys_noloadbang; ...@@ -47,11 +47,11 @@ int sys_noloadbang;
int sys_nogui; int sys_nogui;
int sys_hipriority = -1; /* -1 = don't care; 0 = no; 1 = yes */ int sys_hipriority = -1; /* -1 = don't care; 0 = no; 1 = yes */
int sys_guisetportnumber; /* if started from the GUI, this is the port # */ int sys_guisetportnumber; /* if started from the GUI, this is the port # */
int sys_nosleep = 0; /* skip all "sleep" calls and spin instead */ int sys_nosleep = 0; /* skip all "sleep" calls and spin instead */
int sys_console = 0; /* default settings for the console is off */ int sys_console = 0; /* default settings for the console is off */
int sys_k12_mode = 0; /* by default k12 mode is off */ int sys_k12_mode = 0; /* by default k12 mode is off */
int sys_unique = 0; /* by default off, prevents multiple instances of pd-l2ork */ int sys_unique = 0; /* by default off, prevents multiple instances
of pd-l2ork */
char *sys_guicmd; char *sys_guicmd;
t_symbol *sys_libdir; t_symbol *sys_libdir;
t_symbol *sys_guidir; t_symbol *sys_guidir;
...@@ -167,18 +167,24 @@ static void openit(const char *dirname, const char *filename) ...@@ -167,18 +167,24 @@ static void openit(const char *dirname, const char *filename)
{ {
close (fd); close (fd);
glob_evalfile(0, gensym(nameptr), gensym(dirbuf)); glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
sys_vgui("pdtk_set_current_dir %s\n", filename); sys_vgui("pdtk_set_current_dir %s\n", filename);
//sys_vgui("::pd_menus::update_recentfiles_menu .mbar.file 0\n"); //sys_vgui("::pd_menus::update_recentfiles_menu .mbar.file 0\n");
if (strstr(filename, dirname) != NULL) { if (strstr(filename, dirname) != NULL)
// when opening files from a command line (at startup), filename contains full path {
// so, if dirname is already included in filename we only pass filename variable /* when opening files from a command line (at startup), filename
// otherwise combine the two and send them together contains full path so, if dirname is already included in
filename we only pass filename variable otherwise combine the
two and send them together */
#ifndef MSW #ifndef MSW
sys_vgui("::pd_guiprefs::update_recentfiles %s/%s 1\n", dirname, filename); sys_vgui("::pd_guiprefs::update_recentfiles %s/%s 1\n",
dirname, filename);
#else #else
sys_vgui("::pd_guiprefs::update_recentfiles %s\%s 1\n", dirname, filename); sys_vgui("::pd_guiprefs::update_recentfiles %s\%s 1\n",
dirname, filename);
#endif #endif
} else { }
else
{
sys_vgui("::pd_guiprefs::update_recentfiles %s 1\n", filename); sys_vgui("::pd_guiprefs::update_recentfiles %s 1\n", filename);
} }
} }
...@@ -218,8 +224,8 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv) ...@@ -218,8 +224,8 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
sys_fontlist[i].fi_hostfontsize = atom_getintarg(3 * best + 2, argc, argv); sys_fontlist[i].fi_hostfontsize = atom_getintarg(3 * best + 2, argc, argv);
sys_fontlist[i].fi_width = atom_getintarg(3 * best + 3, argc, argv); sys_fontlist[i].fi_width = atom_getintarg(3 * best + 3, argc, argv);
sys_fontlist[i].fi_height = atom_getintarg(3 * best + 4, argc, argv); sys_fontlist[i].fi_height = atom_getintarg(3 * best + 4, argc, argv);
sys_fontlist[i].fi_maxwidth = sys_fontlist[i].fi_width; sys_fontlist[i].fi_maxwidth = sys_fontlist[i].fi_width;
sys_fontlist[i].fi_maxheight = sys_fontlist[i].fi_height; sys_fontlist[i].fi_maxheight = sys_fontlist[i].fi_height;
} }
#if 0 #if 0
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
...@@ -258,8 +264,9 @@ static void pd_makeversion(void) ...@@ -258,8 +264,9 @@ static void pd_makeversion(void)
{ {
char foo[100]; char foo[100];
//snprintf(foo, sizeof(foo), "Pd-l2ork version %d.%d-%d%s\n", PD_MAJOR_VERSION, //snprintf(foo, sizeof(foo), "Pd-l2ork version %d.%d-%d%s\n",
// PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION); // PD_MAJOR_VERSION, PD_MINOR_VERSION,
// PD_BUGFIX_VERSION, PD_TEST_VERSION);
snprintf(foo, sizeof(foo), "Pd-L2Ork version %s\n", PD_TEST_VERSION); snprintf(foo, sizeof(foo), "Pd-L2Ork version %s\n", PD_TEST_VERSION);
...@@ -300,28 +307,35 @@ int sys_main(int argc, char **argv) ...@@ -300,28 +307,35 @@ int sys_main(int argc, char **argv)
return(1); return(1);
/* check if we are unique, otherwise, just focus existing /* check if we are unique, otherwise, just focus existing
instance, and if necessary open file inside it */\ instance, and if necessary open file inside it */\
if (sys_openlist) { if (sys_openlist)
{
// let's create one continuous string from all files // let's create one continuous string from all files
int length = 0; int length = 0;
t_namelist *nl; t_namelist *nl;
for (nl = sys_openlist; nl; nl = nl->nl_next) for (nl = sys_openlist; nl; nl = nl->nl_next)
length = length + strlen(nl->nl_string) + 1; length = length + strlen(nl->nl_string) + 1;
if((filenames = malloc(length)) != NULL) { if((filenames = malloc(length)) != NULL)
{
filenames[0] = '\0'; // ensures the memory is an empty string filenames[0] = '\0'; // ensures the memory is an empty string
if (sys_openlist) { if (sys_openlist)
for (nl = sys_openlist; nl; nl = nl->nl_next) { {
for (nl = sys_openlist; nl; nl = nl->nl_next)
{
strcat(filenames,nl->nl_string); strcat(filenames,nl->nl_string);
if (nl->nl_next) if (nl->nl_next)
strcat(filenames," "); strcat(filenames," ");
} }
} }
//fprintf(stderr,"final list: <%s>\n", filenames); //fprintf(stderr,"final list: <%s>\n", filenames);
} else { }
else
{
error("filelist malloc failed!\n"); error("filelist malloc failed!\n");
return(1); return(1);
} }
} }
sys_vgui("pdtk_check_unique %d %s\n", sys_unique, (filenames ? filenames : "0")); sys_vgui("pdtk_check_unique %d %s\n", sys_unique,
(filenames ? filenames : "0"));
if (sys_externalschedlib) if (sys_externalschedlib)
return (sys_run_scheduler(sys_externalschedlibname, return (sys_run_scheduler(sys_externalschedlibname,
sys_extraflagsstring)); sys_extraflagsstring));
...@@ -333,13 +347,14 @@ int sys_main(int argc, char **argv) ...@@ -333,13 +347,14 @@ int sys_main(int argc, char **argv)
sys_reopen_midi(); sys_reopen_midi();
sys_reopen_audio(); sys_reopen_audio();
if (sys_console) sys_vgui("pdtk_toggle_console 1\n"); if (sys_console) sys_vgui("pdtk_toggle_console 1\n");
if (sys_k12_mode) { if (sys_k12_mode)
t_namelist *path = pd_extrapath; {
while (path->nl_next) t_namelist *path = pd_extrapath;
path = path->nl_next; while (path->nl_next)
sys_vgui("pdtk_enable_k12_mode %s\n", path->nl_string); path = path->nl_next;
} sys_vgui("pdtk_enable_k12_mode %s\n", path->nl_string);
}
/* run scheduler until it quits */ /* run scheduler until it quits */
return (m_mainloop()); return (m_mainloop());
...@@ -533,7 +548,8 @@ void sys_findprogdir(char *progname) ...@@ -533,7 +548,8 @@ void sys_findprogdir(char *progname)
sys_guidir = &s_; /* in MSW the guipath just depends on the libdir */ sys_guidir = &s_; /* in MSW the guipath just depends on the libdir */
#else #else
char *res = realpath(sbuf2, sbuf); char *res = realpath(sbuf2, sbuf);
if (!res) { if (!res)
{
error("%s: Cannot get a real path", sbuf2); error("%s: Cannot get a real path", sbuf2);
} }
strncpy(sbuf2, sbuf, FILENAME_MAX-30); strncpy(sbuf2, sbuf, FILENAME_MAX-30);
...@@ -612,7 +628,8 @@ int sys_argparse(int argc, char **argv) ...@@ -612,7 +628,8 @@ int sys_argparse(int argc, char **argv)
argc -= 2; argv += 2; argc -= 2; argv += 2;
} }
else if (!strcmp(*argv, "-soundbuf") || !strcmp(*argv, "-audiobuf") && (argc > 1)) else if (!strcmp(*argv, "-soundbuf") ||
!strcmp(*argv, "-audiobuf") && (argc > 1))
{ {
sys_main_advance = atoi(argv[1]); sys_main_advance = atoi(argv[1]);
argc -= 2; argv += 2; argc -= 2; argv += 2;
...@@ -822,12 +839,12 @@ int sys_argparse(int argc, char **argv) ...@@ -822,12 +839,12 @@ int sys_argparse(int argc, char **argv)
sys_printtostderr = sys_nogui = 1; sys_printtostderr = sys_nogui = 1;
argc--; argv++; argc--; argv++;
} }
else if (!strcmp(*argv, "-console")) else if (!strcmp(*argv, "-console"))
{ {
sys_console = 1; sys_console = 1;
argc--; argv++; argc--; argv++;
} }
else if (!strcmp(*argv, "-k12")) else if (!strcmp(*argv, "-k12"))
{ {
sys_k12_mode = 1; sys_k12_mode = 1;
argc--; argv++; argc--; argv++;
......
...@@ -80,43 +80,43 @@ static void sys_path_replace( ...@@ -80,43 +80,43 @@ static void sys_path_replace(
char const * const pattern, char const * const pattern,
char const * const replacement char const * const replacement
) { ) {
size_t const replen = strlen(replacement); size_t const replen = strlen(replacement);
size_t const patlen = strlen(pattern); size_t const patlen = strlen(pattern);
size_t const orilen = strlen(original); size_t const orilen = strlen(original);
size_t patcnt = 0; size_t patcnt = 0;
const char * oriptr; const char * oriptr;
const char * patloc; const char * patloc;
// find how many times the pattern occurs in the original string // find how many times the pattern occurs in the original string
for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen) for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
{ {
patcnt++; patcnt++;
} }
{ {
// allocate memory for the new string // allocate memory for the new string
size_t const retlen = orilen + patcnt * (replen - patlen); size_t const retlen = orilen + patcnt * (replen - patlen);
if (returned != NULL) if (returned != NULL)
{ {
// copy the original string, // copy the original string,
// replacing all the instances of the pattern // replacing all the instances of the pattern
char *retptr = returned; char *retptr = returned;
for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen) for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
{ {
size_t const skplen = patloc - oriptr; size_t const skplen = patloc - oriptr;
// copy the section until the occurence of the pattern // copy the section until the occurence of the pattern
strncpy(retptr, oriptr, skplen); strncpy(retptr, oriptr, skplen);
retptr += skplen; retptr += skplen;
// copy the replacement // copy the replacement
strncpy(retptr, replacement, replen); strncpy(retptr, replacement, replen);
retptr += replen; retptr += replen;
} }
// copy the rest of the string. // copy the rest of the string.
strcpy(retptr, oriptr); strcpy(retptr, oriptr);
} }
} }
} }
/* expand env vars and ~ at the beginning of a path and make a copy to return */ /* expand env vars and ~ at the beginning of a path and make a copy to return */
...@@ -148,21 +148,24 @@ static void sys_expandpath(const char *from, char *to) ...@@ -148,21 +148,24 @@ static void sys_expandpath(const char *from, char *to)
/* used for expanding paths for various objects */ /* used for expanding paths for various objects */
void sys_expandpathelems(const char *name, char *result) void sys_expandpathelems(const char *name, char *result)
{ {
//check for expandable elements in path (e.g. @pd_extra, ~/) and replace //check for expandable elements in path (e.g. @pd_extra, ~/) and replace
//fprintf(stderr,"sys_expandpathelems name=<%s>\n", name); //fprintf(stderr,"sys_expandpathelems name=<%s>\n", name);
char interim[FILENAME_MAX]; char interim[FILENAME_MAX];
if (strstr(name, "@pd_extra") != NULL) { if (strstr(name, "@pd_extra") != NULL)
t_namelist *path = pd_extrapath; {
while (path->nl_next) t_namelist *path = pd_extrapath;
path = path->nl_next; while (path->nl_next)
sys_path_replace(name, interim, "@pd_extra", path->nl_string); path = path->nl_next;
//fprintf(stderr,"path->nl_string=<%s>\n", path->nl_string); sys_path_replace(name, interim, "@pd_extra", path->nl_string);
} else { //fprintf(stderr,"path->nl_string=<%s>\n", path->nl_string);
strcpy(interim, name); }
} else
//fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim); {
sys_expandpath(interim, result); strcpy(interim, name);
//fprintf(stderr,"sys_expandpathelems result=<%s>\n", result); }
//fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim);
sys_expandpath(interim, result);
//fprintf(stderr,"sys_expandpathelems result=<%s>\n", result);
} }
/* test if path is absolute or relative, based on leading /, env vars, ~, etc */ /* test if path is absolute or relative, based on leading /, env vars, ~, etc */
...@@ -420,10 +423,10 @@ static int do_open_via_path(const char *dir, const char *name, ...@@ -420,10 +423,10 @@ static int do_open_via_path(const char *dir, const char *name,
{ {
t_namelist *nl; t_namelist *nl;
int fd = -1; int fd = -1;
char final_name[FILENAME_MAX]; char final_name[FILENAME_MAX];
/* first check for @ and ~ (and later others) and replace */ /* first check for @ and ~ (and later others) and replace */
sys_expandpathelems(name, final_name); sys_expandpathelems(name, final_name);
/* first check if "name" is absolute (and if so, try to open) */ /* first check if "name" is absolute (and if so, try to open) */
if (sys_open_absolute(final_name, ext, dirresult, nameresult, size, bin, &fd)) if (sys_open_absolute(final_name, ext, dirresult, nameresult, size, bin, &fd))
...@@ -438,7 +441,7 @@ static int do_open_via_path(const char *dir, const char *name, ...@@ -438,7 +441,7 @@ static int do_open_via_path(const char *dir, const char *name,
for (nl = searchpath; nl; nl = nl->nl_next) for (nl = searchpath; nl; nl = nl->nl_next)
if ((fd = sys_trytoopenone(nl->nl_string, final_name, ext, if ((fd = sys_trytoopenone(nl->nl_string, final_name, ext,
dirresult, nameresult, size, bin)) >= 0) dirresult, nameresult, size, bin)) >= 0)
goto do_open_via_path_end; goto do_open_via_path_end;
/* next look in built-in paths like "extra" */ /* next look in built-in paths like "extra" */
if (sys_usestdpath) if (sys_usestdpath)
...@@ -451,7 +454,7 @@ static int do_open_via_path(const char *dir, const char *name, ...@@ -451,7 +454,7 @@ static int do_open_via_path(const char *dir, const char *name,
*nameresult = dirresult; *nameresult = dirresult;
return (-1); return (-1);
do_open_via_path_end: do_open_via_path_end:
return (fd); return (fd);
} }
/* open via path, using the global search path. */ /* open via path, using the global search path. */
......
...@@ -558,12 +558,12 @@ void tcl_mess(char *s) ...@@ -558,12 +558,12 @@ void tcl_mess(char *s)
int result; int result;
// PRODUCTION VERSION // PRODUCTION VERSION
char catch_s[strlen(s)+10]; char catch_s[strlen(s)+10];
sprintf(catch_s, "catch { %s }", s); sprintf(catch_s, "catch { %s }", s);
// DEBUGGING VERSION // DEBUGGING VERSION
//char catch_s[strlen(s)]; //char catch_s[strlen(s)];
//sprintf(catch_s, "%s", s); //sprintf(catch_s, "%s", s);
Tcl_Obj *messageObjPtr = Tcl_NewStringObj(catch_s,-1); Tcl_Obj *messageObjPtr = Tcl_NewStringObj(catch_s,-1);
Tcl_IncrRefCount(messageObjPtr); Tcl_IncrRefCount(messageObjPtr);
...@@ -590,8 +590,8 @@ void pdgui_doevalfile(Tcl_Interp *interp, char *s) ...@@ -590,8 +590,8 @@ void pdgui_doevalfile(Tcl_Interp *interp, char *s)
if (Tcl_EvalFile(interp, buf) != TCL_OK) if (Tcl_EvalFile(interp, buf) != TCL_OK)
{ {
char buf2[1000]; char buf2[1000];
const char *trace = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY); const char *trace = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
printf("error in file %s: %s\n", buf, trace); printf("error in file %s: %s\n", buf, trace);
sprintf(buf2, "puts [concat tcl: %s: can't open script]\n", sprintf(buf2, "puts [concat tcl: %s: can't open script]\n",