Module Name: src Committed By: rillig Date: Wed Jun 28 13:50:47 UTC 2023
Modified Files: src/usr.bin/xlint/xlint: lint.1 xlint.c Log Message: lint: allow to keep the preprocessor output on success as well To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/xlint/lint.1 cvs rdiff -u -r1.111 -r1.112 src/usr.bin/xlint/xlint/xlint.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/xlint/lint.1 diff -u src/usr.bin/xlint/xlint/lint.1:1.58 src/usr.bin/xlint/xlint/lint.1:1.59 --- src/usr.bin/xlint/xlint/lint.1:1.58 Mon May 22 19:36:13 2023 +++ src/usr.bin/xlint/xlint/lint.1 Wed Jun 28 13:50:47 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: lint.1,v 1.58 2023/05/22 19:36:13 rillig Exp $ +.\" $NetBSD: lint.1,v 1.59 2023/06/28 13:50:47 rillig Exp $ .\" .\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. .\" Copyright (c) 1994, 1995 Jochen Pohl @@ -30,7 +30,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 22, 2023 +.Dd June 28, 2023 .Dt LINT 1 .Os .Sh NAME @@ -594,8 +594,12 @@ option must exist. If this environment variable is undefined, then the default path .Pa /usr/libdata/lint will be used to search for the libraries. -.It Ev LINT_KEEP_CPPOUT_ON_ERROR -If +.It Ev LINT_KEEP_CPPOUT +If set to +.Sq Li yes , +or if set to +.Sq Li on-error +and .Nm exits unsuccessfully, do no delete the output from the C preprocessor, allowing for manual inspection. Index: src/usr.bin/xlint/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.111 src/usr.bin/xlint/xlint/xlint.c:1.112 --- src/usr.bin/xlint/xlint/xlint.c:1.111 Fri Jun 9 13:31:11 2023 +++ src/usr.bin/xlint/xlint/xlint.c Wed Jun 28 13:50:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.111 2023/06/09 13:31:11 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.112 2023/06/28 13:50:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.111 2023/06/09 13:31:11 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.112 2023/06/28 13:50:47 rillig Exp $"); #endif #include <sys/param.h> @@ -211,7 +211,10 @@ terminate(int signo) if (cpp.outfd != -1) (void)close(cpp.outfd); if (cpp.outfile != NULL) { - if (signo != 0 && getenv("LINT_KEEP_CPPOUT_ON_ERROR") != NULL) + const char *keep_env = getenv("LINT_KEEP_CPPOUT"); + bool keep = keep_env != NULL && (strcmp(keep_env, "yes") == 0 + || (strcmp(keep_env, "on-error") == 0 && signo != 0)); + if (keep) (void)printf("lint: preprocessor output kept in %s\n", cpp.outfile); else