diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-12-03 13:49:42 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-12-03 13:49:42 -0500 |
commit | 055a1bf5bcf1dbc5dd01995adc76ca715eac6700 (patch) | |
tree | 5a81515d30d803598286d1a19cf4b3b5f04e40f5 /variables.c~ | |
parent | f5635ecdc99ad439da0ec65ec8e5e30a3fb0205d (diff) | |
download | bash-055a1bf5bcf1dbc5dd01995adc76ca715eac6700.tar.gz |
commit bash-20050810 snapshot
Diffstat (limited to 'variables.c~')
-rw-r--r-- | variables.c~ | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/variables.c~ b/variables.c~ index 96da7438..35c14f14 100644 --- a/variables.c~ +++ b/variables.c~ @@ -25,8 +25,12 @@ #include "posixtime.h" #if defined (qnx) -# include <sys/vc.h> -#endif +# if defined (qnx6) +# include <sy/netmgr.h> +# else +# include <sys/vc.h> +# endif /* !qnx6 */ +#endif /* qnx */ #if defined (HAVE_UNISTD_H) # include <unistd.h> @@ -70,6 +74,8 @@ #define ifsname(s) ((s)[0] == 'I' && (s)[1] == 'F' && (s)[2] == 'S' && (s)[3] == '\0') +extern char **environ; + /* Variables used here and defined in other files. */ extern int posixly_correct; extern int line_number; @@ -350,7 +356,7 @@ initialize_shell_variables (env, privmode) set_pwd (); /* Set up initial value of $_ */ -#if 1 +#if 0 temp_var = bind_variable ("_", dollar_vars[0], 0); #else temp_var = set_if_not ("_", dollar_vars[0]); @@ -375,7 +381,11 @@ initialize_shell_variables (env, privmode) /* set node id -- don't import it from the environment */ { char node_name[22]; +# if defined (qnx6) + netmgr_ndtostr(ND2S_LOCAL_STR, ND_LOCAL_NODE, node_name, sizeof(node_name)); +# else qnx_nidtostr (getnid (), node_name, sizeof (node_name)); +# endif temp_var = bind_variable ("NODE", node_name, 0); set_auto_export (temp_var); } @@ -1809,7 +1819,7 @@ make_variable_value (var, value, flags) { if (flags & ASS_APPEND) { - oval = value_cell (var); + oval = get_variable_value (var); if (oval == 0) /* paranoia */ oval = ""; olen = STRLEN (oval); @@ -3134,6 +3144,7 @@ do \ { \ export_env_size += 16; \ export_env = strvec_resize (export_env, export_env_size); \ + environ = export_env; \ } \ export_env[export_env_index++] = (do_alloc) ? savestring (envstr) : envstr; \ export_env[export_env_index] = (char *)NULL; \ @@ -3243,6 +3254,7 @@ maybe_make_export_env () { export_env_size = new_size; export_env = strvec_resize (export_env, export_env_size); + environ = export_env; } export_env[export_env_index = 0] = (char *)NULL; @@ -3725,6 +3737,10 @@ static struct name_and_function special_vars[] = { #endif #if defined (READLINE) + { "HOME", sv_home }, +#endif + +#if defined (READLINE) { "HOSTFILE", sv_hostfile }, #endif @@ -3898,6 +3914,18 @@ sv_terminal (name) rl_reset_terminal (get_string_value ("TERM")); } +/* Update the value of HOME in the export environment so tilde expansion will + work on cygwin. */ +sv_home (name) + char *name; +{ + if (interactive_shell && no_line_editing == 0) + { + array_needs_making = 1; + maybe_make_export_env (); + } +} + void sv_hostfile (name) char *name; @@ -3925,6 +3953,7 @@ sv_histsize (name) { char *temp; intmax_t num; + int hmax; temp = get_string_value (name); @@ -3934,7 +3963,8 @@ sv_histsize (name) { if (name[4] == 'S') { - stifle_history (num); + hmax = num; + stifle_history (hmax); num = where_history (); if (history_lines_this_session > num) history_lines_this_session = num; |