freebsd-skq/libexec/getty
danfe 540711b94a 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
2017-02-02 20:30:50 +00:00
..
chat.c
extern.h
getty.8
gettytab.5 Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8) 2017-02-02 20:30:50 +00:00
gettytab.h
init.c
main.c
Makefile
Makefile.depend Add META_MODE support. 2015-06-13 19:20:56 +00:00
pathnames.h
subr.c Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8) 2017-02-02 20:30:50 +00:00
ttys.5