[BusyBox] telnetd from inetd, and login prompt
Erik Andersen
andersen at codepoet.org
Tue Jan 21 00:18:05 UTC 2003
On Tue Jan 21, 2003 at 01:33:29PM +1100, Glenn McGrath wrote:
> I have a patch that got sent to me directly from Bastian Blank, it
> allows telnet to run from inetd, and presents a login prompt of login is
> configured.
>
> It addss a print_login_issue function which replaces code in getty.c, it
> isnt a complete replacement though, some new options are enabled and
> others are not. I dont know how important these options are.
>
> The patch is at
> http://people.debian.org/~bug1/busybox/telnetd.diff.gz
>
> Comments anyone ?
clearly using strftime for 'd' and 't' is a big win over the
rubbish inside getty.c. The 'b' option was pretty meaningless --
if you are on a serial console and you can read anything at all
then you already know the baud rate. Losing 'u' and 'U' is also
no great loss imho. The patch looks good to me.
The only downside to the patch at all is the telnetd is getting
to be quite unreadable due to ifdefs. I believe rmk has a good
solution for that in the arm port of the linux kernel, where he
stuffs zillions of ifdefs into a header file
(linux/include/asm-arm/mach-types.h) that defines macros such as
machine_is_foo() that that when that option is disabled, the
macro is just
#define machine_is_foo() (0)
which causes the gcc optimizer to optimize away the entire
conditional. One of these days I should experiment with auto
generating these type of macros for each enabled feature...
Then when we write code, instead of sprinkling ifdefs all over
the place, such as:
if (w < 0) {
#ifdef CONFIG_FEATURE_TELNETD_INETD
exit(0);
#else /* CONFIG_FEATURE_TELNETD_INETD */
<more stuff>
if we were to autogenerate a header file somewhere containing
stuff such as:
#ifdef CONFIG_FEATURE_TELNETD_INETD
# define feature_telnetd_inetd_is_enabled() (1)
#else
# define feature_telnetd_inetd_is_enabled() (0)
#endif
then we could write cleaner and more legible code such as:
if (w < 0) {
if (feature_telnetd_inetd_is_enabled())
exit(0);
<more stuff>
which would still cause the compiler to throw away stuff when we
it isn't enabled. Just thinking out loud. Anyways, sure, that
patch looks fine to me...
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
More information about the busybox
mailing list