[U-Boot-Users] Delete all env vars except read onlys

Wolfgang Denk
2008-02-13T22:38:28Z

In message <200802130921.38894.matthias.fuchs@esd-electronics.com> you wrote:
>
> what about a 'scrubenv' or 'cleanenv' command that tries to unset all
> variables leaving readonlys untouched.

Make this "clearenv", please.

> The command could request a confirmation:

No.

> => scrubenv
> Do you really want to do this ('yes' or 'no')? yes

No. Such code will not go into U-Boot.

"UNIX was not designed to stop you from doing stupid things, because
that would also stop you from doing clever things." - Doug Gwyn

> Can't overwrite "serial#"
> Can't overwrite "ethaddr"

I would not print such messages, especially since you aren't
overwriting these. If you want, print a similar warning as used by the
"erase" command for protected flash sectors, i. e. something like:

=> cleanenv
Warning: 5 protected variables will not be cleared
=>

> What do you think?

Looks good to me...

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Voodoo Programming: Things programmers do that they know shouldn't
work but they try anyway, and which sometimes actually work, such as
recompiling everything. - Karl Lehenbauer