On Tue, Oct 26, 2021 at 11:56:47PM +0200, Kusalananda Kähäri wrote: > On Tue, Oct 26, 2021 at 12:47:49PM +0200, Axel Kielhorn wrote: [cut] > > Later I get: > > > > sed: 1: "1i .lf 1 contrib/sboxes ...": command i expects \ followed by text > > > This is from another GNU sed convinience feature taht allows you to > insert text with the i command on the same line as the command itself: > > 1i\ .lf 1 > > With POSIX sed, that needs to be written > > 1i\ > .lf 1 > > Now, looking at the Makefile or Makefile.in, at around line 4538 (search > for where DOC_SED is being used), it seems as if someone has tried to > write this properly, with a literal newline and everything. The only > issue is that Make will remove that literal newline, which turns it into > a sed expression that only GNU sed understands. > > DOC_GROFF = $(DOC_SED) -e '1i\ > .lf 1 $<' $< | $(DOC_GROFF_ONLY) > > The above is turned into something like > > LANG=C LC_ALL=C sed -e "...blah blah..." -e '1i\n .lf 1 ...etc.' > > which on my OpenBSD system generates > > sed: 1: "1i\n .lf 1 doc/webpage.ms": extra characters after \ at the > end of i command > > Instead, that line in the Makefile should look like > > DOC_GROFF = $(DOC_SED) -e '1i\' -e '.lf 1 $<' $< | $(DOC_GROFF_ONLY) > > That is, break the single expression string up into two.
Actually, that only makes it work with OpenBSD sed and GNU sed. It still fails with sed: Unrecognized command: .lf 1 doc/webpage.ms when using Plan 9 sed. Not tested with macOS. So it looks like the best bet is to insert a literal newline somehow, after the \ like the Makefile *tries* to do. How to do that properly is unfortunately beyond me as I don't grock Make quoting rules very well. > > I've only tested with OpenBSD sed. > > > > > Sed doesn’t tell me its version but the man pages says March 27, 2017. > > > > Greetings > > > > Axel > > -- > Andreas (Kusalananda) Kähäri > SciLifeLab, NBIS, ICM > Uppsala University, Sweden > > . -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .