mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
error.c: rb_sys_enc_warning
* error.c (rb_sys_enc_warning): new function to show warning and error message with the encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae2d32304b
commit
18db8cea6a
2 changed files with 55 additions and 0 deletions
52
error.c
52
error.c
|
@ -231,6 +231,22 @@ rb_warn(const char *fmt, ...)
|
|||
rb_write_error_str(mesg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
rb_enc_warn(rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
VALUE mesg;
|
||||
va_list args;
|
||||
|
||||
if (NIL_P(ruby_verbose)) return;
|
||||
|
||||
va_start(args, fmt);
|
||||
mesg = warning_string(enc, fmt, args);
|
||||
va_end(args);
|
||||
rb_write_error_str(mesg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* rb_warning() reports only in verbose mode */
|
||||
void
|
||||
rb_warning(const char *fmt, ...)
|
||||
|
@ -246,6 +262,22 @@ rb_warning(const char *fmt, ...)
|
|||
rb_write_error_str(mesg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
rb_enc_warning(rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
VALUE mesg;
|
||||
va_list args;
|
||||
|
||||
if (!RTEST(ruby_verbose)) return;
|
||||
|
||||
va_start(args, fmt);
|
||||
mesg = warning_string(enc, fmt, args);
|
||||
va_end(args);
|
||||
rb_write_error_str(mesg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* warn(msg, ...) -> nil
|
||||
|
@ -2109,6 +2141,26 @@ rb_sys_warning(const char *fmt, ...)
|
|||
errno = errno_save;
|
||||
}
|
||||
|
||||
void
|
||||
rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
VALUE mesg;
|
||||
va_list args;
|
||||
int errno_save;
|
||||
|
||||
errno_save = errno;
|
||||
|
||||
if (!RTEST(ruby_verbose)) return;
|
||||
|
||||
va_start(args, fmt);
|
||||
mesg = warning_string(enc, fmt, args);
|
||||
va_end(args);
|
||||
rb_str_set_len(mesg, RSTRING_LEN(mesg)-1);
|
||||
rb_str_catf(mesg, ": %s\n", strerror(errno_save));
|
||||
rb_write_error_str(mesg);
|
||||
errno = errno_save;
|
||||
}
|
||||
|
||||
void
|
||||
rb_load_fail(VALUE path, const char *err)
|
||||
{
|
||||
|
|
|
@ -627,6 +627,9 @@ VALUE rb_check_backtrace(VALUE);
|
|||
NORETURN(void rb_async_bug_errno(const char *,int));
|
||||
const char *rb_builtin_type_name(int t);
|
||||
const char *rb_builtin_class_name(VALUE x);
|
||||
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
|
||||
/* eval.c */
|
||||
VALUE rb_refinement_module_get_refined_class(VALUE module);
|
||||
|
|
Loading…
Add table
Reference in a new issue