Subject: bug#78882: stty.c compilation error

From: Bruno Haible <[email-masked]>
Date: Mon, 23 Jun 2025 23:58:36 +0200

H. Peter Anvin wrote:
> Do the shells on these systems support $'\n' constants?

Sure. Dollar-single-quote strings in sh are quote portable.

> There is also the option of simply putting a newline in the string, I 
> believe.

The best way to include a newline in a sed script is not to use a
literal newline directly, but rather to use backslash-newline,
and start a new -e argument for the second line. [1][2]

But this is, IMO, an inordinate amount of workarounds, for using
'sed' on an input file that contains a list of numbers, one per line.
It's better to put the 'sed' script in a separate file and invoke
sed with one '-f' option instead of with several '-e' options.

Another maintainable approach, which does not require a separate
file, is the simple 'while' loop in the patch that I'm proposing.

Bruno

[1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/sed.html
[2] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Limitations-of-Usual-Tools.html