discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Formatting long commands in examples
@ 2014-12-14  1:15 Warren Block
  2014-12-14  6:53 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Warren Block @ 2014-12-14  1:15 UTC (permalink / raw)
  To: discuss

We've had a request to add long commands with long literal values to a 
man page.

For an example, see the "magic" and "mask" values at 
https://wiki.freebsd.org/QemuUserModeHowTo

.Bd -ragged -offset indent takes some liberties with wrapping the quoted 
literal values, and does not produce a warning.

.Bd -ragged -offset indent
# binmiscctl add mips64elf --interpreter "/usr/local/bin/qemu-mips64-static"
--magic "\\x7f\\x45\\x4c\\x46\\x02\\x02\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x08"
--mask "\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff"
--size 20 --set-enabled
.Ed

That produces an 80-column output like this:

            # binmiscctl add mips64elf --interpreter "/usr/local/bin/qemu-
            mips64-static" --magic
            "\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
            --mask
            "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff
            --size 20 --set-enabled

In addition to the undesirable wrapping of the value in the first line, 
the hex strings are cut off.

.Dl does not like this much, either.  One very long line:

.Dl "# binmiscctl add mips64elf --interpreter \"/usr/local/bin/qemu-mips64-static\" --magic \"\\x7f\\x45\\x4c\\x46\\x02\\x02\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x08\" --mask \"\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff\" --size 20 --set-enabled"

Whether or not the parameter is quoted, it only produces this:

            # binmiscctl add mips64elf --interpreter

There might not be a good way to show these commands.  Is there a "least 
bad" way?  It would be preferable to wrap the long arguments rather than 
silently truncate them.
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-15 23:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-14  1:15 Formatting long commands in examples Warren Block
2014-12-14  6:53 ` Ingo Schwarze
2014-12-15 23:28   ` Warren Block

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).