libspf2
1.2.11
src
libspf2
spf_log_stdio.c
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of either:
4
*
5
* a) The GNU Lesser General Public License as published by the Free
6
* Software Foundation; either version 2.1, or (at your option) any
7
* later version,
8
*
9
* OR
10
*
11
* b) The two-clause BSD license.
12
*
13
* These licenses can be found with the distribution in the file LICENSES
14
*/
15
16
17
#include "
spf_sys_config.h
"
18
19
20
#ifdef STDC_HEADERS
21
# include <stdio.h>
/* stdin / stdout */
22
# include <stdlib.h>
/* malloc / free */
23
#endif
24
25
#include "
spf.h
"
26
33
void
34
SPF_error_stdio
(
const
char
*file,
int
line,
const
char
*errmsg)
35
{
36
char
buf[128];
37
if
(file) {
38
snprintf(buf,
sizeof
(buf),
"%s:%d"
, file, line);
39
fprintf(stderr,
"%-20s Error: %s\n"
, buf, errmsg);
40
}
41
else
{
42
fprintf(stderr,
"Error: %s\n"
, errmsg);
43
}
44
abort();
45
}
46
47
void
48
SPF_warning_stdio
(
const
char
*file,
int
line,
const
char
*errmsg)
49
{
50
char
buf[128];
51
if
(file) {
52
snprintf(buf,
sizeof
(buf),
"%s:%d"
, file, line);
53
fprintf(stderr,
"%-20s Warning: %s\n"
, buf, errmsg);
54
}
55
else
{
56
fprintf(stderr,
"Warning: %s\n"
, errmsg);
57
}
58
}
59
60
void
61
SPF_info_stdio
(
const
char
*file
__attribute__
((unused)),
int
line
__attribute__
((unused)),
const
char
*errmsg)
62
{
63
printf(
"%s\n"
, errmsg);
64
}
65
66
void
67
SPF_debug_stdio
(
const
char
*file,
int
line,
const
char
*errmsg)
68
{
69
char
buf[128];
70
if
(file) {
71
snprintf(buf,
sizeof
(buf),
"%s:%d"
, file, line);
72
fprintf(stderr,
"%-20s Debug: %s\n"
, buf, errmsg);
73
}
74
else
{
75
fprintf(stderr,
"Debug: %s\n"
, errmsg);
76
}
77
}
SPF_debug_stdio
void SPF_debug_stdio(const char *file, int line, const char *errmsg)
Definition:
spf_log_stdio.c:67
__attribute__
#define __attribute__(x)
Definition:
spf.h:17
SPF_warning_stdio
void SPF_warning_stdio(const char *file, int line, const char *errmsg)
Definition:
spf_log_stdio.c:48
spf.h
SPF_error_stdio
void SPF_error_stdio(const char *file, int line, const char *errmsg)
Definition:
spf_log_stdio.c:34
SPF_info_stdio
void SPF_info_stdio(const char *file __attribute__((unused)), int line __attribute__((unused)), const char *errmsg)
Definition:
spf_log_stdio.c:61
spf_sys_config.h
Generated by
1.8.20