diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index 2c56e0c40..05e414d8e 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -16,6 +16,7 @@ file format as in the dialog window for data. #include "m_pd.h" #include "g_canvas.h" #include +#include /* object to assist in saving state by abstractions */ static t_class *savestate_class; @@ -968,7 +969,10 @@ static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir, t_binbuf *b = binbuf_new(); canvas_savetemplatesto(x, b, 1); canvas_saveto(x, b); - if (binbuf_write(b, filename->s_name, dir->s_name, 0)) sys_ouch(); + errno = 0; + if (binbuf_write(b, filename->s_name, dir->s_name, 0)) + post("%s/%s: %s", dir->s_name, filename->s_name, + (errno ? strerror(errno) : "write failed")); else { /* if not an abstraction, reset title bar and directory */ diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index a687ea537..364c23559 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -1063,11 +1063,7 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) } if (!(f = sys_fopen(fbuf, "w"))) - { - //fprintf(stderr, "open: "); - sys_unixerror(fbuf); goto fail; - } for (ap = x->b_vec, indx = x->b_n; indx--; ap++) { int length; @@ -1079,10 +1075,7 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) if (ep - bp < length) { if (fwrite(sbuf, bp-sbuf, 1, f) < 1) - { - sys_unixerror(fbuf); goto fail; - } bp = sbuf; } if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) && @@ -1106,17 +1099,11 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) } } if (fwrite(sbuf, bp-sbuf, 1, f) < 1) - { - sys_unixerror(fbuf); goto fail; - } if (fflush(f) != 0) - { - sys_unixerror(fbuf); goto fail; - } if (deleteit) binbuf_free(x); diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index 4d8c83388..f753d3164 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -591,10 +591,6 @@ EXTERN void bug(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); EXTERN void pd_error(void *object, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); EXTERN void logpost(const void *object, const int level, const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4); -EXTERN void sys_logerror(const char *object, const char *s); -EXTERN void sys_unixerror(const char *object); -EXTERN void sys_ouch(void); - /* ------------ system interface routines ------------------- */ EXTERN int sys_isreadablefile(const char *name); diff --git a/pd/src/s_print.c b/pd/src/s_print.c index 363bf3ea5..2d034de4d 100644 --- a/pd/src/s_print.c +++ b/pd/src/s_print.c @@ -312,24 +312,8 @@ void bug(const char *fmt, ...) dopost(buf); } - /* this isn't worked out yet. */ -static const char *errobject; -static const char *errstring; - -void sys_logerror(const char *object, const char *s) -{ - errobject = object; - errstring = s; -} - -void sys_unixerror(const char *object) -{ - errobject = object; - errstring = strerror(errno); -} - -void sys_ouch(void) -{ - if (*errobject) error("%s: %s", errobject, errstring); - else error("%s", errstring); -} + /* don't use these. They're included for binary compatibility with + old externs but never worked and now do nothing. */ +void sys_logerror(const char *object, const char *s) {} +void sys_unixerror(const char *object) {} +void sys_ouch(void) {}