source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: If messages are shown and output is printed without a pager,
@ 2019-07-14 18:16 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-07-14 18:16 UTC (permalink / raw)
  To: source

Log Message:
-----------
If messages are shown and output is printed without a pager, display
a heads-up on stderr at the end because otherwise, users may easily
miss the messages: because messages typically occur while parsing,
they typically preceed the output.  This is most useful with flag
combinations like "-c -W all" but may also help in some unusual
error scenarios.
Inconvenient ordering of output originally pointed out by espie@
for the example situation that /tmp/ is not writeable.

Modified Files:
--------------
    mandoc:
        main.c
        mandoc.h
        mandoc_msg.c

Revision Data
-------------
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.h,v
retrieving revision 1.263
retrieving revision 1.264
diff -Lmandoc.h -Lmandoc.h -u -p -r1.263 -r1.264
--- mandoc.h
+++ mandoc.h
@@ -309,6 +309,7 @@ enum mandoclevel  mandoc_msg_getrc(void)
 void		  mandoc_msg_setrc(enum mandoclevel);
 void		  mandoc_msg(enum mandocerr, int, int, const char *, ...)
 			__attribute__((__format__ (__printf__, 4, 5)));
+void		  mandoc_msg_summary(void);
 void		  mchars_alloc(void);
 void		  mchars_free(void);
 int		  mchars_num2char(const char *, size_t);
Index: main.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/main.c,v
retrieving revision 1.329
retrieving revision 1.330
diff -Lmain.c -Lmain.c -u -p -r1.329 -r1.330
--- main.c
+++ main.c
@@ -727,7 +727,9 @@ out:
 			signum = WSTOPSIG(status);
 		}
 		tag_unlink();
-	}
+	} else if (curp.outtype != OUTT_LINT)
+		mandoc_msg_summary();
+
 	return (int)mandoc_msg_getrc();
 }
 
Index: mandoc_msg.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc_msg.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lmandoc_msg.c -Lmandoc_msg.c -u -p -r1.7 -r1.8
--- mandoc_msg.c
+++ mandoc_msg.c
@@ -355,3 +355,12 @@ mandoc_msg(enum mandocerr t, int line, i
 	}
 	fputc('\n', fileptr);
 }
+
+void
+mandoc_msg_summary(void)
+{
+	if (fileptr != NULL && rc != MANDOCLEVEL_OK)
+		fprintf(fileptr,
+		    "%s: see above the output for %s messages\n",
+		    getprogname(), level_name[rc]);
+}
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-14 18:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-14 18:16 mandoc: If messages are shown and output is printed without a pager, schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).