Page MenuHomeFreeBSD

sh.1: Renew description of case
ClosedPublic

Authored by ziaee on Wed, Sep 9, 6:55 AM.
Tags
None
Referenced Files
F171899285: D59518.id186524.diff
Mon, Sep 14, 10:51 AM
F171876852: D59518.diff
Mon, Sep 14, 6:55 AM
Unknown Object (File)
Sun, Sep 13, 10:18 PM
Unknown Object (File)
Sun, Sep 13, 1:33 PM
Unknown Object (File)
Sun, Sep 13, 11:56 AM
Unknown Object (File)
Sat, Sep 12, 11:49 AM
Unknown Object (File)
Fri, Sep 11, 10:41 PM
Unknown Object (File)
Fri, Sep 11, 5:51 PM
Subscribers

Details

Summary

Case explaination is quite out of date.
I studied what openbsd and netbsd are doing, and try to fix it.

  • show the optional left parenthesis and optional list
  • explain there can be a space or not after the pattern
  • use markup
  • split the paragraphs
  • remove totally unnecessary actually (akshually)
  • import the exit status line from netbsd

While here, remove the '-' from the beginning of this document.

PR: 298329
Fixes: c9afaa63894e ("Add case statement fallthrough")
Fixes: f7a9b7fe3a8d ("Allow a left parenthesis before patterns in case blocks")
Fixes: e00e16ad7f86 ("Allow empty case/esac statements")
MFC after: 3 days

Diff Detail

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

Event Timeline

ziaee requested review of this revision.Wed, Sep 9, 6:55 AM
bcr added a subscriber: bcr.

OK for the manpage, looks good!

This revision is now accepted and ready to land.Wed, Sep 9, 1:28 PM

Looks good!

One note: POSIX also says: After the first match, no more patterns in the case statement shall be expanded .... It may sound obvious, but perhaps we should mention it here as well?

Looks good!

One note: POSIX also says: After the first match, no more patterns in the case statement shall be expanded .... It may sound obvious, but perhaps we should mention it here as well?

The words "in turn" are probably intended to describe this, but may benefit from a few more words.

bin/sh/sh.1
1095–1096

Slightly unfortunate that the document repeats itself now but only for the close parenthesis.

1097

Hmm, I'm not sure we should be describing all optional white space. As noted near the start, the man page isn't intended to be a complete description.

The optional open parenthesis seems useful to include in the syntax as done here (but please do not add anything more about it).

1123–1129

Pre-existing: it's a bit unfortunate to introduce the word "fallthrough" here, since it might be unclear.

The control operator
.Ql Cm ;&
is specified by POSIX, but in practice is not entirely portable.

may be better.

apply jilles feedback, thanks for looking this over everyone!

This revision now requires review to proceed.Fri, Sep 11, 1:27 PM
This revision is now accepted and ready to land.Fri, Sep 11, 7:19 PM
This revision was automatically updated to reflect the committed changes.