Add stuff to butCmd para so that constructs like \c don't break inside
[sgt/halibut] / error.c
diff --git a/error.c b/error.c
index e9c681a..5819e00 100644 (file)
--- a/error.c
+++ b/error.c
@@ -194,9 +194,11 @@ static void do_error(int code, va_list ap) {
        sprintf(error, "\\lcont is only expected after a list item");
        flags = FILEPOS;
        break;
-      case err_sectmarkerinlcont:
+      case err_sectmarkerinblock:
        fpos = *va_arg(ap, filepos *);
-       sprintf(error, "section headings are not supported within \\lcont");
+       sp = va_arg(ap, char *);
+       sprintf(error, "section headings are not supported within \\%.100s",
+               sp);
        flags = FILEPOS;
        break; 
       case err_whatever:
@@ -209,7 +211,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);