X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/2614b01da5f5c65d7a80aeef0f65d41fb554fedf..b80802bae4dfeae315236b136d6181198e84d4d7:/error.c?ds=inline diff --git a/error.c b/error.c index bf16504..5f5cbda 100644 --- a/error.c +++ b/error.c @@ -16,6 +16,7 @@ static void do_error(int code, va_list ap) { char error[1024]; char auxbuf[256]; + char c; char *sp, *sp2; wchar_t *wsp; filepos fpos, fpos2; @@ -200,7 +201,20 @@ static void do_error(int code, va_list ap) { sprintf(error, "section headings are not supported within \\%.100s", sp); flags = FILEPOS; - break; + break; + case err_infodirentry: + fpos = *va_arg(ap, filepos *); + sprintf(error, "\\cfg{info-dir-entry} expects at least three" + " parameters"); + flags = FILEPOS; + break; + case err_infonodechar: + fpos = *va_arg(ap, filepos *); + c = (char)va_arg(ap, int); + sprintf(error, "info output format does not support '%c' in" + " node names; removing", c); + flags = FILEPOS; + break; case err_whatever: sp = va_arg(ap, char *); vsprintf(error, sp, ap); @@ -211,7 +225,9 @@ static void do_error(int code, va_list ap) { if (flags & PREFIX) fputs("halibut: ", stderr); if (flags & FILEPOS) { - fprintf(stderr, "%s:%d:", fpos.filename, fpos.line); + fprintf(stderr, "%s:", fpos.filename); + if (fpos.line > 0) + fprintf(stderr, "%d:", fpos.line); if (fpos.col > 0) fprintf(stderr, "%d:", fpos.col); fputc(' ', stderr);