[BusyBox] Passing arguments to init when loading the kernel?
Erik Gustavsson
cyrano at algonet.se
Tue Feb 20 18:44:44 UTC 2001
On Tue, 20 Feb 2001, Erik Andersen wrote:
> On Tue Feb 20, 2001 at 06:11:35PM +0100, Erik Gustavsson wrote:
> >
> > Hmmm. No I must admit I hadn't thought of that. I simply noticed that TERM
> > was already set by the kernel and removed it.
> >
> > Ok, last try... Ignores TERM from the environment, also done a little more
> > according to "./docs/style-guide.txt".
> >
>
> Ok, but I don't think we want to completely ignore TERM either. If someone
> decides they want to set TERM=somethingwierd, we don't want to ignore their
> wishes or we still have a reduced case of the original problem. I'll apply
> your patch, but add in this little bit to special case the handling of TERM
> so people _can_ overwrite it, but still get a sane default.
>
> if (strncmp(environ[j], "TERM=", 5))
> environment[i++] = environ[j];
> else {
> snprintf(termType, sizeof(termType) - 1, environ[j]);
> }
>
According to these two code fragments termType is always set to the
correct value:
in console_init():
if ((s = getenv("TERM")) != NULL) {
snprintf(termType, sizeof(termType) - 1, "TERM=%s, s);
}
and ...
/* Force the TERM setting to vt102 for serial console --
* iff TERM is set to linux (the default) */
if (strcmp( termType, "TERM=linux" ) == 0)
snprintf(termType, sizeof(termType) - 1, "TERM=vt102");
So if joe user sets TERM=FlashyTerm2000, termType will have this value, as
will the environment for the init scripts... No need to change the patch.
In fact, I think the change would put "TERM=Linux" back into termType if
BB had changed it to "vt102", would it not?
/cyr
More information about the busybox
mailing list