summaryrefslogtreecommitdiff
path: root/variables.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-07 09:01:57 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-07 09:01:57 -0500
commitf37c27ea61c240c61dc85a1e4cecb585630a305e (patch)
treeab300008d37be86cfb62dc5a185a1fa8a12c4e89 /variables.c
parent258e3d46982f45767c4e5e1cbeb7fcac1bf15d90 (diff)
downloadbash-f37c27ea61c240c61dc85a1e4cecb585630a305e.tar.gz
commit bash-20061221 snapshot
Diffstat (limited to 'variables.c')
-rw-r--r--variables.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/variables.c b/variables.c
index 5fd9d0e9..f8b1d3e2 100644
--- a/variables.c
+++ b/variables.c
@@ -192,6 +192,8 @@ static SHELL_VAR *get_lineno __P((SHELL_VAR *));
static SHELL_VAR *assign_subshell __P((SHELL_VAR *, char *, arrayind_t));
static SHELL_VAR *get_subshell __P((SHELL_VAR *));
+static SHELL_VAR *get_bashpid __P((SHELL_VAR *));
+
#if defined (HISTORY)
static SHELL_VAR *get_histcmd __P((SHELL_VAR *));
#endif
@@ -1272,6 +1274,22 @@ get_subshell (var)
}
static SHELL_VAR *
+get_bashpid (var)
+ SHELL_VAR *var;
+{
+ int pid;
+ char *p;
+
+ pid = getpid ();
+ p = itos (pid);
+
+ FREE (value_cell (var));
+ VSETATTR (var, att_integer|att_readonly);
+ var_setvalue (var, p);
+ return (var);
+}
+
+static SHELL_VAR *
get_bash_command (var)
SHELL_VAR *var;
{
@@ -1452,6 +1470,9 @@ initialize_dynamic_variables ()
INIT_DYNAMIC_VAR ("LINENO", (char *)NULL, get_lineno, assign_lineno);
VSETATTR (v, att_integer);
+ INIT_DYNAMIC_VAR ("BASHPID", (char *)NULL, get_bashpid, null_assign);
+ VSETATTR (v, att_integer|att_readonly);
+
#if defined (HISTORY)
INIT_DYNAMIC_VAR ("HISTCMD", (char *)NULL, get_histcmd, (sh_var_assign_func_t *)NULL);
VSETATTR (v, att_integer);