Module Name: src Committed By: rillig Date: Fri Oct 8 22:27:52 UTC 2021
Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: use standard error handling for unterminated comment Just writing it to stdout is bad, especially when indent is used in filter mode. Silently continuing after such an error is bad as well. echo '/*' | indent To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/pr_comment.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/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.66 src/usr.bin/indent/pr_comment.c:1.67 --- src/usr.bin/indent/pr_comment.c:1.66 Fri Oct 8 22:22:14 2021 +++ src/usr.bin/indent/pr_comment.c Fri Oct 8 22:27:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.66 2021/10/08 22:22:14 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.67 2021/10/08 22:27:52 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.66 2021/10/08 22:22:14 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.67 2021/10/08 22:27:52 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -226,7 +226,7 @@ process_comment(void) goto end_of_line_comment; if (had_eof) { - printf("Unterminated comment\n"); + diag(1, "Unterminated comment"); dump_line(); return; }