summaryrefslogtreecommitdiffstats
path: root/util/system/err.cpp
diff options
context:
space:
mode:
authormelkov <[email protected]>2022-02-10 16:48:13 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:48:13 +0300
commit438546c8737d5c1fdeb31157dcf999717d930eec (patch)
treed29d229abd2f9f889b9b7eb148d635059dc26acf /util/system/err.cpp
parent96647fad5355ff5ef45a00a6d85c097028584ab0 (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/system/err.cpp')
-rw-r--r--util/system/err.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/util/system/err.cpp b/util/system/err.cpp
index 5573ea1ee94..891d7c0cb61 100644
--- a/util/system/err.cpp
+++ b/util/system/err.cpp
@@ -4,20 +4,20 @@
#include "error.h"
#include <util/generic/scope.h>
-
+
#include <util/stream/printf.h>
#include <util/stream/output.h>
-
+
void vwarnx(const char* fmt, va_list args) {
Cerr << GetProgramName() << ": ";
-
+
if (fmt) {
Printf(Cerr, fmt, args);
}
-
+
Cerr << '\n';
}
-
+
void vwarn(const char* fmt, va_list args) {
int curErrNo = errno;
auto curErrText = LastSystemErrorText();
@@ -25,55 +25,55 @@ void vwarn(const char* fmt, va_list args) {
Y_DEFER {
errno = curErrNo;
};
-
+
Cerr << GetProgramName() << ": ";
-
+
if (fmt) {
Printf(Cerr, fmt, args);
Cerr << ": ";
}
Cerr << curErrText << '\n';
-}
-
+}
+
void warn(const char* fmt, ...) {
va_list args;
-
+
va_start(args, fmt);
vwarn(fmt, args);
va_end(args);
-}
-
+}
+
void warnx(const char* fmt, ...) {
va_list args;
-
+
va_start(args, fmt);
vwarnx(fmt, args);
va_end(args);
-}
-
+}
+
void verr(int status, const char* fmt, va_list args) {
vwarn(fmt, args);
exit(status);
-}
-
+}
+
void err(int status, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
verr(status, fmt, args);
va_end(args);
-}
-
+}
+
void verrx(int status, const char* fmt, va_list args) {
vwarnx(fmt, args);
exit(status);
-}
-
+}
+
void errx(int status, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
verrx(status, fmt, args);
va_end(args);
-}
+}