aboutsummaryrefslogtreecommitdiff
path: root/src/logerr.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-08-23 07:41:55 -0300
committerEuAndreh <eu@euandre.org>2021-08-23 07:41:55 -0300
commit35cead0b83da84c037bcf79ce112cb5e59f56b10 (patch)
treec897348af5bf2cad5e122840ba95a198386eff5c /src/logerr.c
parentTODOs.md: Extend description of #task-4e40832e-78cf-fc21-cbf9-2fe00fd3828d (diff)
downloadgistatic-35cead0b83da84c037bcf79ce112cb5e59f56b10.tar.gz
gistatic-35cead0b83da84c037bcf79ce112cb5e59f56b10.tar.xz
src/: Move logerr* functions to src/logerr.{c,h}; forward tarballs_fd to src/tar.c
Diffstat (limited to 'src/logerr.c')
-rw-r--r--src/logerr.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/logerr.c b/src/logerr.c
new file mode 100644
index 0000000..ba27b35
--- /dev/null
+++ b/src/logerr.c
@@ -0,0 +1,64 @@
+#include "config.h"
+#include "logerr.h"
+
+#include <stdio.h>
+
+
+void logerr_file(
+ const char *const s,
+ const char *const msg,
+ const char *const file,
+ const int lineno
+) {
+ fprintf(
+ stderr,
+ "%s:%s:%d: %s: %s\n",
+ PROGNAME,
+ file,
+ lineno,
+ s,
+ msg
+ );
+}
+
+void logerrs_file(
+ const char *const pre,
+ const char *const mid,
+ const char *const post,
+ const char *const msg,
+ const char *const file,
+ const int lineno
+) {
+ fprintf(
+ stderr,
+ "%s:%s:%d: %s%s%s: %s\n",
+ PROGNAME,
+ file,
+ lineno,
+ pre,
+ mid,
+ post,
+ msg
+ );
+}
+
+void logerrl_file(
+ const char *const pre,
+ const size_t mid,
+ const char *const post,
+ const char *const msg,
+ const char *const file,
+ int lineno
+) {
+ fprintf(
+ stderr,
+ "%s:%s:%d: %s%ld%s: %s\n",
+ PROGNAME,
+ file,
+ lineno,
+ pre,
+ mid,
+ post,
+ msg
+ );
+}