Hi,

Tilo Stritzky wrote on Tue, May 03, 2022 at 08:45:05AM +0200:
> On 02/05/22 01:46  Tom Smyth wrote:

>> while documenting nsh and its features,
>> I wanted to display the command switches of telnet command inside the
>> manual page for nsh,

> Within more/less you can get a shell by typing:
> |.command
> [pipe + period + command]
> 
> That way you can nest as many manpages as you like in a single terminal.

I have rarely seen worse advice regarding the design and writing of
manual pages.

To start with, Tom's idea of including substantial parts of the text
of one manual page into another one was a bad idea, and he already
admitted as much and settled for a much better solution for his
actual task.

Then, even if your idea worked, it would include the whole manual,
including even headers and footers, and not just the parts Tom asked
for.

Most importantly, the mdoc(7) source code of a manual page obviously
cannot issue less(1) commands.  If it could, that would be a major
security hole in mandoc(1), so massive that it would probably be the
first time ever that a mandoc bug would have to be fixed by an
OpenBSD erratum.  Or would that be a bug in less(1)?  Likely, but
probably an erratum either way.

To go on, for security reasons, the OpenBSD version of less(1) does
not support escaping to a shell.  If you press the "exclamation mark"
key in OpenBSD less(1), it just beeps and does nothing.

Even on Linux, your advice does not work:

   $ uname -a
  Linux login-1 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2
        (2020-11-28) x86_64 GNU/Linux
   $ man man
  [...]
  [ optionally hit the space bar here ]
  [ now type !.ls as you suggested and hit RETURN ]
  /bin/sh: 1: .ls: not found
  !done  (press RETURN)
  [ press the RETURN KEY]
  [...]
  Manual page man(1) line 80 (press h for help or q to quit)
  [ now type !ls (without the dot) and hit RETURN ]
  [ it now displays a list of my files, then ]
  !done  (press RETURN)
  [ press the RETURN KEY]
  [...]
  Manual page man(1) line 80 (press h for help or q to quit)

Of course, even without your "period" (no idea where you got that from),
it does not display anything "inside the manual page" but switches back
and forth between either displaying the manual page or displaying the
result of the shell command.

Please guys, when you provide advice to others on our mailing lists,
you should at least bother to test your own advice before posting.

Yours,
  Ingo

Reply via email to