Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
[PATCH] ash history
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Jun 3, 2018
1 parent 5f0f9e0 commit e5e089c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/libbb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2043,12 +2043,12 @@ extern struct globals *const ptr_to_globals;
* use bb_default_login_shell and following defines.
* If you change LIBBB_DEFAULT_LOGIN_SHELL,
* don't forget to change increment constant. */
#define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh"
#define LIBBB_DEFAULT_LOGIN_SHELL "-/sbin/sh"
extern const char bb_default_login_shell[] ALIGN1;
/* "/bin/sh" */
#define DEFAULT_SHELL (bb_default_login_shell+1)
/* "sh" */
#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6)
#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+7)

/* The following devices are the same on all systems. */
#define CURRENT_TTY "/dev/tty"
Expand Down
2 changes: 1 addition & 1 deletion init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
/* Make sure environs is set to something sane */
putenv((char *) "HOME=/");
putenv((char *) bb_PATH_root_path);
putenv((char *) "SHELL=/bin/sh");
putenv((char *) "SHELL=/sbin/sh");
putenv((char *) "USER=root"); /* needed? why? */

if (argv[1])
Expand Down
8 changes: 6 additions & 2 deletions shell/ash.c
Original file line number Diff line number Diff line change
Expand Up @@ -13749,7 +13749,7 @@ procargs(char **argv)
int login_sh;

xargv = argv;
login_sh = xargv[0] && xargv[0][0] == '-';
login_sh = 1; /* = xargv[0] && xargv[0][0] == '-'; - make always true for Android */
arg0 = xargv[0];
/* if (xargv[0]) - mmm, this is always true! */
xargv++;
Expand Down Expand Up @@ -13921,7 +13921,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
const char *hp;

state = 1;
read_profile("/etc/profile");
read_profile("/system/etc/profile");
state1:
state = 2;
hp = lookupvar("HOME");
Expand Down Expand Up @@ -13959,6 +13959,9 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
if (iflag) {
const char *hp = lookupvar("HISTFILE");
if (!hp) {
#ifdef __ANDROID__
setvar("HISTFILE", "/mnt/sdcard/ash_history", 0);
#else
hp = lookupvar("HOME");
if (hp) {
INT_OFF;
Expand All @@ -13968,6 +13971,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
INT_ON;
hp = lookupvar("HISTFILE");
}
#endif
}
if (hp)
line_input_state->hist_file = hp;
Expand Down

0 comments on commit e5e089c

Please sign in to comment.