aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 927193450..e1d0ece29 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -91,6 +91,7 @@
91#if ENABLE_HUSH_CASE 91#if ENABLE_HUSH_CASE
92# include <fnmatch.h> 92# include <fnmatch.h>
93#endif 93#endif
94#include <sys/utsname.h> /* for setting $HOSTNAME */
94 95
95#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */ 96#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */
96#include "unicode.h" 97#include "unicode.h"
@@ -944,6 +945,7 @@ static const struct built_in_command bltins1[] = {
944 BLTIN("source" , builtin_source , "Run commands in a file"), 945 BLTIN("source" , builtin_source , "Run commands in a file"),
945#endif 946#endif
946 BLTIN("trap" , builtin_trap , "Trap signals"), 947 BLTIN("trap" , builtin_trap , "Trap signals"),
948 BLTIN("true" , builtin_true , NULL),
947 BLTIN("type" , builtin_type , "Show command type"), 949 BLTIN("type" , builtin_type , "Show command type"),
948 BLTIN("ulimit" , shell_builtin_ulimit , "Control resource limits"), 950 BLTIN("ulimit" , shell_builtin_ulimit , "Control resource limits"),
949 BLTIN("umask" , builtin_umask , "Set file creation mask"), 951 BLTIN("umask" , builtin_umask , "Set file creation mask"),
@@ -7785,6 +7787,14 @@ int hush_main(int argc, char **argv)
7785 7787
7786 /* Export PWD */ 7788 /* Export PWD */
7787 set_pwd_var(/*exp:*/ 1); 7789 set_pwd_var(/*exp:*/ 1);
7790
7791#if ENABLE_HUSH_BASH_COMPAT
7792 /* Set (but not export) HOSTNAME unless already set */
7793 if (!get_local_var_value("HOSTNAME")) {
7794 struct utsname uts;
7795 uname(&uts);
7796 set_local_var_from_halves("HOSTNAME", uts.nodename);
7797 }
7788 /* bash also exports SHLVL and _, 7798 /* bash also exports SHLVL and _,
7789 * and sets (but doesn't export) the following variables: 7799 * and sets (but doesn't export) the following variables:
7790 * BASH=/bin/bash 7800 * BASH=/bin/bash
@@ -7793,7 +7803,6 @@ int hush_main(int argc, char **argv)
7793 * HOSTTYPE=i386 7803 * HOSTTYPE=i386
7794 * MACHTYPE=i386-pc-linux-gnu 7804 * MACHTYPE=i386-pc-linux-gnu
7795 * OSTYPE=linux-gnu 7805 * OSTYPE=linux-gnu
7796 * HOSTNAME=<xxxxxxxxxx>
7797 * PPID=<NNNNN> - we also do it elsewhere 7806 * PPID=<NNNNN> - we also do it elsewhere
7798 * EUID=<NNNNN> 7807 * EUID=<NNNNN>
7799 * UID=<NNNNN> 7808 * UID=<NNNNN>
@@ -7821,6 +7830,7 @@ int hush_main(int argc, char **argv)
7821 * PS2='> ' 7830 * PS2='> '
7822 * PS4='+ ' 7831 * PS4='+ '
7823 */ 7832 */
7833#endif
7824 7834
7825#if ENABLE_FEATURE_EDITING 7835#if ENABLE_FEATURE_EDITING
7826 G.line_input_state = new_line_input_t(FOR_SHELL); 7836 G.line_input_state = new_line_input_t(FOR_SHELL);