Page MenuHomeFreeBSD

bhyve.8: Fix style
Needs ReviewPublic

Authored by 0mp on Fri, Jun 12, 12:48 PM.

Details

Reviewers
bnovkov
bcr
Group Reviewers
bhyve
manpages
Summary
  • Use Ar instead of Em for command-line arguments.
  • Add -n to synopsis.
  • Fix mandoc -T lint warnings.

MFC after: 2 weeks
MFC with: 23c99b64918eddb6084ffe4347faf95f82661c47

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73850
Build 70733: arc lint + arc unit

Event Timeline

0mp requested review of this revision.Fri, Jun 12, 12:48 PM

this is actually a herculean task, and i applaud you for undertaking it. here's a few examples of how this should look plus supporting documentation.

usr.sbin/bhyve/bhyve.8
34

if we're fixing the style this is a perfect time to do this, these should not be quoted because this confuses people. Nd takes the rest of the line as an argument.

84

the hypen is not the command modifier. vcpu is also not a flexible argument. the entire -vcpu is the command modifier. the colon is also not a command modifier. it does not modify the command, it is a required part of it. note the way this renders is quite different, and this is also important for making apropos useful.

here's the extended documentation for mdoc(7) on the Cm macro for more details: https://mandoc.bsd.lv/mdoc/style/commands.html

360

same as above

362

N is the part that is a variable argument, vcpu is part of the fixed syntax

usr.sbin/bhyve/bhyve.8
84

P.S. with this many Ns's it might be wise to use Sm off above instead

0mp marked 4 inline comments as done.Sat, Jun 13, 10:32 AM
0mp added inline comments.
usr.sbin/bhyve/bhyve.8
34

Good catch!

84
	if (sscanf(opt, "%d-%d:%d-%d", &vcpu_first, &vcpu_last, &pcpu_first, &pcpu_last) == 4) {
		if (vcpu_first > vcpu_last || pcpu_first > pcpu_last) {
			fprintf(stderr, "invalid range (must be ascending): %s\n", opt);
			return (-1);
		}
		if ((vcpu_last - vcpu_first) != (pcpu_last - pcpu_first)) {
			fprintf(stderr, "range sizes do not match: %s\n", opt);
			return (-1);
		}

vcpu is not a command modifier. An example of a -p use is: -p 0-3:12-15.

: is a command modifier because it is a required part of the string the you pass to a command. The logic I always apply in those cases is _if it is a string that is a part of a command's syntax and it is not variable I can style with Ar, then Cm should be used._. This is also what we document in style.mdoc(7).