Module Name:    src
Committed By:   kre
Date:           Tue Sep 17 13:34:08 UTC 2024

Modified Files:
        src/usr.bin/sed: process.c

Log Message:
PR lib/58674

When building the tools version of sed, treat all wide characters
as if they occupy just one column for the purposes of sed's 'l'
command (which it is very unlikely to be used from the tools sed).

wdwidth() is another XSI function, not necessarily available everywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/sed/process.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/sed/process.c
diff -u src/usr.bin/sed/process.c:1.53 src/usr.bin/sed/process.c:1.54
--- src/usr.bin/sed/process.c:1.53	Fri May 15 22:39:54 2020
+++ src/usr.bin/sed/process.c	Tue Sep 17 13:34:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: process.c,v 1.53 2020/05/15 22:39:54 christos Exp $	*/
+/*	$NetBSD: process.c,v 1.54 2024/09/17 13:34:08 kre Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,7 +38,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: process.c,v 1.53 2020/05/15 22:39:54 christos Exp $");
+__RCSID("$NetBSD: process.c,v 1.54 2024/09/17 13:34:08 kre Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $");
 #endif
@@ -633,7 +633,11 @@ lputs(char *s, size_t len)
 			fputc('\n', outfile);
 			col = 0;
 		} else if (iswprint(wc)) {
+#ifdef HAVE_NBTOOL_CONFIG_H
+			width = 1;	/* wcwidth is an XSI function */
+#else
 			width = (size_t)wcwidth(wc);
+#endif
 			if (col + width >= termwidth) {
 				fprintf(outfile, "\\\n");
 				col = 0;

Reply via email to