Update of /cvsroot/winbash/winbash
In directory usw-pr-cvs1:/tmp/cvs-serv6262
Modified Files:
.build MANIFEST NEWS README bashhist.c bashhist.h bashline.c
config.h cpp-Makefile error.c execute_cmd.c expr.c input.c
input.h jobs.c jobs.h newversion.c nojobs.c parse.y shell.c
shell.h siglist.c siglist.h subst.c test.c trap.c variables.c
variables.h version.h
Log Message:
Major realignment to 1.14.7
Index: .build
===================================================================
RCS file: /cvsroot/winbash/winbash/.build,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- .build 11 Mar 2002 04:56:11 -0000 1.9
+++ .build 11 Mar 2002 14:32:11 -0000 1.10
@@ -1 +1 @@
-1
+5
Index: MANIFEST
===================================================================
RCS file: /cvsroot/winbash/winbash/MANIFEST,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- MANIFEST 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ MANIFEST 11 Mar 2002 14:32:12 -0000 1.2
@@ -274,7 +274,6 @@
CWRU/misc/open-files.c f
CWRU/misc/sigs.c f
CWRU/misc/pid.c f
-CWRU/misc/printenv f
CWRU/misc/sigstat.c f
CWRU/misc/bison f
CWRU/misc/aux-mach-desc f
@@ -304,6 +303,7 @@
documentation/article.txt f
support/cat-s f
support/mksysdefs f
+support/printenv f
support/getcppsyms.c f
support/cppmagic f
support/bash.xbm f
Index: NEWS
===================================================================
RCS file: /cvsroot/winbash/winbash/NEWS,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- NEWS 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ NEWS 11 Mar 2002 14:32:12 -0000 1.2
@@ -1,134 +1,10 @@
-This file documents the bugs fixed between this release, bash-1.14.2,
-and the last bash release, 1.14.1.
+This file documents the bugs fixed between this release, bash-1.14.7,
+and the last public bash release, 1.14.6.
1. Bugs fixed in Bash
-a. Command name completion inside command substitution constructs now
- works.
-
-b. Command word completion now performs tilde expansion to avoid passing
- filenames with tildes to stat().
-
-c. Fixed a bug in brace completion that caused core dumps when there was
- only one completion.
-
-d. Fixed `getopts' to work when $# > 9
-
-e. Fixed a typo in getopts which causes OPTIND to be set to bad values.
-
-f. Fixed a bug in `read' which left stray escape characters in strings when
- reading \<newline>
-
-g. Fixed `read' to dequote strings before assigning them to variables if any
- backslash-escaped characters were read.
-
-h. Fixed a memory leak in `read' when no variable names were supplied.
-
-i. Changed calls to signal() that installed a handler to set_signal_handler().
-
-j. Fixed a Makefile problem so that $(CC) is passed to makes in all library
- subdirectories.
-
-k. Fixed a typo in cpp-Makefile which prevented `bashbug' from installing
-
-l. Fixed a bug in the input buffering code which occasionally caused the
- fd bash was using to read a script to be closed unexpectedly.
-
-m. Fixed a bug in the job control code which caused core dumps when commands
- were run from a SIGCHLD trap
-
-n. Fixed a bug in the job control code so that script jobs dying due to
- SIGINT don't make the shell think it got a SIGINT also
-
-o. Fixes to machine descriptions: SunOS, SVR4.2, SCO, hpux_8, hpux_9, SVR4,
- RiscOS, DG AViiON
-
-p. New machine descriptions: tahoe/4.3BSD, m68k/NetBSD, i860/SVR4,
- tandem/SVR3
-
-q. Fixed an incorrect declaration of sbrk() on hpux_9
-
-r. Added a test for OPENDIR_NOT_ROBUST to the `portbash' scripts
-
-s. Fixed a redundant declaration of sys_siglist on FreeBSD
-
-t. Fixed a bug in the variable assignment code which tried to expand tildes
- in some contexts even if they were quoted
-
-u. Fixed a bug in process substitution that manifested itself on systems
- with /dev/fd and caused the file descriptor to be closed inappropriately
-
-v. Added code to `support/mksysdefs' to compensate for problems in some
- versions of i386 SVR4.2
-
-w. Fixes to the makefiles to make relative paths in `srcdir' work correctly
-
-x. Fixed an off-by-one error in the `test' builtin /dev/fd emulation
-
-y. Fixed a problem with function execution that prevented `break' and
- `continue' from working across `return'
-
-z. Fixed a problem with `bind' that caused problems with readline when
- executed from ~/.bashrc.
-
-aa. Fixed `support/mksysdefs' to run the correct version of `uname' on SCO
-
-2. Bugs fixed in Readline
-
-a. Signal handling was reworked to save and restore the signal mask and
- flags on Posix.1 systems
-
-b. Fixed a problem with skipping comment lines while reading the inputrc
- file
-
-c. Fixed a problem with quoted word break characters in the completion code
-
-d. Fixes to the display line wrapping code when using prompts with
- invisible characters
-
-e. Fixed problems with horizontal scrolling when using prompts with
- invisible characters
-
-f. A few problems which made the display code slower than necessary have
- been fixed.
-
-g. Fixed a problem with redisplay after a SIGWINCH was received, especially
- with multi-line prompts.
-
-h. The readline texinfo manual was thoroughly overhauled and all known
- mistakes fixed.
-
-i. Fixed a off-by-one error in the history buffer allocation code that
- sometimes caused the GNU malloc to abort
-
-j. Fixed a typo in the typedef declaring the history state structure
-
-k. Fixed readline to bind the arrow keys to default values after the
- inputrc and termcap capabilities are tested, not before
-
-l. Functions missing correct prologues were fixed.
-
-m. Fixed a bug that made readline misbehave after a command's output was
- flushed with ^O
-
-n. Fixed the tty code to call the functions that reset the meta key
- and keypad before putting the terminal driver back into icanon mode
-
-3. New Features in Bash
-
-[none]
-
-4. New Features in Readline
-
-a. `insert-last-argument' now a standard part of the readline library
-
-b. Quoting of filenames by the completer may now be disabled by completion
- functions.
-
-c. Readline now uses the last column on terminals supporting autowrap
-
-d. Readline now sets up the 8-bit input and output defaults based on the
- value of $LC_CTYPE
-
-e. `history_stifled' variable replaced with history_is_stifled() function
+a. A memory leak that caused long-running scripts to eventually consume
+ all available memory was fixed.
+b. A sign-extension bug that caused a security hole for non-interactive
+ shells was fixed.
Index: README
===================================================================
RCS file: /cvsroot/winbash/winbash/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README 11 Mar 2002 01:47:04 -0000 1.2
+++ README 11 Mar 2002 14:32:12 -0000 1.3
@@ -1,25 +1,52 @@
-This is the source for the version of bash for win32 that we use here at
-Motive. I believe this version of bash was originally ported by our very own
-FAQ - a set of frequently-asked questions about Bash with answers
-Jerry Frain during his banner days at Tivoli. Since then, another Tivoli
-alumni and motive superstar, Enrico Brunetta, has also added functionality and
-fixed bugs in this source. Who knows who else has had their hands in this....
+This README file is in -*- text -*- mode, because Emacs likes it that way.
-Things of interest...
+This is GNU Bash, version 1.14. Bash is the GNU Project's Bourne
+Again SHell, an interactive shell with Bourne shell syntax (/bin/sh);
+but also with interactive command line editing, job control on
+architectures that support it, Csh-like history features and brace
+expansion, and a slew of other stuff. For more information on the
+features of Bash that are new to this type of shell, see the file
+`documentation/features.texi'. There is also a DVI file there, as
+well as a large man page.
-Debugging - there is currently no dev studio project here, just makefiles.
-However, a debug version and pdb are generated by default. To have bash start
-from a debugger when it is run, add the entries found in debug.reg to your
-registry. This will cause windows to start bash from the debugger you specify
-(note that you may need to specify a full path).
+To compile it, try typing `make'. Bash auto-configures the build
+process, so no intervention should be necessary. If you want to
+use gcc, type `make CC=gcc CPPNAME='$(CC) -E''.
-If you want to build a release version of bash (no debugging symbols), just
-use 'make RELEASE=1'
+You may want to read the file INSTALL in this directory for more
+information if the make fails.
--------------------------------------------------------------------------------
-Last Modified: $Date$ [$Author$]
+If you are a csh user and wish to convert your csh aliases to Bash
+aliases, you may wish to use the script in examples/alias-conv.sh
+as a starting point.
-===============================================================================
-local variables:
-mode: text
-end:
+Bug reports for 1.14 should be sent to:
+
+ bug...@pr...
+
+using the `bashbug' program that is built and installed at the same
+time as bash.
+
+The discussion list "bug...@pr..." often contains information
+about new ports of Bash, or discussions of new features or behavior
+changes that people would like. This mailing list is also available
+as a usenet newsgroup: gnu.bash.bug.
+
+When you send a bug report to bas...@pr..., please
+include:
+
+ * the version number of Bash
+ * the machine and OS that it is running on (see .machine or .made)
+ * a description of the bug
+ * a recipe for recreating the bug reliably
+ * a fix for the bug if you have one!
+
+The `bashbug' program includes much of this automatically.
+
+While the Bash maintainers do not promise to fix all bugs, we would
+like this shell to be the best that we can make it.
+
+Enjoy!
+
+Chet Ramey
+c...@po...
Index: bashhist.c
===================================================================
RCS file: /cvsroot/winbash/winbash/bashhist.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bashhist.c 10 Mar 2002 23:25:31 -0000 1.3
+++ bashhist.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -33,7 +33,7 @@
/* Non-zero means to remember lines typed to the shell on the history
list. This is different than the user-controlled behaviour; this
becomes zero when we read lines from a file, for example. */
-/* int remember_on_history = 1; */
+//int remember_on_history = 1;
/* The number of lines that Bash has added to this history session. */
int history_lines_this_session = 0;
@@ -43,7 +43,7 @@
/* Non-zero means do no history expansion on this line, regardless
of what history_expansion says. */
-/* int history_expansion_inhibited = 0; */
+//int history_expansion_inhibited = 0;
/* By default, every line is saved in the history individually. I.e.,
if the user enters:
@@ -82,6 +82,7 @@
int history_control = 0;
/* Variables declared in other files used here. */
+//extern int interactive;
extern int current_command_line_count;
extern int delimiter_depth;
Index: bashhist.h
===================================================================
RCS file: /cvsroot/winbash/winbash/bashhist.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bashhist.h 10 Mar 2002 21:45:13 -0000 1.2
+++ bashhist.h 11 Mar 2002 14:32:12 -0000 1.3
@@ -21,7 +21,7 @@
#if !defined (__BASHHIST_H__)
#define __BASHHIST_H__
-/* extern int remember_on_history; */
+//extern int remember_on_history;
extern int history_lines_this_session;
extern int history_lines_in_file;
extern int history_expansion;
@@ -29,7 +29,7 @@
extern int command_oriented_history;
# if defined (BANG_HISTORY)
-/* extern int history_expansion_inhibited; */
+//extern int history_expansion_inhibited;
# endif /* BANG_HISTORY */
extern void load_history ();
Index: bashline.c
===================================================================
RCS file: /cvsroot/winbash/winbash/bashline.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bashline.c 11 Mar 2002 04:50:29 -0000 1.3
+++ bashline.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -182,11 +182,10 @@
off this occasionally confusing behaviour. */
rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
-
#if defined (VI_MODE)
rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
#endif
-
+
#if defined (BRACE_COMPLETION)
rl_add_defun ("complete-into-braces", bash_brace_completion, -1);
rl_bind_key_in_map ('{', bash_brace_completion, emacs_meta_keymap);
@@ -396,18 +395,18 @@
initialize_hostname_list ()
{
// char *temp;
-
+//
// temp = get_string_value ("HOSTFILE");
// if (!temp)
// temp = get_string_value ("hostname_completion_file");
-
- //if (!temp)
- // temp = ETCHOSTS;
-
- //snarf_hosts_from_file (temp);
+// if (!temp)
+// temp = ETCHOSTS;
+//
+// snarf_hosts_from_file (temp);
+
doEnumHosts(NULL);
sort_hostname_list ();
-
+
if (hostname_list)
hostname_list_initialized++;
}
@@ -669,7 +668,6 @@
sort_hostname_list ();
for(i=0;i<strlen(text);i++)
text[i] = toupper(text[i]);
-
/* The list is sorted. Do a binary search on it for the first character
in TEXT, and then grovel the names of interest. */
Index: config.h
===================================================================
RCS file: /cvsroot/winbash/winbash/config.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- config.h 10 Mar 2002 23:25:31 -0000 1.2
+++ config.h 11 Mar 2002 14:32:12 -0000 1.3
@@ -37,7 +37,7 @@
/* Define JOB_CONTROL if your operating system supports
BSD-like job control. */
-/* #define JOB_CONTROL */
+//#define JOB_CONTROL
/* Note that vanilla System V machines don't support BSD job control,
although some do support Posix job control. */
@@ -97,17 +97,16 @@
/* this is for NT version 3.5 defaults */
#endif
-
/* The value for PATH when invoking `command -p'. This is only used when
the Posix.2 confstr () function, or CS_PATH define are not present. */
#define STANDARD_UTILS_PATH \
"/bin:/usr/bin:/usr/ucb:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib"
-
+
/* Put system-specific default mail directories here. */
#if defined (__bsdi__) || defined (__FreeBSD__) || defined (__NetBSD__)
# define DEFAULT_MAIL_PATH "/var/mail/"
#endif
-
+
#if !defined (DEFAULT_MAIL_PATH)
#if defined (USG)
# define DEFAULT_MAIL_PATH "/usr/mail/"
@@ -179,7 +178,7 @@
/* Define ONESHOT if you want sh -c 'command' to avoid forking to execute
`command' whenever possible. */
-/* #define ONESHOT */
+//#define ONESHOT
/* Default primary and secondary prompt strings. */
#define PPROMPT "bash\\$ "
Index: cpp-Makefile
===================================================================
RCS file: /cvsroot/winbash/winbash/cpp-Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cpp-Makefile 11 Mar 2002 01:47:04 -0000 1.3
+++ cpp-Makefile 11 Mar 2002 14:32:12 -0000 1.4
@@ -44,7 +44,7 @@
/* Define HAVE_GCC if you have the GNU C compiler. */
/* #define HAVE_GCC */
-#if defined (__GNUC__) && !defined (HAVE_GCC) && !defined (NeXT)
+#if defined (__GNUC__) && !defined (HAVE_GCC) && !defined (GCC_STANDARD)
# define HAVE_GCC
#endif
@@ -1013,7 +1013,7 @@
.made: $(Program) bashbug
cp .machine .made
-$(Program): .build $(OBJECTS) $(LIBDEP) .distribution
+$(Program): .build $(OBJECTS) $(LIBDEP) $(srcdir)/.distribution
$(RM) $@
$(PURIFY) $(CC) $(LDFLAGS) $(LIBRARY_LDFLAGS) -o $(Program) $(OBJECTS) $(LIBRARIES)
ls -l $(Program)
@@ -1083,10 +1083,9 @@
version.o: version.c version.h
-shell.o: shell.c shell.h flags.h shell.c posixstat.h filecntl.h stdc.h \
- $(ENDIAN_HEADER) parser.h
+shell.o: shell.c shell.h flags.h shell.c posixstat.h filecntl.h stdc.h $(ENDIAN_HEADER) parser.h
$(RM) $@
- $(CC) $(CFG_FLAGS) $(CCFLAGS) $(CPPFLAGS) -c $<
+ $(CC) $(CFG_FLAGS) $(CCFLAGS) $(CPPFLAGS) -c $(srcdir)/shell.c
#if !defined (HAVE_WAIT_H)
$(ENDIAN_HEADER): endian.aux
@@ -1100,7 +1099,7 @@
variables.o: variables.c shell.h hash.h flags.h variables.h
$(RM) $@
- $(CC) -c $(CCFLAGS) $(HOSTTYPE_DECL) $(CPPFLAGS) $<
+ $(CC) -c $(CCFLAGS) $(HOSTTYPE_DECL) $(CPPFLAGS) $(srcdir)/variables.c
builtins/libbuiltins.a: $(BUILTIN_OBJS) config.h memalloc.h
build_builtins (libbuiltins.a)
@@ -1467,7 +1466,7 @@
$(SHELL) -c 'f=$(Program)-`cat .distribution`.tar.Z;uuencode $$f $$f | split -800 - uuencoded/$$f.uu.'
newversion.aux: newversion.c
- $(CC) $(CCFLAGS) -o $@ $<
+ $(CC) $(CCFLAGS) -o $@ $(srcdir)/newversion.c
newversion: newversion.aux
$(RM) .build
@@ -1532,7 +1531,7 @@
@$(CC) -o $@ $(SUPPORT_SRC)recho.c
tests check: force $(Program) recho
- @cp recho tests
+ @cp recho $(SUPPORT_SRC)printenv tests
( cd tests ; sh run-all )
/**/# Here is a convenient rule when you arrive at a new site and wish to
Index: error.c
===================================================================
RCS file: /cvsroot/winbash/winbash/error.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- error.c 10 Mar 2002 21:45:13 -0000 1.3
+++ error.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -37,6 +37,7 @@
#include "general.h"
#include "nt_types.h"
+//extern int interactive_shell;
extern char *dollar_vars[];
extern char *shell_name;
extern char *the_current_maintainer;
@@ -163,11 +164,11 @@
format = va_arg (args, char *);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
+
va_end (args);
#if defined (__NT_VC__)
fflush (stderr);
#endif /* __NT_VC__ */
-
if (exit_immediately_on_error)
exit (1);
}
Index: execute_cmd.c
===================================================================
RCS file: /cvsroot/winbash/winbash/execute_cmd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- execute_cmd.c 11 Mar 2002 01:47:04 -0000 1.5
+++ execute_cmd.c 11 Mar 2002 14:32:12 -0000 1.6
@@ -18,7 +18,7 @@
along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#if defined (AIX) && defined (RISC6000) && !defined (__GNUC__)
-#pragma alloca
+ #pragma alloca
#endif /* AIX && RISC6000 && !__GNUC__ */
#if defined (__NT_VC__)
#include <windows.h>
@@ -46,9 +46,9 @@
#endif
[...1247 lines suppressed...]
{
if (!file_to_lose_on)
@@ -3911,7 +3913,7 @@
i = *p_index;
if (!string || (i >= (int)strlen (string)))
- return ((char *) NULL);
+ return ((char *)NULL);
/* Each call to this routine leaves the index pointing at a colon if
there is more to the path. If I is > 0, then increment past the
@@ -3948,7 +3950,7 @@
value = xmalloc (1 + i - start);
strncpy (value, string + start, i - start);
- value[i - start] = '\0';
+ value [i - start] = '\0';
return (value);
}
Index: expr.c
===================================================================
RCS file: /cvsroot/winbash/winbash/expr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- expr.c 11 Mar 2002 01:47:04 -0000 1.3
+++ expr.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -257,7 +257,7 @@
popexp ();
- /* Restore the value of evalbuf so that any subsequent LONGJMP calls
+ /* Restore the value of evalbuf so that any subsequent longjmp calls
will have a valid location to jump to. */
xbcopy ((char *)old_evalbuf, (char *)evalbuf, sizeof (jmp_buf));
Index: input.c
===================================================================
RCS file: /cvsroot/winbash/winbash/input.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- input.c 10 Mar 2002 21:45:13 -0000 1.2
+++ input.c 11 Mar 2002 14:32:12 -0000 1.3
@@ -22,10 +22,10 @@
#include "bashtypes.h"
#include <sys/file.h>
+#include "filecntl.h"
#include "posixstat.h"
#include <stdio.h>
#include <errno.h>
-#include "filecntl.h"
#include "bashansi.h"
#include "config.h"
@@ -46,6 +46,8 @@
void free_buffered_stream ();
+//extern int interactive_shell;
+
int bash_input_fd_changed;
/* This provides a way to map from a file descriptor to the buffer
associated with that file descriptor, rather than just the other
@@ -232,6 +234,9 @@
}
return (fd2);
}
+
+/* Return 1 if a seek on FD will succeed. */
+#define fd_is_seekable(fd) (lseek ((fd), 0L, SEEK_CUR) >= 0)
/* Take FD, a file descriptor, and create and return a buffered stream
corresponding to it. If something is wrong and the file descriptor
Index: input.h
===================================================================
RCS file: /cvsroot/winbash/winbash/input.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- input.h 9 Mar 2002 16:05:41 -0000 1.2
+++ input.h 11 Mar 2002 14:32:12 -0000 1.3
@@ -20,7 +20,6 @@
#if !defined (_INPUT_H)
#define _INPUT_H
-#include <stdio.h>
#include "stdc.h"
/* Function pointers can be declared as (Function *)foo. */
Index: jobs.c
===================================================================
RCS file: /cvsroot/winbash/winbash/jobs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- jobs.c 11 Mar 2002 01:47:04 -0000 1.5
+++ jobs.c 11 Mar 2002 14:32:12 -0000 1.6
@@ -1844,13 +1844,6 @@
return (-1);
}
- if (JOBSTATE (job) == JDEAD)
- {
- report_error ("%s: job has terminated", this_command_name);
- UNBLOCK_CHILD (oset);
- return (-1);
- }
-
if (!foreground && already_running)
{
report_error ("%s: bg background job?", this_command_name);
@@ -2072,7 +2065,7 @@
{
flag = WUNTRACED;
if (sigchld || s)
- flag |= WNOHANG;
+ flag |= WNOHANG;
pid = WAITPID (-1, &status, flag);
if (sigchld && (flag & WNOHANG))
sigchld--;
Index: jobs.h
===================================================================
RCS file: /cvsroot/winbash/winbash/jobs.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- jobs.h 9 Mar 2002 16:05:42 -0000 1.2
+++ jobs.h 11 Mar 2002 14:32:12 -0000 1.3
@@ -288,6 +288,7 @@
/* Stuff from the jobs.c file. */
extern pid_t original_pgrp, shell_pgrp, pipeline_pgrp;
+//extern pid_t last_made_pid, last_asynchronous_pid;
extern int current_job, previous_job;
extern int asynchronous_notification;
extern JOB **jobs;
Index: newversion.c
===================================================================
RCS file: /cvsroot/winbash/winbash/newversion.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- newversion.c 9 Mar 2002 16:58:09 -0000 1.3
+++ newversion.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -20,8 +20,6 @@
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#define FOPEN(name, mode) fopen(name, mode);
-
#include <sys/types.h>
#include "posixstat.h"
#include <stdio.h>
@@ -236,7 +234,7 @@
char *name;
name = makename (filename);
- stream = FOPEN (name, "r");
+ stream = fopen (name, "r");
free (name);
if (stream == (FILE *)NULL)
return (0);
@@ -254,7 +252,7 @@
char *name;
name = makename (filename);
- stream = FOPEN (name, "r");
+ stream = fopen (name, "r");
free (name);
if (stream == (FILE *)NULL)
return (0);
@@ -267,7 +265,7 @@
must_open (name, mode)
char *name, *mode;
{
- FILE *temp = FOPEN (name, mode);
+ FILE *temp = fopen (name, mode);
if (!temp)
{
Index: nojobs.c
===================================================================
RCS file: /cvsroot/winbash/winbash/nojobs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nojobs.c 10 Mar 2002 23:25:31 -0000 1.3
+++ nojobs.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -94,6 +94,9 @@
extern int errno;
#endif /* !errno */
+//extern int interactive, interactive_shell, login_shell;
+//extern int subshell_environment;
+//extern int last_command_exit_value;
#if defined (_POSIX_VERSION)
extern sigset_t top_level_mask;
#endif
Index: parse.y
===================================================================
RCS file: /cvsroot/winbash/winbash/parse.y,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- parse.y 11 Mar 2002 05:12:52 -0000 1.6
+++ parse.y 11 Mar 2002 14:32:12 -0000 1.7
@@ -56,8 +56,11 @@
#define YYDEBUG 1
extern int eof_encountered;
+//extern int no_line_editing;
extern int current_command_number;
+//extern int interactive, interactive_shell, login_shell;
extern int posixly_correct;
+//extern int last_command_exit_value;
extern int interrupt_immediately;
extern char *shell_name, *current_host_name;
extern Function *last_shell_builtin, *this_shell_builtin;
Index: shell.c
===================================================================
RCS file: /cvsroot/winbash/winbash/shell.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- shell.c 10 Mar 2002 23:25:31 -0000 1.5
+++ shell.c 11 Mar 2002 14:32:12 -0000 1.6
@@ -78,6 +78,7 @@
extern char *dist_version;
extern int patch_level, build_version;
+//extern int subshell_environment; /* Found in execute_cmd.c. */
//extern int last_command_exit_value;
extern int return_catch_flag;
extern jmp_buf return_catch;
@@ -190,7 +191,7 @@
static int quiet = 0; /* Be quiet when starting up. */
static int make_login_shell = 0; /* Make this shell be a `-bash' shell. */
-int no_line_editing_private = 0; /* Don't do fancy line editing. */
+int no_line_editing_ = 0; /* Don't do fancy line editing. */
int no_brace_expansion = 0; /* Non-zero means no foo{a,b} -> fooa foob. */
int posixly_correct = 0; /* Non-zero means posix.2 superset. */
@@ -211,7 +212,7 @@
{ "version", Int, &do_version, (char **)0x0 },
{ "quiet", Int, &quiet, (char **)0x0 },
{ "login", Int, &make_login_shell, (char **)0x0 },
- { "nolineediting", Int, &no_line_editing_private, (char **)0x0 },
+ { "nolineediting", Int, &no_line_editing_, (char **)0x0 },
{ "nobraceexpansion", Int, &no_brace_expansion, (char **)0x0 },
{ "posix", Int, &posixly_correct, (char **)0x0 },
{ (char *)0x0, Int, (int *)0x0, (char **)0x0 }
@@ -750,7 +751,6 @@
#endif /* HISTORY */
interactive = interactive_shell = 0;
no_line_editing = 1;
-
#if defined (JOB_CONTROL)
set_job_control (0);
#endif /* JOB_CONTROL */
@@ -883,16 +883,16 @@
}
if (login_shell && !no_profile)
- {
- if (act_like_sh)
- maybe_execute_file ("~/.profile", 1);
- else
- {
- if (maybe_execute_file ("~/.bash_profile", 1) == 0)
- if (maybe_execute_file ("~/.bash_login", 1) == 0)
- maybe_execute_file ("~/.profile", 1);
- }
- }
+ {
+ if (act_like_sh)
+ maybe_execute_file ("~/.profile", 1);
+ else
+ {
+ if (maybe_execute_file ("~/.bash_profile", 1) == 0)
+ if (maybe_execute_file ("~/.bash_login", 1) == 0)
+ maybe_execute_file ("~/.profile", 1);
+ }
+ }
/* Execute ~/.bashrc for most shells. Never execute it if
ACT_LIKE_SH is set, or if NO_RC is set.
@@ -916,15 +916,15 @@
bash YES
*/
if (!act_like_sh && !no_rc &&
- (interactive_shell || (isnetconn (fileno (stdin)) &&
- local_pending_command)))
- maybe_execute_file (bashrc_file, 1);
+ (interactive_shell || (isnetconn (fileno (stdin)) &&
+ local_pending_command)))
+ maybe_execute_file (bashrc_file, 1);
}
- /* Try a TMB suggestion. If running a script, then execute the
- file mentioned in the ENV variable. */
- if (!privileged_mode && sourced_env++ == 0 && act_like_sh == 0 &&
- (posixly_correct || !interactive_shell))
+ /* Try a TMB suggestion. If running a script, then execute the
+ file mentioned in the ENV variable. */
+ if (!privileged_mode && sourced_env++ == 0 && act_like_sh == 0 &&
+ (posixly_correct || !interactive_shell))
{
char *env_file = (char *)NULL;
@@ -1041,7 +1041,6 @@
{
old_interactive = interactive;
interactive = 0;
-
}
return_val = SETJMP (return_catch);
@@ -1161,9 +1160,9 @@
current_command_number++;
/* POSIX spec: "-n: The shell reads commands but does
- not execute them; this can be used to check for shell
- script syntax errors. The shell ignores the -n option
- for interactive shells. " */
+ not execute them; this can be used to check for shell
+ script syntax errors. The shell ignores the -n option
+ for interactive shells. " */
if (interactive_shell || !read_but_dont_execute)
{
executing = 1;
@@ -1413,6 +1412,7 @@
login_shell = make_login_shell = interactive = executing = 0;
debugging = do_version = line_number = last_command_exit_value = 0;
forced_interactive = interactive_shell = subshell_environment = 0;
+
#if defined (HISTORY)
# if defined (BANG_HISTORY)
history_expansion = 0;
@@ -1618,9 +1618,9 @@
sigaction (XSIG (i), &act, &oact);
terminating_signals[i].orig_handler = oact.sa_handler;
/* Don't do anything with signals that are ignored at shell entry
- if the shell is not interactive. */
+ if the shell is not interactive. */
if (!interactive_shell && oact.sa_handler == SIG_IGN)
- {
+ {
sigaction (XSIG (i), &oact, &act);
set_signal_ignored (XSIG (i));
}
@@ -1631,9 +1631,9 @@
for (i = 0; i < TERMSIGS_LENGTH; i++)
{
terminating_signals[i].orig_handler =
- set_signal_handler (XSIG (i), termination_unwind_protect);
+ set_signal_handler (XSIG (i), termination_unwind_protect);
/* Don't do anything with signals that are ignored at shell entry
- if the shell is not interactive. */
+ if the shell is not interactive. */
if (!interactive_shell && terminating_signals[i].orig_handler == SIG_IGN)
{
set_signal_handler (XSIG (i), SIG_IGN);
Index: shell.h
===================================================================
RCS file: /cvsroot/winbash/winbash/shell.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- shell.h 11 Mar 2002 04:50:29 -0000 1.3
+++ shell.h 11 Mar 2002 14:32:12 -0000 1.4
@@ -77,11 +77,11 @@
#define Q_HERE_DOCUMENT 0x2
#define Q_KEEP_BACKSLASH 0x4
-/* extern char **shell_environment; */
+//extern char **shell_environment;
extern WORD_LIST *rest_of_args;
/* Generalized global variables. */
-/* extern int executing, login_shell; */
+//extern int executing, login_shell;
/* Structure to pass around that holds a bitmap of file descriptors
to close, and the size of that structure. Used in execute_cmd.c. */
Index: siglist.c
===================================================================
RCS file: /cvsroot/winbash/winbash/siglist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- siglist.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ siglist.c 11 Mar 2002 14:32:12 -0000 1.2
@@ -28,9 +28,7 @@
# include "trap.h"
#endif
-#ifndef __linux__
char *sys_siglist[NSIG];
-#endif
#ifndef __NT_VC__
extern char *xmalloc (), *malloc ();
Index: siglist.h
===================================================================
RCS file: /cvsroot/winbash/winbash/siglist.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- siglist.h 10 Mar 2002 23:25:31 -0000 1.3
+++ siglist.h 11 Mar 2002 14:32:12 -0000 1.4
@@ -28,8 +28,8 @@
#endif /* Solaris || USGr4_2 || drs6000 || amiga || Minix */
#if !defined (Solaris) && !defined (Linux) && !defined (__BSD_4_4__) && \
- !defined (Minix) && !defined (NetBSD) && !defined (FreeBSD) && \
- !defined (BSD_OS)
+ !defined (Minix) && !defined (NetBSD) && !defined (FreeBSD) && \
+ !defined (BSD_OS)
extern char *sys_siglist[];
#endif /* !Solaris && !Linux && !__BSD_4_4__ && !Minix && !NetBSD && !FreeBSD && !BSD_OS */
Index: subst.c
===================================================================
RCS file: /cvsroot/winbash/winbash/subst.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- subst.c 11 Mar 2002 05:12:52 -0000 1.7
+++ subst.c 11 Mar 2002 14:32:12 -0000 1.8
@@ -46,19 +46,18 @@
#include "filecntl.h"
#if defined (READLINE)
-#include <readline/readline.h>
+# include <readline/readline.h>
#else
-#include <tilde/tilde.h>
+# include <tilde/tilde.h>
#endif
-#include "builtins/getopt.h"
[...4876 lines suppressed...]
{
SET_INT_VAR (name, asynchronous_notification);
}
-#endif /* JOB_CONTROL */
+#endif /* JOB_CONTROL */
/* If the variable `nolinks' exists, it specifies that symbolic links are
not to be followed in `cd' commands. */
@@ -4901,9 +4896,9 @@
s = atoi (tt);
/* According to POSIX, setting OPTIND=1 resets the internal state
- of getopt (). */
+ of getopt (). */
if (s < 0 || s == 1)
- s = 0;
+ s = 0;
}
getopts_reset (s);
}
Index: test.c
===================================================================
RCS file: /cvsroot/winbash/winbash/test.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test.c 10 Mar 2002 21:45:13 -0000 1.3
+++ test.c 11 Mar 2002 14:32:12 -0000 1.4
@@ -156,6 +156,7 @@
char *format, *arg;
{
#if !defined (STANDALONE)
+// extern int interactive_shell;
extern char *get_name_for_error ();
if (!interactive_shell)
fprintf (STDERR, "%s: ", get_name_for_error ());
Index: trap.c
===================================================================
RCS file: /cvsroot/winbash/winbash/trap.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- trap.c 11 Mar 2002 04:50:29 -0000 1.5
+++ trap.c 11 Mar 2002 14:32:12 -0000 1.6
@@ -53,7 +53,9 @@
static void change_signal (), restore_signal ();
/* Variables used here but defined in other files. */
+//extern int interactive_shell, interactive;
extern int interrupt_immediately;
+//extern int last_command_exit_value;
/* The list of things to do originally, before we started trapping. */
SigHandler *original_signals[NSIG];
@@ -474,13 +476,13 @@
old_exit_value = last_command_exit_value;
/* Run the trap only if signal 0 is trapped and not ignored. */
- if ((sigmodes[0] & SIG_TRAPPED) &&
- (trap_list[0] != (char *)IGNORE_SIG) &&
- (sigmodes[0] & SIG_INPROGRESS) == 0)
+ if ((sigmodes[0] & SIG_TRAPPED) &&
+ (trap_list[0] != (char *)IGNORE_SIG) &&
+ (sigmodes[0] & SIG_INPROGRESS) == 0)
{
char *trap_command;
int code;
-
+
trap_command= savestring (trap_list[0]);
sigmodes[0] &= ~SIG_TRAPPED;
sigmodes[0] |= SIG_INPROGRESS;
@@ -503,12 +505,9 @@
restore_signal (sig)
int sig;
{
- /* only restore signal if allowed to do so */
- if (!(sigmodes[sig] & SIG_NO_TRAP)) {
- set_signal_handler (sig, original_signals[sig]);
- change_signal (sig, (char *)DEFAULT_SIG);
- sigmodes[sig] &= ~SIG_TRAPPED;
- }
+ set_signal_handler (sig, original_signals[sig]);
+ change_signal (sig, (char *)DEFAULT_SIG);
+ sigmodes[sig] &= ~SIG_TRAPPED;
}
/* Free all the allocated strings in the list of traps and reset the trap
@@ -619,7 +618,7 @@
last_command_exit_value = old_exit_value;
sigmodes[SIGINT] &= ~SIG_INPROGRESS;
-
+
if (sigmodes[SIGINT] & SIG_CHANGED)
{
free (saved_command);
Index: variables.c
===================================================================
RCS file: /cvsroot/winbash/winbash/variables.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- variables.c 10 Mar 2002 23:25:31 -0000 1.4
+++ variables.c 11 Mar 2002 14:32:12 -0000 1.5
@@ -92,12 +92,12 @@
/* The list of variables that may not be unset in this shell. */
char **non_unsettable_vars = (char **)NULL;
-static char *have_local_variables; /* XXX */
-static int local_variable_stack_size = 0; /* XXX */
+static char *have_local_variables; /* XXX */
+static int local_variable_stack_size = 0; /* XXX */
/* Some forward declarations. */
static void initialize_dynamic_variables ();
-static void sbrand (); /* set bash random number generator. */
+static void sbrand (); /* set bash random number generator. */
static int qsort_var_comp ();
/* Make VAR be auto-exported. VAR is a pointer to a SHELL_VAR. */
@@ -134,40 +134,40 @@
name = xmalloc (1 + string_length);
while ((c = *string++) && c != '=')
- name[char_index++] = c;
+ name[char_index++] = c;
name[char_index] = '\0';
/* If exported function, define it now. */
if (!privileged_mode && STREQN ("() {", string, 4))
- {
- SHELL_VAR *f;
- char *eval_string;
+ {
+ SHELL_VAR *f;
+ char *eval_string;
- eval_string = xmalloc (3 + string_length + strlen (name));
- sprintf (eval_string, "%s %s", name, string);
+ eval_string = xmalloc (3 + string_length + strlen (name));
+ sprintf (eval_string, "%s %s", name, string);
- parse_and_execute (eval_string, name, 0);
+ parse_and_execute (eval_string, name, 0);
- if (name[char_index - 1] == ')')
- name[char_index - 2] = '\0';
+ if (name[char_index - 1] == ')')
+ name[char_index - 2] = '\0';
- if (f = find_function (name))
- {
- f->attributes |= (att_exported | att_imported);
- array_needs_making = 1;
- }
- else
- report_error ("error importing function definition for `%s'", name);
- }
+ if (f = find_function (name))
+ {
+ f->attributes |= (att_exported | att_imported);
+ array_needs_making = 1;
+ }
+ else
+ report_error ("error importing function definition for `%s'", name);
+ }
else
- {
- SHELL_VAR *v;
+ {
+ SHELL_VAR *v;
- v = bind_variable (name, string);
- v->attributes |= (att_exported | att_imported);
- array_needs_making = 1;
- }
+ v = bind_variable (name, string);
+ v->attributes |= (att_exported | att_imported);
+ array_needs_making = 1;
+ }
free (name);
}
@@ -185,8 +185,8 @@
current_dir = get_working_directory ("shell-init");
if (current_dir)
{
- bind_variable ("PWD", current_dir);
- free (current_dir);
+ bind_variable ("PWD", current_dir);
+ free (current_dir);
}
}
@@ -339,44 +339,44 @@
if ((login_shell == 1) && ((*shell_name != '/') || !(isletter (*shell_name) && shell_name[1] == ':')))
{
- /* If HOME doesn't exist, set it. */
- temp_var = set_if_not ("HOME", current_user.home_dir);
- temp_var->attributes |= att_exported;
+ /* If HOME doesn't exist, set it. */
+ temp_var = set_if_not ("HOME", current_user.home_dir);
+ temp_var->attributes |= att_exported;
- name = savestring (current_user.shell);
+ name = savestring (current_user.shell);
}
else if (*shell_name == '/')
- name = savestring (shell_name);
- else
- {
- int s;
-
- tname = find_user_command (shell_name);
- if (tname == 0)
- {
- /* Try the current directory. If there is not an executable
- there, just punt and use the login shell. */
- s = file_status (shell_name);
- if (s & FS_EXECABLE)
- {
- tname = make_absolute (shell_name, get_string_value ("PWD"));
- if (*shell_name == '.')
- {
- name = canonicalize_pathname (tname);
- free (tname);
- }
- else
- name = tname;
- }
- else
- name = savestring (current_user.shell);
- }
+ name = savestring (shell_name);
else
{
- name = full_pathname (tname);
- free (tname);
+ int s;
+
+ tname = find_user_command (shell_name);
+ if (tname == 0)
+ {
+ /* Try the current directory. If there is not an executable
+ there, just punt and use the login shell. */
+ s = file_status (shell_name);
+ if (s & FS_EXECABLE)
+ {
+ tname = make_absolute (shell_name, get_string_value ("PWD"));
+ if (*shell_name == '.')
+ {
+ name = canonicalize_pathname (tname);
+ free (tname);
+ }
+ else
+ name = tname;
+ }
+ else
+ name = savestring (current_user.shell);
+ }
+ else
+ {
+ name = full_pathname (tname);
+ free (tname);
+ }
}
- }
/* Make the exported environment variable SHELL be the user's login
shell. Note that the `tset' command looks at this variable
@@ -409,9 +409,9 @@
if (remember_on_history)
{
if (posixly_correct)
- name = tilde_expand ("~/.sh_history");
+ name = tilde_expand ("~/.sh_history");
else
- name = tilde_expand ("~/.bash_history");
+ name = tilde_expand ("~/.bash_history");
set_if_not ("HISTFILE", name);
free (name);
@@ -440,9 +440,9 @@
{
sv_command_oriented_history ("command_oriented_history");
if (find_variable ("history_control"))
- sv_history_control ("history_control"); /* gone in next release */
+ sv_history_control ("history_control"); /* gone in next release */
else
- sv_history_control ("HISTCONTROL");
+ sv_history_control ("HISTCONTROL");
}
#endif /* HISTORY */
@@ -546,20 +546,20 @@
tlist = get_hash_bucket (i, var_hash_table);
while (tlist)
- {
- var = (SHELL_VAR *)tlist->data;
+ {
+ var = (SHELL_VAR *)tlist->data;
- if (!function || (*function) (var))
- {
- if (list_index + 1 >= list_size)
- list = (SHELL_VAR **)
- xrealloc (list, (list_size += 20) * sizeof (SHELL_VAR *));
+ if (!function || (*function) (var))
+ {
+ if (list_index + 1 >= list_size)
+ list = (SHELL_VAR **)
+ xrealloc (list, (list_size += 20) * sizeof (SHELL_VAR *));
- list[list_index++] = var;
- list[list_index] = (SHELL_VAR *)NULL;
+ list[list_index++] = var;
+ list[list_index] = (SHELL_VAR *)NULL;
+ }
+ tlist = tlist->next;
}
- tlist = tlist->next;
- }
}
return (list);
}
@@ -687,31 +687,31 @@
/* **************************************************************** */
/* DYNAMIC VARIABLES
-
+
These are variables whose values are generated anew each time they are
referenced. These are implemented using a pair of function pointers
in the struct variable: assign_func, which is called from bind_variable,
and dynamic_value, which is called from find_variable.
-
+
assign_func is called from bind_variable, if bind_variable discovers
that the variable being assigned to has such a function. The function
is called as
- SHELL_VAR *temp = (*(entry->assign_func)) (entry, value)
+ SHELL_VAR *temp = (*(entry->assign_func)) (entry, value)
and the (SHELL_VAR *)temp is returned as the value of bind_variable. It
is usually ENTRY (self).
-
+
dynamic_value is called from find_variable to return a `new' value for
the specified dynamic varible. If this function is NULL, the variable
is treated as a `normal' shell variable. If it is not, however, then
this function is called like this:
- tempvar = (*(var->dynamic_value)) (var);
-
+ tempvar = (*(var->dynamic_value)) (var);
+
Sometimes `tempvar' will replace the value of `var'. Other times, the
shell will simply use the string value. Pretty object-oriented, huh?
-
+
Be warned, though: if you `unset' a special variable, it loses its
special meaning, even if you subsequently set it.
-
+
The special assignment code would probably have been better put in
subst.c: do_assignment, in the same style as
stupidly_hack_special_variables, but I wanted the changes as
@@ -888,6 +888,7 @@
if (!var)
var = var_lookup (name, shell_variables);
+
if (!var)
return ((SHELL_VAR *)NULL);
@@ -903,7 +904,7 @@
char *name;
{
return (find_variable_internal
- (name, (variable_context || this_shell_builtin || builtin_env)));
+ (name, (variable_context || this_shell_builtin || builtin_env)));
}
/* Look up the function entry whose name matches STRING.
@@ -972,7 +973,7 @@
new_var->attributes = 0;
if (exported_p (old_var))
- new_var->attributes |= att_exported;
+ new_var->attributes |= att_exported;
new_var->prev_context = old_var;
elt = add_hash_item (savestring (name), shell_variables);
@@ -990,9 +991,9 @@
have_local_variables =
xrealloc (have_local_variables, local_variable_stack_size);
bzero ((char *)have_local_variables + old_size,
- local_variable_stack_size - old_size);
+ local_variable_stack_size - old_size);
}
- have_local_variables[variable_context] = 1; /* XXX */
+ have_local_variables[variable_context] = 1; /* XXX */
return (new_var);
}
@@ -1015,24 +1016,24 @@
entry->name = savestring (name);
if (value)
- {
- if (*value)
- entry->value = savestring (value);
- else
- {
- entry->value = xmalloc (1);
- entry->value[0] = '\0';
- }
- }
+ {
+ if (*value)
+ entry->value = savestring (value);
+ else
+ {
+ entry->value = xmalloc (1);
+ entry->value[0] = '\0';
+ }
+ }
else
- entry->value = (char *)NULL;
+ entry->value = (char *)NULL;
entry->dynamic_value = (DYNAMIC_FUNC *)NULL;
entry->assign_func = (DYNAMIC_FUNC *)NULL;
/* Always assume variables are to be made at toplevel!
- make_local_variable has the responsibilty of changing the
- variable context. */
+ make_local_variable has the responsibilty of changing the
+ variable context. */
entry->context = 0;
entry->prev_context = (SHELL_VAR *)NULL;
@@ -1044,48 +1045,48 @@
else
{
if (readonly_p (entry))
- {
- report_error ("%s: read-only variable", name);
- return (entry);
- }
+ {
+ report_error ("%s: read-only variable", name);
+ return (entry);
+ }
/* Variables which are bound are visible. */
entry->attributes &= ~att_invisible;
/* If this variable has had its type set to integer (via `declare -i'),
- then do expression evaluation on it and store the result. The
- functions in expr.c (evalexp and bind_int_variable) are responsible
- for turning off the integer flag if they don't want further
- evaluation done. */
+ then do expression evaluation on it and store the result. The
+ functions in expr.c (evalexp and bind_int_variable) are responsible
+ for turning off the integer flag if they don't want further
+ evaluation done. */
if (integer_p (entry))
- {
- long val;
+ {
+ long val;
- val = evalexp (value);
- /* We cannot free () entry->value before this; what if the string
- we are working is `even=even+2'? We need the original value
- around while we are doing the evaluation to handle any possible
- recursion. */
- FREE (entry->value);
- entry->value = itos (val);
- }
+ val = evalexp (value);
+ /* We cannot free () entry->value before this; what if the string
+ we are working is `even=even+2'? We need the original value
+ around while we are doing the evaluation to handle any possible
+ recursion. */
+ FREE (entry->value);
+ entry->value = itos (val);
+ }
else
- {
- FREE (entry->value);
+ {
+ FREE (entry->value);
- if (value)
- {
- if (*value)
- entry->value = savestring (value);
- else
- {
- entry->value = xmalloc (1);
- entry->value[0] = '\0';
- }
- }
- else
- entry->value = (char *)NULL;
- }
+ if (value)
+ {
+ if (*value)
+ entry->value = savestring (value);
+ else
+ {
+ entry->value = xmalloc (1);
+ entry->value[0] = '\0';
+ }
+ }
+ else
+ entry->value = (char *)NULL;
+ }
}
if (mark_modified_vars)
@@ -1170,7 +1171,7 @@
new_elt->data = (char *)new_var;
if (exported_p (new_var))
- set_var_auto_export (new_var->name);
+ set_var_auto_export (new_var->name);
}
/* Have to save a copy of name here, because it might refer to
@@ -1228,15 +1229,15 @@
list = map_over (variable_in_context, varlist);
if (list)
- {
- for (i = 0; var = list[i]; i++)
- makunbound (var->name, varlist);
+ {
+ for (i = 0; var = list[i]; i++)
+ makunbound (var->name, varlist);
- free (list);
- }
+ free (list);
+ }
}
- have_local_variables[variable_context] = 0; /* XXX */
+ have_local_variables[variable_context] = 0; /* XXX */
}
/* Delete the entire contents of the hash table. */
@@ -1252,25 +1253,25 @@
bucket = hashed_vars->bucket_array[i];
while (bucket)
- {
- BUCKET_CONTENTS *temp = bucket;
- SHELL_VAR *var, *prev;
+ {
+ BUCKET_CONTENTS *temp = bucket;
+ SHELL_VAR *var, *prev;
- bucket = bucket->next;
+ bucket = bucket->next;
- var = (SHELL_VAR *)temp->data;
+ var = (SHELL_VAR *)temp->data;
- while (var)
- {
- prev = var->prev_context;
- dispose_variable (var);
+ while (var)
+ {
+ prev = var->prev_context;
+ dispose_variable (var);
- var = prev;
- }
+ var = prev;
+ }
- free (temp->key);
- free (temp);
- }
+ free (temp->key);
+ free (temp);
+ }
hashed_vars->bucket_array[i] = (BUCKET_CONTENTS *)NULL;
}
}
@@ -1309,14 +1310,14 @@
entry->assign_func = (DYNAMIC_FUNC *)NULL;
/* Functions are always made at the top level. This allows a
- function to define another function (like autoload). */
+ function to define another function (like autoload). */
entry->context = 0;
}
if (entry->value)
dispose_command ((COMMAND *)entry->value);
- if (value) /* I don't think this can happen anymore */
+ if (value) /* I don't think this can happen anymore */
entry->value = (char *)copy_command (value);
else
entry->value = (char *)NULL;
@@ -1326,7 +1327,7 @@
if (mark_modified_vars)
entry->attributes |= att_exported;
- entry->attributes &= ~att_invisible; /* Just to be sure */
+ entry->attributes &= ~att_invisible; /* Just to be sure */
array_needs_making = 1;
@@ -1348,11 +1349,11 @@
copy->name = savestring (var->name);
if (function_p (var))
- copy->value = (char *)copy_command ((COMMAND *)var->value);
+ copy->value = (char *)copy_command ((COMMAND *)var->value);
else if (var->value)
- copy->value = savestring (var->value);
+ copy->value = savestring (var->value);
else
- copy->value = (char *)NULL;
+ copy->value = (char *)NULL;
copy->dynamic_value = var->dynamic_value;
copy->assign_func = var->assign_func;
@@ -1377,7 +1378,7 @@
{
entry = bind_variable (name, "");
if (!no_invisible_vars)
- entry->attributes |= att_invisible;
+ entry->attributes |= att_invisible;
}
entry->attributes |= att_readonly;
}
@@ -1406,7 +1407,7 @@
{
entry = bind_variable (name, "");
if (!no_invisible_vars)
- entry->attributes |= att_invisible;
+ entry->attributes |= att_invisible;
}
set_auto_export (entry);
@@ -1441,12 +1442,12 @@
while (c = string[indx])
{
/* The following is safe. Note that '=' at the start of a word
- is not an assignment statement. */
+ is not an assignment statement. */
if (c == '=')
- return (indx);
+ return (indx);
if (!isletter (c) && !digit (c) && c != '_')
- return (0);
+ return (0);
indx++;
}
@@ -1518,23 +1519,23 @@
char *value;
if (function_p (var))
- value = named_function_string
- ((char *)NULL, (COMMAND *)function_cell (var), 0);
+ value = named_function_string
+ ((char *)NULL, (COMMAND *)function_cell (var), 0);
else
- value = value_cell (var);
+ value = value_cell (var);
if (value)
- {
- int name_len = strlen (var->name);
- int value_len = strlen (value);
- char *p;
+ {
+ int name_len = strlen (var->name);
+ int value_len = strlen (value);
+ char *p;
- p = list[list_index] = xmalloc (2 + name_len + value_len);
- strcpy (p, var->name);
- p[name_len] = '=';
- strcpy (p + name_len + 1, value);
- list_index++;
- }
+ p = list[list_index] = xmalloc (2 + name_len + value_len);
+ strcpy (p, var->name);
+ p[name_len] = '=';
+ strcpy (p + name_len + 1, value);
+ list_index++;
+ }
}
free (vars);
@@ -1566,7 +1567,7 @@
value = string_list (list);
if (list)
- dispose_words (list);
+ dispose_words (list);
free (temp);
}
@@ -1600,7 +1601,7 @@
if (echo_command_at_execute)
{
/* The K*rn shell prints the `+ ' in front of assignment statements,
- so we do too. */
+ so we do too. */
fprintf (stderr, "%s%s\n", indirection_level_string (), temp);
fflush (stderr);
}
@@ -1624,25 +1625,25 @@
for (i = 0; array[i]; i++)
{
if (STREQN (array[i], name, l) && array[i][l] == '=')
- {
- SHELL_VAR *temp;
+ {
+ SHELL_VAR *temp;
- temp = new_shell_variable (name);
+ temp = new_shell_variable (name);
- if (array[i][l + 1])
- temp->value = savestring (&array[i][l + 1]);
- else
- temp->value = (char *) NULL;
+ if (array[i][l + 1])
+ temp->value = savestring (&array[i][l + 1]);
+ else
+ temp->value = (char *) NULL;
- temp->attributes = att_exported;
- temp->context = 0;
- temp->prev_context = (SHELL_VAR *)NULL;
+ temp->attributes = att_exported;
+ temp->context = 0;
+ temp->prev_context = (SHELL_VAR *)NULL;
- temp->dynamic_value = (DYNAMIC_FUNC *)NULL;
- temp->assign_func = (DYNAMIC_FUNC *)NULL;
+ temp->dynamic_value = (DYNAMIC_FUNC *)NULL;
+ temp->assign_func = (DYNAMIC_FUNC *)NULL;
- return (temp);
- }
+ return (temp);
+ }
}
return ((SHELL_VAR *)NULL);
}
@@ -1718,7 +1719,7 @@
char **array;
{
qsort (array, array_len (array), sizeof (char *),
- (Function *)qsort_string_compare);
+ (Function *)qsort_string_compare);
}
#define ISFUNC(s, o) ((s[o + 1] == '(') && (s[o + 2] == ')'))
@@ -1744,11 +1745,11 @@
for (i = 0; array && array[i]; i++)
{
if (STREQN (assign, array[i], equal_offset + 1))
- {
- free (array[i]);
- array[i] = savestring (assign);
- return (array);
- }
+ {
+ free (array[i]);
+ array[i] = savestring (assign);
+ return (array);
+ }
}
array = (char **)xrealloc (array, ((2 + i) * sizeof (char *)));
array[i++] = savestring (assign);
@@ -1769,14 +1770,14 @@
if (array_needs_making)
{
if (export_env)
- free_array (export_env);
+ free_array (export_env);
#ifdef SHADOWED_ENV
export_env =
- (char **)xmalloc ((1 + array_len (shell_environment)) * sizeof (char *));
+ (char **)xmalloc ((1 + array_len (shell_environment)) * sizeof (char *));
for (i = 0; shell_environment[i]; i++)
- export_env[i] = savestring (shell_environment[i]);
+ export_env[i] = savestring (shell_environment[i]);
export_env[i] = (char *)NULL;
#else /* !SHADOWED_ENV */
@@ -1788,25 +1789,25 @@
temp_array = make_var_array (shell_variables);
for (i = 0; temp_array && temp_array[i]; i++)
- export_env = add_or_supercede (temp_array[i], export_env);
+ export_env = add_or_supercede (temp_array[i], export_env);
free_array (temp_array);
temp_array = make_var_array (shell_functions);
for (i = 0; temp_array && temp_array[i]; i++)
- export_env = add_or_supercede (temp_array[i], export_env);
+ export_env = add_or_supercede (temp_array[i], export_env);
free_array (temp_array);
if (function_env)
- for (i = 0; function_env[i]; i++)
- export_env = add_or_supercede (function_env[i], export_env);
+ for (i = 0; function_env[i]; i++)
+ export_env = add_or_supercede (function_env[i], export_env);
if (temporary_env)
- for (i = 0; temporary_env[i]; i++)
- export_env = add_or_supercede (temporary_env[i], export_env);
+ for (i = 0; temporary_env[i]; i++)
+ export_env = add_or_supercede (temporary_env[i], export_env);
/* If we changed the array, then sort it alphabetically. */
if (temporary_env || function_env)
- sort_char_array (export_env);
+ sort_char_array (export_env);
array_needs_making = 0;
}
@@ -1862,7 +1863,7 @@
{
var = find_variable ((char *)name);
if (var && exported_p (var))
- return (value_cell (var));
+ return (value_cell (var));
}
else
{
@@ -1871,13 +1872,13 @@
/* In some cases, s5r3 invokes getenv() before main(); BSD systems
using gprof also exhibit this behavior. This means that
shell_variables will be 0 when this is invoked. We look up the
- variable in the real environment in that case. */
+ variable in the real environment in that case. */
for (i = 0; environ[i]; i++)
- {
- if ((STREQN (environ[i], name, len)) && (environ[i][len] == '='))
- return (environ[i] + len + 1);
- }
+ {
+ if ((STREQN (environ[i], name, len)) && (environ[i][len] == '='))
+ return (environ[i] + len + 1);
+ }
}
return ((char *)NULL);
Index: variables.h
===================================================================
RCS file: /cvsroot/winbash/winbash/variables.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- variables.h 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ variables.h 11 Mar 2002 14:32:13 -0000 1.2
@@ -49,8 +49,8 @@
#define function_cell(var) (COMMAND *)((var)->value)
/* Stuff for hacking variables. */
-/* extern int variable_context; */
-/* extern HASH_TABLE *shell_variables, *shell_functions; */
+//extern int variable_context;
+//extern HASH_TABLE *shell_variables, *shell_functions;
extern char *dollar_vars[];
extern char **export_env;
extern char **non_unsettable_vars;
Index: version.h
===================================================================
RCS file: /cvsroot/winbash/winbash/version.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- version.h 11 Mar 2002 05:12:52 -0000 1.9
+++ version.h 11 Mar 2002 14:32:13 -0000 1.10
@@ -8,9 +8,9 @@
#define PATCHLEVEL 7
/* The last built version of this shell. */
-#define BUILDVERSION 1
+#define BUILDVERSION 5
/* A version string for use by sccs and the what command. */
-#define SCCSVERSION "@(#)Bash version 1.14.7(1) GNU"
+#define SCCSVERSION "@(#)Bash version 1.14.7(5) GNU"
|