HomeFreeBSD

Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)

Description

Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)

There is one capability explicitly documented in gettytab(5) as stupid: he.
And it is indeed. It was meant to facilitate system hostname modification,
but is hardly usable in practice because it allows very limited editing
(e.g., it depends on a particular hostname length, making it non-generic).

Replace it with simple implementation that treats ``he'' as POSIX extended
regular expression which is matched against the hostname. If there are no
parenthesized subexpressions in the pattern, entire matched string is used
as the final hostname. Otherwise, use the first matched subexpression.
If the pattern does not match, the original hostname is not modified.

Using regex(3) gives more freedom, does not complicate the code very much,
and makes a lot more sense, in turn making ``he'' less stupid and actually
useful (e.g., it is now possible to obtain node or domain names from the
original hostname string, without knowing it in advance).

Reviewed by: jilles, manpages (wblock)
Approved by: jilles (implied)
Differential Revision: https://reviews.freebsd.org/D9244

Details

Provenance
danfeAuthored on
Reviewer
jilles
Differential Revision
D9244: Attempt to fix the old "he capability is stupid" bug in getty(8)
Parents
rS313106: Update byacc regression tests to match 20170201.
Branches
Unknown
Tags
Unknown