mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
Implement actual error handling for builtin_printf. Fix the tests.
This commit is contained in:
12
common.cpp
12
common.cpp
@@ -471,15 +471,21 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig)
|
||||
return result;
|
||||
}
|
||||
|
||||
void append_format(wcstring &str, const wchar_t *format, ...)
|
||||
void append_formatv(wcstring &str, const wchar_t *format, va_list ap)
|
||||
{
|
||||
/* Preserve errno across this call since it likes to stomp on it */
|
||||
int err = errno;
|
||||
str.append(vformat_string(format, ap));
|
||||
errno = err;
|
||||
|
||||
}
|
||||
|
||||
void append_format(wcstring &str, const wchar_t *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
str.append(vformat_string(format, va));
|
||||
append_formatv(str, format, va);
|
||||
va_end(va);
|
||||
errno = err;
|
||||
}
|
||||
|
||||
wchar_t *wcsvarname(const wchar_t *str)
|
||||
|
||||
Reference in New Issue
Block a user