1 --- bash-2.04-beta5/builtins/mkbuiltins.c.requires Thu Aug 5 12:42:54 1999
2 +++ bash-2.04-beta5/builtins/mkbuiltins.c Sun Mar 19 14:14:17 2000
4 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
6 /* Flag values that builtins can have. */
7 +/* These flags are for the C code generator,
8 + the C which is produced (./builtin.c)
9 + includes the flags definitions found
11 #define BUILTIN_FLAG_SPECIAL 0x01
12 #define BUILTIN_FLAG_ASSIGNMENT 0x02
13 +#define BUILTIN_FLAG_REQUIRES 0x04
15 /* If this stream descriptor is non-zero, then write
16 texinfo documentation to it. */
21 +/* The builtin commands that cause requirements on other files. */
22 +char *requires_builtins[] =
24 + ".", "command", "exec", "source", "inlib",
28 /* Forward declarations. */
29 static int is_special_builtin ();
30 static int is_assignment_builtin ();
31 +static int is_requires_builtin ();
33 #if !defined (HAVE_RENAME)
36 new->flags |= BUILTIN_FLAG_SPECIAL;
37 if (is_assignment_builtin (name))
38 new->flags |= BUILTIN_FLAG_ASSIGNMENT;
39 + if (is_requires_builtin (name))
40 + new->flags |= BUILTIN_FLAG_REQUIRES;
42 array_add ((char *)new, defs->builtins);
44 @@ -1164,10 +1179,11 @@
46 fprintf (structfile, "(Function *)0x0, ");
48 - fprintf (structfile, "%s%s%s, %s_doc,\n",
49 + fprintf (structfile, "%s%s%s%s, %s_doc,\n",
50 "BUILTIN_ENABLED | STATIC_BUILTIN",
51 (builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "",
52 (builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "",
53 + (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "",
54 builtin->docname ? builtin->docname : builtin->name);
57 @@ -1401,6 +1417,13 @@
60 return (_find_in_table (name, assignment_builtins));
64 +is_requires_builtin (name)
67 + return (_find_in_table (name, requires_builtins));
70 #if !defined (HAVE_RENAME)
71 --- bash-2.04-beta5/doc/bash.1.requires Tue Jan 11 19:36:49 2000
72 +++ bash-2.04-beta5/doc/bash.1 Sun Mar 19 14:14:17 2000
78 +Produce the list of files that are required for the
79 +shell script to run. This implies '-n' and is subject
80 +to the same limitations as compile time error checking checking;
81 +Backticks, [] tests, and evals are not parsed so some
82 +dependencies may be missed.
84 Equivalent to \fB\-v\fP.
86 --- bash-2.04-beta5/doc/bashref.texi.requires Wed Jan 12 16:18:50 2000
87 +++ bash-2.04-beta5/doc/bashref.texi Sun Mar 19 14:14:17 2000
88 @@ -4333,6 +4333,13 @@
90 Make the shell a restricted shell (@pxref{The Restricted Shell}).
93 +Produce the list of files that are required for the
94 +shell script to run. This implies '-n' and is subject
95 +to the same limitations as compile time error checking checking;
96 +Backticks, [] tests, and evals are not parsed so some
97 +dependencies may be missed.
100 Equivalent to @samp{-v}. Print shell input lines as they're read.
102 --- bash-2.04-beta5/builtins.h.requires Thu Aug 5 11:18:12 1999
103 +++ bash-2.04-beta5/builtins.h Sun Mar 19 14:14:17 2000
105 #define STATIC_BUILTIN 0x4 /* This builtin is not dynamically loaded. */
106 #define SPECIAL_BUILTIN 0x8 /* This is a Posix `special' builtin. */
107 #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */
108 +#define REQUIRES_BUILTIN 0x20 /* This builtin requires other files. */
110 /* The thing that we build the array of builtins out of. */
112 --- bash-2.04-beta5/make_cmd.c.requires Thu Aug 5 11:21:23 1999
113 +++ bash-2.04-beta5/make_cmd.c Sun Mar 19 14:17:34 2000
118 +#include "builtins.h"
120 +#include "builtins/common.h"
122 #if defined (JOB_CONTROL)
125 extern int line_number, current_command_line_count;
126 extern int disallow_filename_globbing;
127 extern int last_command_exit_value;
128 +extern int rpm_requires;
130 +char *alphabet_set = "abcdefghijklmnopqrstuvwxyz"
131 + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
134 make_bare_word (string)
136 return (make_command (cm_subshell, (SIMPLE_COM *)temp));
140 +output_requirement (file)
143 + if ( (file[0] != '/') || strchr(file, '$')) {
144 + /* if we are not given a full path name we require the basename
145 + otherwise we require the full path. This does not work in the
146 + Win/Dos world but I don't know what to do there.*/
148 + basename = strrchr(file, '/');
156 + if the executable is called via variable substitution we can
157 + not dermine what it is at compile time.
159 + if the executable consists only of characters not in the
160 + alphabet we do not consider it a dependency just an artifact of
161 + shell parsing (ex "exec < ${infile}").
164 + if ( !strchr(file, '$') && strpbrk(file, alphabet_set) ) {
165 + printf ("executable(%s)\n", file);
169 /* Reverse the word list and redirection list in the simple command
170 has just been parsed. It seems simpler to do this here the one
171 time then by any other method that I can think of. */
173 command->value.Simple->redirects =
174 REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
177 + if (rpm_requires && command->value.Simple->words)
183 + cmd0 = command->value.Simple->words->word->word;
184 + b = builtin_address_internal (cmd0, 0);
186 + if (command->value.Simple->words->next) {
187 + cmd1 = command->value.Simple->words->next->word->word;
190 + if ( (b->flags & REQUIRES_BUILTIN) && cmd1){
191 + output_requirement(cmd1);
194 + if (!assignment(cmd0)) {
195 + output_requirement(cmd0);
198 + /* This will not work, the subshell that this runs in does
199 + not get the "requires" commandline argument. */
201 + execute_command(command);
208 --- bash-2.04-beta5/shell.c.requires Fri Nov 19 19:58:15 1999
209 +++ bash-2.04-beta5/shell.c Sun Mar 19 14:14:17 2000
211 /* The name of the .(shell)rc file. */
212 static char *bashrc_file = "~/.bashrc";
214 +/* Non-zero if we are finding the scripts requirements. */
217 /* Non-zero means to act more like the Bourne shell on startup. */
218 static int act_like_sh;
221 { "norc", Int, &no_rc, (char **)0x0 },
222 { "posix", Int, &posixly_correct, (char **)0x0 },
223 { "rcfile", Charp, (int *)0x0, &bashrc_file },
224 + { "rpm-requires", Int, &rpm_requires, (char **)0x0 },
225 #if defined (RESTRICTED_SHELL)
226 { "restricted", Int, &restricted, (char **)0x0 },
230 if (dump_translatable_strings)
231 read_but_dont_execute = 1;
235 + read_but_dont_execute = 1;
236 + initialize_shell_builtins ();
239 if (running_setuid && privileged_mode == 0)
240 disable_priv_mode ();