diff options
Diffstat (limited to 'src/diag.c')
-rw-r--r-- | src/diag.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -1,4 +1,4 @@ -/* grecs - Gray's Extensible Configuration System +/* argot - Gray's Extensible Configuration System Copyright (C) 2007-2016 Sergey Poznyakoff Grecs is free software; you can redistribute it and/or modify it @@ -17,14 +17,14 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif -#include <grecs.h> +#include <argot.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> static void -default_print_diag(grecs_locus_t const *locus, int err, int errcode, +default_print_diag(argot_locus_t const *locus, int err, int errcode, const char *msg) { fflush(stdout); @@ -41,63 +41,63 @@ default_print_diag(grecs_locus_t const *locus, int err, int errcode, fputc('\n', stderr); } -void (*grecs_print_diag_fun)(grecs_locus_t const *, int, int, +void (*argot_print_diag_fun)(argot_locus_t const *, int, int, const char *msg) = default_print_diag; void -grecs_warning(grecs_locus_t const *locus, int errcode, const char *fmt, ...) +argot_warning(argot_locus_t const *locus, int errcode, const char *fmt, ...) { va_list ap; char *buf = NULL; size_t size = 0; va_start(ap, fmt); - if (grecs_vasprintf(&buf, &size, fmt, ap)) - grecs_alloc_die(); + if (argot_vasprintf(&buf, &size, fmt, ap)) + argot_alloc_die(); va_end(ap); - grecs_print_diag_fun(locus, 0, errcode, buf); + argot_print_diag_fun(locus, 0, errcode, buf); free(buf); } void -grecs_error(grecs_locus_t const *locus, int errcode, const char *fmt, ...) +argot_error(argot_locus_t const *locus, int errcode, const char *fmt, ...) { va_list ap; char *buf = NULL; size_t size = 0; va_start(ap, fmt); - if (grecs_vasprintf(&buf, &size, fmt, ap)) - grecs_alloc_die(); + if (argot_vasprintf(&buf, &size, fmt, ap)) + argot_alloc_die(); va_end(ap); - grecs_print_diag_fun(locus, 1, errcode, buf); + argot_print_diag_fun(locus, 1, errcode, buf); free(buf); - grecs_error_count++; + argot_error_count++; } int -grecs_asprint_locus(char **locstr, size_t *size, grecs_locus_t const *locus) +argot_asprint_locus(char **locstr, size_t *size, argot_locus_t const *locus) { int rc; if (locus->beg.col == 0) - rc = grecs_asprintf(locstr, size, "%s:%u", + rc = argot_asprintf(locstr, size, "%s:%u", locus->beg.file, locus->beg.line); else if (strcmp(locus->beg.file, locus->end.file)) - rc = grecs_asprintf(locstr, size, "%s:%u.%u-%s:%u.%u", + rc = argot_asprintf(locstr, size, "%s:%u.%u-%s:%u.%u", locus->beg.file, locus->beg.line, locus->beg.col, locus->end.file, locus->end.line, locus->end.col); else if (locus->beg.line != locus->end.line) - rc = grecs_asprintf(locstr, size, "%s:%u.%u-%u.%u", + rc = argot_asprintf(locstr, size, "%s:%u.%u-%u.%u", locus->beg.file, locus->beg.line, locus->beg.col, locus->end.line, locus->end.col); else - rc = grecs_asprintf(locstr, size, "%s:%u.%u-%u", + rc = argot_asprintf(locstr, size, "%s:%u.%u-%u", locus->beg.file, locus->beg.line, locus->beg.col, locus->end.col); |