2 * push - anyone remember TOPS-20?
7 Copyright (C) 1999-2009 Free Software Foundation, Inc.
9 This file is part of GNU Bash.
10 Bash is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 Bash is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with Bash. If not, see <http://www.gnu.org/licenses/>.
31 #include "bashgetopt.h"
38 extern int dollar_dollar_pid
;
39 extern int last_command_exit_value
;
48 xstatus
= EXECUTION_SUCCESS
;
49 reset_internal_getopt ();
50 while ((opt
= internal_getopt (list
, "")) != -1)
61 pid
= make_child (savestring ("push"), 0);
64 builtin_error ("cannot fork: %s", strerror (errno
));
65 return (EXECUTION_FAILURE
);
69 /* Shell variable adjustments: $SHLVL, $$, $PPID, $! */
70 adjust_shell_level (1);
71 dollar_dollar_pid
= getpid ();
74 /* Clean up job control stuff. */
75 stop_making_children ();
76 cleanup_the_pipeline ();
79 last_asynchronous_pid
= NO_PID
;
81 /* Make sure the job control code has the right values for
82 the shell's process group and tty process group, and that
83 the signals are set correctly for job control. */
84 initialize_job_control (0);
85 initialize_job_signals ();
87 /* And read commands until exit. */
89 exit_shell (last_command_exit_value
);
93 stop_pipeline (0, (COMMAND
*)NULL
);
94 xstatus
= wait_for (pid
);
100 "Create child shell.",
102 "Create a child that is an exact duplicate of the running shell",
103 "and wait for it to exit. The $SHLVL, $!, $$, and $PPID variables",
104 "are adjusted in the child. The return value is the exit status",
109 struct builtin push_struct
= {