00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "spf_sys_config.h"
00018
00019
00020 #ifdef STDC_HEADERS
00021 # include <stdio.h>
00022 # include <stdlib.h>
00023 #endif
00024
00025 #include "spf.h"
00026
00033 void
00034 SPF_error_stdio(const char *file, int line, const char *errmsg)
00035 {
00036 char buf[128];
00037 if (file) {
00038 snprintf(buf, sizeof(buf), "%s:%d", file, line);
00039 fprintf(stderr, "%-20s Error: %s\n", buf, errmsg);
00040 }
00041 else {
00042 fprintf(stderr, "Error: %s\n", errmsg);
00043 }
00044 abort();
00045 }
00046
00047 void
00048 SPF_warning_stdio(const char *file, int line, const char *errmsg)
00049 {
00050 char buf[128];
00051 if (file) {
00052 snprintf(buf, sizeof(buf), "%s:%d", file, line);
00053 fprintf(stderr, "%-20s Warning: %s\n", buf, errmsg);
00054 }
00055 else {
00056 fprintf(stderr, "Warning: %s\n", errmsg);
00057 }
00058 }
00059
00060 void
00061 SPF_info_stdio(const char *file __attribute__((unused)), int line __attribute__((unused)), const char *errmsg)
00062 {
00063 printf("%s\n", errmsg);
00064 }
00065
00066 void
00067 SPF_debug_stdio(const char *file, int line, const char *errmsg)
00068 {
00069 char buf[128];
00070 if (file) {
00071 snprintf(buf, sizeof(buf), "%s:%d", file, line);
00072 fprintf(stderr, "%-20s Debug: %s\n", buf, errmsg);
00073 }
00074 else {
00075 fprintf(stderr, "Debug: %s\n", errmsg);
00076 }
00077 }