summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/error.c b/error.c
index 03bc93f0e0..7411e957a8 100644
--- a/error.c
+++ b/error.c
@@ -702,6 +702,32 @@ rb_sys_fail(mesg)
}
void
+#ifdef HAVE_STDARG_PROTOTYPES
+rb_sys_warning(const char *fmt, ...)
+#else
+rb_sys_warning(fmt, va_alist)
+ const char *fmt;
+ va_dcl
+#endif
+{
+ char buf[BUFSIZ];
+ va_list args;
+ int errno_save;
+
+ errno_save = errno;
+
+ if (!RTEST(ruby_verbose)) return;
+
+ snprintf(buf, BUFSIZ, "warning: %s", fmt);
+ snprintf(buf+strlen(buf), BUFSIZ-strlen(buf), ": %s", strerror(errno_save));
+
+ va_init_list(args, fmt);
+ warn_print(buf, args);
+ va_end(args);
+ errno = errno_save;
+}
+
+void
rb_load_fail(path)
char *path;
{