with a NUL character, which might occur after using the D command.
From Mohamed Akram
-/* $OpenBSD: process.c,v 1.37 2024/07/17 20:57:16 millert Exp $ */
+/* $OpenBSD: process.c,v 1.38 2024/08/28 14:30:26 millert Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
* and at the end of the line, terminate.
*/
if (match[0].rm_so == match[0].rm_eo) {
- if (*s == '\0' || *s == '\n')
- slen = -1;
- else
- slen--;
- if (*s != '\0') {
+ if (slen > 0) {
cspace(&SS, s++, 1, APPEND);
+ slen--;
le++;
- }
+ } else
+ slen = -1;
lastempty = 1;
} else
lastempty = 0;