diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2017-07-17 08:16:34 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2017-07-17 21:24:41 +0300 |
| commit | 21847a5f851413910516d3b1f1200f7a975f859f (patch) | |
| tree | 6407a08576ee0bec8f86e27b83ab8547ef151c5a /src/input_handler.cc | |
| parent | a9455bf13259080233f1f2f13c034615363e532c (diff) | |
rc man: Avoid undefined behavior on `expr`
Looking up the man page for `index` was failing on systems using
GNU/coreutils. The `:man` command matched whatever page it was given with
the `expr` utility. This tool behaves as expected when it follows strictly
the POSIX standard but the GNU implementation introduces additional commands
(including `index`), about which the standard states:
```
The use of string arguments length, substr, index, or match produces unspecified results.
```
As a result, parsing the man page number is now implemented with pure
shell expansions, to avoid triggering an undefined behavior when the topic
searched is one of the keywords above.
Diffstat (limited to 'src/input_handler.cc')
0 files changed, 0 insertions, 0 deletions
