mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
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.
This commit is contained in:
parent
aace55b739
commit
16c326ec07
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.231 2019/07/10 19:38:56 schwarze Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.232 2019/07/14 18:14:27 schwarze Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
* Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
|
||||
@ -698,7 +698,9 @@ out:
|
||||
signum = WSTOPSIG(status);
|
||||
}
|
||||
tag_unlink();
|
||||
}
|
||||
} else if (curp.outtype != OUTT_LINT)
|
||||
mandoc_msg_summary();
|
||||
|
||||
return (int)mandoc_msg_getrc();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mandoc.h,v 1.205 2019/07/10 19:38:56 schwarze Exp $ */
|
||||
/* $OpenBSD: mandoc.h,v 1.206 2019/07/14 18:14:27 schwarze Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
* Copyright (c) 2012-2019 Ingo Schwarze <schwarze@openbsd.org>
|
||||
@ -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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mandoc_msg.c,v 1.5 2019/07/10 19:38:56 schwarze Exp $ */
|
||||
/* $OpenBSD: mandoc_msg.c,v 1.6 2019/07/14 18:14:27 schwarze Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
* Copyright (c) 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
|
||||
@ -353,3 +353,12 @@ mandoc_msg(enum mandocerr t, int line, int col, const char *fmt, ...)
|
||||
}
|
||||
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]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user