[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [BusyBox] SH patches.
From:       Erik Andersen <andersen () lineo ! com>
Date:       2000-11-30 22:42:58
[Download RAW message or body]

On Wed Nov 29, 2000 at 04:19:24PM -0500, Gennady Feldman wrote:
> I am attaching two separate patches:
> 1) sh_profile - I know that the code was commented out, but here is the
> working version. Apparently the interface for built-in functions was
> changed, so here is the new working version.(Does . /etc/profile when a
> login shell) sh is still lacking many features but for simple exports
> it's more than enough to initialize sane values for environment
> variables and run a few things.

I have applied a variant on this that does the sourcing in a bit cleaner way
(instead of feeding a ". /etc/profile" to the shell to interpret, I just stuck
the guts of builtin_source into the /etc/profile sourcing routine).  Does the
same thing though.

> 2) sh_prompt - the new code tried to emulate bash prompt in the
> following ways:
>     - sets '$' for regular user and '#' for root
>     - shows last path component and not the whole path. This was
> actually quite annoying esp when you are located deep within the
> directory structure and prompt takes up more than half width of the
> screen (which shows another problem w/ command editing).
>     - added user name and hostname to the prompt (to look like bash
> shell, comes in handy too)

I changed it to use the euid instead of the uid (which is what bash does), and
changed it to use get_last_path_component() from utility.c (no point in
duplicating that code).  Also I changed 
    -user=xmalloc(9);
    +user=xcalloc(sizeof(int), 9);
to ensure that this memory was properly zeroed out, so my_getpwuid would do the
Right Thing.  Otherwise, the string might not be NULL terminated and wierf
things would happen.

 -Erik

--
Erik B. Andersen   email:  andersen@lineo.com
--This message was written using 73% post-consumer electrons--



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic