65 for (
const char *p = message; *p !=
'\0'; ++p) {
68 const int rc = fprintf(stderr,
"\\%03o", (
unsigned)*p);
75 const int rc = putc(*p, stderr);
90 int rc = vsnprintf(
NULL, 0, fmt, args2);
93 fprintf(stderr,
"%s: vsnprintf failure\n", __func__);
96 bufsz = (size_t)rc + 1;
100 char *buf =
malloc(bufsz);
102 fprintf(stderr,
"%s: could not allocate memory\n", __func__);
110 (void)errf(level ==
AGERR ?
"Error" :
"Warning");
115 int rc = vsnprintf(buf, bufsz, fmt, args);
118 fprintf(stderr,
"%s: vsnprintf failure\n", __func__);
145 out(level, fmt, args);
static agusererrf usererrf
static void out(agerrlevel_t level, const char *fmt, va_list args)
Report messages using a user-supplied or default write function.
static agerrlevel_t agerrlevel
static int default_usererrf(char *message)
default error reporting implementation
static agerrlevel_t agerrno
static agxbuf last
last message
static int agerr_va(agerrlevel_t level, const char *fmt, va_list args)
static void agxbclear(agxbuf *xb)
resets pointer to data
static int vagxbprint(agxbuf *xb, const char *fmt, va_list ap)
vprintf-style output to an agxbuf
static char * agxbdisown(agxbuf *xb)
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
agerrlevel_t agseterr(agerrlevel_t lvl)
agusererrf agseterrf(agusererrf newf)
int agerr(agerrlevel_t level, const char *fmt,...)
int(* agusererrf)(char *)
replacements for ctype.h functions
static bool gv_iscntrl(int c)
static bool gv_isspace(int c)
Arithmetic helper functions.
static int imax(int a, int b)
maximum of two integers
static bool streq(const char *a, const char *b)
are a and b equal?