mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-01 09:29:51 +02:00
bash-4.3-beta file cleanup
This commit is contained in:
-5089
File diff suppressed because it is too large
Load Diff
@@ -1,111 +0,0 @@
|
||||
From chet@cwns1.INS.CWRU.Edu Sun Aug 26 17:46:14 1990
|
||||
Flags: 50
|
||||
Received: from cwns1.INS.CWRU.Edu by cwjcc.INS.CWRU.Edu with SMTP (5.61+ida+/CWRU-1.3-decnet)
|
||||
id AA17813; Sun, 26 Aug 90 17:46:14 -0400 (from chet@cwns1.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
|
||||
Received: by cwns1.INS.CWRU.Edu (5.61+ida+/CWRU-1.3-client)
|
||||
id AA00962; Sun, 26 Aug 90 17:46:31 -0400 (from chet for chet@cwjcc.INS.CWRU.Edu)
|
||||
Date: Sun, 26 Aug 90 17:01:56 -0400
|
||||
From: Chet Ramey <chet@cwns1.INS.CWRU.Edu>
|
||||
To: trent@jove.cs.pdx.edu
|
||||
Subject: Re: bash on triton
|
||||
Cc: chet@cwns1.INS.CWRU.Edu
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
In-Reply-To: Message from trent@jove.cs.pdx.edu of Fri, 24 Aug 90 16:07:19 PDT
|
||||
Message-Id: <9008262101.AA00902.SM@cwns1.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
> Actually, it just that PSU gets the short end of the stick compared to
|
||||
> the other state universities because we don't have a division I
|
||||
> football team (no :-).
|
||||
|
||||
Yeah, but didn't you guys produce Neil Lomax (lo these many years ago)? What
|
||||
have the other schools given the NFL lately?
|
||||
|
||||
> First thing I noticed is that this alias fails:
|
||||
> alias .root=/usr/local/.root
|
||||
> The error is:
|
||||
> alias: .root: not a valid shell identifier
|
||||
|
||||
This is correct according to Posix 1003.2a draft 5. An alias must obey this
|
||||
pseudo-regexp:
|
||||
[a-zA-Z_][a-zA-Z0-9_]*
|
||||
|
||||
(That is, only letters, digits, and underscores, and it may not begin with an
|
||||
underscore). This is in the latest version of the manual page, the one in
|
||||
the documentation directory.
|
||||
|
||||
> Also it crashes when PROMPT_COMMAND is set, thus:
|
||||
> bash$ PROMPT_COMMAND="A=`pwd`"
|
||||
> bash$ # just hit return
|
||||
> bash: free: Called with already freed block argument
|
||||
|
||||
I am sorting through this problem right now, and I've discovered a few things
|
||||
(none complimentary to Sun).
|
||||
|
||||
First of all, this crash happens because Sun's programmers are lazy. The Sun
|
||||
malloc allows you to free things multiple times, instead of doing the old
|
||||
|
||||
if (x)
|
||||
free(x);
|
||||
x = NULL;
|
||||
|
||||
trick. The Gnu malloc disallows that.
|
||||
|
||||
The root of this set of problems is that the Sun yyparse() is not reentrant
|
||||
(`impure'). First of all, /usr/lib/yaccpar has changed a number of things
|
||||
to be dynamically allocated that were once static arrays (the state stack
|
||||
and the value stack are the two major ones). Second, some things that used
|
||||
to be automatic variables to yyparse (like the state stack) are now
|
||||
globally static variables in /usr/lib/yaccpar. This means no more
|
||||
indirectly recursive calls to yyparse(). This is pure bogusness, and
|
||||
breaks backwards compatibility in a major way.
|
||||
|
||||
The first indirect call to yyparse() occurs when PROMPT_COMMAND is run
|
||||
through parse_and_execute() (parse.y, around line 1200). The next call to
|
||||
yyparse() in your example (hitting return) returns quickly, putting nothing
|
||||
onto the state stack. Of course, YYACCEPT doesn't check whether anything
|
||||
was put into the stack; it just goes ahead and frees it anyway.
|
||||
|
||||
The next problem arises when PROMPT_COMMAND contains a backquoted command,
|
||||
which is run through parse_and_execute() again. It doesn't matter that
|
||||
this parse_and_execute is in a subshell; the data structures being built by
|
||||
Sun's yacc come along for free when bash forks. The state stack gets all
|
||||
screwed up and a segmentation fault is the inevitable result. If Sun (and,
|
||||
I assume, AT&T, since the SCCS line at the top of /usr/lib/yaccpar
|
||||
indicates that it is derived from S5R3.1) wants to do this kind of shit,
|
||||
they should at least provide a convenience function to clear out the state
|
||||
stack.
|
||||
|
||||
Both of these problems are avoided by using bison. I have put bison on
|
||||
triton (you'll have to redo it if you want it; it looks for the parser
|
||||
skeletons in /home/chet/lib), and a bash compiled with a bison-generated
|
||||
parser does not crash given the above setting of PROMPT_COMMAND. That bash
|
||||
is in /home/chet/bin. I don't know how to solve these problems in a
|
||||
simple way by using the Sun yacc.
|
||||
|
||||
`Byacc' (Berkeley Yacc), the 4.4 BSD rewrite of Yacc by Bob Corbett (who
|
||||
wrote the original version of bison), should also be OK, though I haven't
|
||||
looked at it.
|
||||
|
||||
> That brings up something else: Triton is set up as a mail-less
|
||||
> machine (all mail is forwarded elsewhere). Do you want your mail
|
||||
> forwarded to CWSU?? Right now the bug reports Bash generates are
|
||||
> vanishing. (I don't touch sendmail, and, from what I'm told, I'm
|
||||
> better off that way :-)
|
||||
|
||||
(It's CWRU, by the way.)
|
||||
|
||||
Don't worry, I get them all. Look at the end of shell.c (make_bug_report)
|
||||
where it opens a pipe to `/bin/rmail chet@ins.cwru.edu'.
|
||||
|
||||
Let me know of any more problems you encounter.
|
||||
|
||||
Chet
|
||||
|
||||
|
||||
--
|
||||
Chet Ramey ``Levi Stubbs' tears run down
|
||||
Network Services Group his face...''
|
||||
Case Western Reserve University
|
||||
chet@ins.CWRU.Edu
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From chet@odin.INS.CWRU.Edu Sat Apr 27 19:54:13 1991
|
||||
Flags: 50
|
||||
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5-UUCPGW)
|
||||
id AA05700; Sat, 27 Apr 91 19:54:13 -0400 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
|
||||
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.4-ins)
|
||||
id AA17732; Sat, 27 Apr 91 19:54:06 -0400 (from chet for chet@usenet.INS.CWRU.Edu)
|
||||
Date: Sat, 27 Apr 91 19:31:16 -0400
|
||||
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
|
||||
To: bfox@ai.mit.edu
|
||||
Subject: Re: [pedz@aixwiz.austin.ibm.com: fd 9 left open bug]
|
||||
Cc: chet@odin.INS.CWRU.Edu, pedz@aixwiz.austin.ibm.com
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
In-Reply-To: Message from bfox@bears.ece.ucsb.edu of Wed, 24 Apr 91 12:49:33 PDT
|
||||
Message-Id: <9104272331.AA17706.SM@odin.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
> Below is something I call Xemacs which goes across the net, sets up the
|
||||
> display variable and then kicks off emacs in such a way that rshd
|
||||
> terminates. The trick is that the shell must die and all file
|
||||
> descriptors going back to rshd must be closed. The same basic script
|
||||
> works with csh but I had to add in the "9>&-" part at the end to make
|
||||
> it work with bash. This is because somehow, file descriptor 9 is left
|
||||
> open and I guess it must be a dup of stdin, stdout, or stderr.
|
||||
|
||||
This is a bug alright, but it's a bug with rshd that's not fixed until
|
||||
4.3-reno.
|
||||
|
||||
rshd sets up a pipe (int pv[2]; if you have the source to the tahoe rshd)
|
||||
to the process it executes and uses it to manage error and control output
|
||||
from over the net. In the child process, it does a dup2(pv[1], 2), but
|
||||
never calls close(pv[1]). Adding that code to the 4.3-tahoe rshd makes it
|
||||
(and the Xemacs script) work right.
|
||||
|
||||
I don't know how to solve this cleanly in bash. Doing a blanket close of
|
||||
all open file descriptors < 2, < 20 is a no-no, especially when we're not
|
||||
interactive. csh `works' because it does the blanket close on startup, but
|
||||
csh can get away with doing that because it doesn't let you manipulate
|
||||
arbitrary file descriptors.
|
||||
|
||||
Chet
|
||||
|
||||
--
|
||||
Chet Ramey Internet: chet@po.CWRU.Edu
|
||||
Case Western Reserve University NeXT Mail: chet@macbeth.INS.CWRU.Edu
|
||||
|
||||
``Now, somehow we've brought our sins back physically -- and they're pissed.''
|
||||
@@ -1,38 +0,0 @@
|
||||
From chet Thu Aug 13 10:42:35 1992
|
||||
Flags: 50
|
||||
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.5-ins)
|
||||
id AA07004; Thu, 13 Aug 92 10:42:35 -0400 (from chet for /usr/homes/chet/bin/mailfilter.sh /usr/homes/chet/mbox)
|
||||
Date: Thu, 13 Aug 1992 10:34:47 -0400
|
||||
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
|
||||
To: przemek@rrdstrad.nist.gov
|
||||
Subject: Re: output of background jobs in BASH
|
||||
Cc: bug-bash@prep.ai.mit.edu, chet
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
In-Reply-To: Message from przemek@rrdstrad.nist.gov of 12 Aug 92 18:15:53 GMT
|
||||
Message-Id: <9208131434.AA00639.SM@odin.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
> I believe that this changed when I installed bash 1.12: when I put a job that
|
||||
> prints on stdout in background (^Z/bg or directly by &), the output comes out
|
||||
> staggered, as if the CR wasn't being added to the LF at the end of the lines.
|
||||
|
||||
This is a result of bash using the BSD-style tty driver on Ultrix. The BSD
|
||||
driver ties input and output carriage return translation together with the
|
||||
CRMOD bit. (The CRMOD bit causes CR->LF translation on input and LF->CRLF
|
||||
translation on output.) Unless the CRMOD bit is cleared, it is impossible
|
||||
to get a literal ^M in an input line. Unfortunately, one of the effects of
|
||||
clearing it is the loss of output processing you've observed.
|
||||
|
||||
The Ultrix Posix-style tty driver can't be used because it has serious
|
||||
problems with losing typeahead when ICANON is switched on and off. These
|
||||
characters seem to reappear later without warning, usually when a
|
||||
program that uses the BSD-style ioctls turns on CBREAK (e.g., `more').
|
||||
|
||||
Chet
|
||||
|
||||
--
|
||||
``The use of history as therapy means the corruption of history as history.''
|
||||
-- Arthur Schlesinger
|
||||
|
||||
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
The HP/UX manual page for ulimit(2) reports that ulimit(1, 0L) will return
|
||||
the maximum file size in terms of 512-byte blocks. It lies, at least on
|
||||
HP/UX 6.5; the number of bytes is returned.
|
||||
@@ -1,137 +0,0 @@
|
||||
Article 7946 of comp.unix.sysv386:
|
||||
Newsgroups: comp.unix.sysv386
|
||||
Path: usenet.ins.cwru.edu!agate!stanford.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!rochester!lubkin
|
||||
From: lubkin@cs.rochester.edu (Saul Lubkin)
|
||||
Subject: Binary patch to os.o fixes POSIX panics using VP/ix with job controlled bash
|
||||
Message-ID: <1991Apr30.034006.24056@cs.rochester.edu>
|
||||
Organization: Computer Science Department University of Rochester
|
||||
Date: Tue, 30 Apr 1991 03:40:06 GMT
|
||||
|
||||
|
||||
Recently, Uwe Doering posted the following article:
|
||||
|
||||
Article 6891 of comp.unix.sysv386:
|
||||
Path: nancy!uunet!math.fu-berlin.de!fub!geminix.in-berlin.de!gemini
|
||||
From: gemini@geminix.in-berlin.de (Uwe Doering)
|
||||
Newsgroups: comp.unix.sysv386
|
||||
Subject: Re: NAMEI panic - trap "E", address and info follows (+ patch)
|
||||
Message-ID: <KYXPX2E@geminix.in-berlin.de>
|
||||
Date: 13 Apr 91 00:55:41 GMT
|
||||
References: <1991Apr10.040146.645@ddsw1.MCS.COM>
|
||||
Organization: Private UNIX Site
|
||||
Lines: 92
|
||||
|
||||
karl@ddsw1.MCS.COM (Karl Denninger) writes:
|
||||
|
||||
>Is anyone else having problems with a "namei" panic in ISC 2.2 (with NFS,
|
||||
>the NFS/lockd patches, and POSIX patches applied)?
|
||||
>
|
||||
>I have been getting these nearly daily. Trap type "E", address is d007962f.
|
||||
>That's right near the end of "namei"; here's the relavent line from a "nm"
|
||||
>on the kernel:
|
||||
>
|
||||
>namei |0xd007919c|extern| *struct( )|0x0608| |.text
|
||||
>
|
||||
>Needless to say, I am most displeased with the crashes!
|
||||
>
|
||||
>Near as I can determine, the hardware is fine.
|
||||
>
|
||||
>All pointers or ideas appreciated...
|
||||
|
||||
I found this bug a few days ago and was about to send a bug report
|
||||
to ISC. The problem is "simply" a NULL pointer reference in the
|
||||
namei() function. The machine I found this on runs ISC 2.21 with
|
||||
the security fix installed. I fixed this bug with a binary patch. It
|
||||
is for the module /etc/conf/pack.d/kernel/os.o. I disassembled the
|
||||
original and then the fixed version of os.o and ran a context diff
|
||||
over the output. Depending on what version of the kernel config kit
|
||||
you have the addresses might be off some bytes. You can apply this
|
||||
patch with every binary file editor.
|
||||
|
||||
***************
|
||||
*** 35349,35364 ****
|
||||
[%al,%al]
|
||||
cf71: 74 1e je 0x1e <cf91>
|
||||
[0xcf91]
|
||||
! cf73: 0f b7 07 movzwl (%edi),%eax
|
||||
[%edi,%eax]
|
||||
! cf76: 3d 11 00 00 00 cmpl $0x11,%eax
|
||||
[$0x11,%eax]
|
||||
! cf7b: 74 14 je 0x14 <cf91>
|
||||
[0xcf91]
|
||||
! cf7d: c7 45 e8 00 00 00 00 movl $0x0,0xe8(%ebp)
|
||||
! [$0x0,-24+%ebp]
|
||||
! cf84: eb 19 jmp 0x19 <cf9f>
|
||||
! [0xcf9f]
|
||||
cf86: 90 nop
|
||||
[]
|
||||
cf87: 90 nop
|
||||
--- 35349,35372 ----
|
||||
[%al,%al]
|
||||
cf71: 74 1e je 0x1e <cf91>
|
||||
[0xcf91]
|
||||
! cf73: 85 ff testl %edi,%edi
|
||||
! [%edi,%edi]
|
||||
! cf75: 74 1a je 0x1a <cf91>
|
||||
! [0xcf91]
|
||||
! cf77: 0f b7 07 movzwl (%edi),%eax
|
||||
[%edi,%eax]
|
||||
! cf7a: 3d 11 00 00 00 cmpl $0x11,%eax
|
||||
[$0x11,%eax]
|
||||
! cf7f: 74 10 je 0x10 <cf91>
|
||||
[0xcf91]
|
||||
! cf81: eb 15 jmp 0x15 <cf98>
|
||||
! [0xcf98]
|
||||
! cf83: 90 nop
|
||||
! []
|
||||
! cf84: 90 nop
|
||||
! []
|
||||
! cf85: 90 nop
|
||||
! []
|
||||
cf86: 90 nop
|
||||
[]
|
||||
cf87: 90 nop
|
||||
|
||||
I'm not absolutely sure whether the action that is now taken in case of
|
||||
a NULL pointer is the right one, but I haven't noticed any problems,
|
||||
and most important, there are no more kernel panics! At least not from
|
||||
that spot. :-) The action that is taken if the pointer in _not_ NULL
|
||||
hasn't changed (this is not very obvious from the patch, but look
|
||||
in the disassembler listing of your own kernel for more details).
|
||||
I use this modified kernel for over a week now and it works for
|
||||
me. Of course, as always, I can't give you any guaranty that this
|
||||
patch does something useful on your machine. :-)
|
||||
|
||||
Hope this helps you.
|
||||
|
||||
Uwe
|
||||
|
||||
PS: ISC, if you see this posting, could you drop me a note on whether
|
||||
you have put this on your to-do list? This would save me the time
|
||||
needed to file an official bug report.
|
||||
--
|
||||
Uwe Doering | INET : gemini@geminix.in-berlin.de
|
||||
Berlin |----------------------------------------------------------------
|
||||
Germany | UUCP : ...!unido!fub!geminix.in-berlin.de!gemini
|
||||
=======================================================================
|
||||
|
||||
|
||||
Here is a copy of my recent note to Uwe:
|
||||
|
||||
|
||||
I've applied the binary patch that you recently poosted to comp.unix.sysv386
|
||||
for os.o.
|
||||
|
||||
It works beautifully. Previously, I had compiled bash1.07CWRU, and it worked
|
||||
well (using POSIX job control), job control and all -- but running VP/ix under
|
||||
this bash caused a system panic. This evidently is the (now infamous) "POSIX
|
||||
namei bug". After rebuilding the kernel with a patched os.o, the problem
|
||||
simply disappeared. VP/ix, like everything else, now works fine under
|
||||
bash1.07CWRU.
|
||||
|
||||
|
||||
Yours sincerely,
|
||||
|
||||
Saul Lubkin
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
From chet@odin.INS.CWRU.Edu Thu Mar 7 19:16:25 1991
|
||||
Flags: 50
|
||||
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.61+ida+/CWRU-1.4-UUCPGW)
|
||||
id AA00967; Thu, 7 Mar 91 19:16:25 -0500 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
|
||||
Received: by odin.INS.CWRU.Edu (5.65+ida+/CWRU-1.4-ins)
|
||||
id AA04437; Thu, 7 Mar 91 19:15:31 -0500 (from chet for chet@usenet.INS.CWRU.Edu)
|
||||
Date: Thu, 7 Mar 91 19:10:00 -0500
|
||||
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
|
||||
To: jacob@blackbox.gore.com
|
||||
Subject: Re: Library function redefinition
|
||||
Cc: chet@odin.INS.CWRU.Edu, bfox@ai.mit.edu
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
In-Reply-To: Message from jacob@blackbox.gore.com of Sun, 3 Mar 91 19:18:54 MST
|
||||
Message-Id: <9103080010.AA04427.SM@odin.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
> Now that you're working on bash for NeXT, let me ask you if you've run into
|
||||
> this bug under 2.0: bash, as a login shell, hangs on rlogin into the NeXT.
|
||||
> But it works fine on telnet. On rlogin, I even get no output to stdout
|
||||
> from the 'tset' (or debugging 'echo's) in my startup files.
|
||||
|
||||
It's getting stuck in initialize_jobs (). There is a bug in the NeXT
|
||||
/usr/etc/rlogind that causes bash to be started with the terminal still
|
||||
belonging to the rlogind process, and its process group set to 0 (so
|
||||
that getpgrp() returns 0 (!)). It looks like there's a stray setpgrp(0, 0)
|
||||
in the rlogind code that NeXT is not handling like 4.3 BSD.
|
||||
|
||||
(Another bug that I've found with NeXT 2.0 is that Terminal starts up the
|
||||
shell underneath it with argc == 0 and argv[0] = "-". Not polite.
|
||||
`mount -vat nfs' seems to be broken too. Any more good ones I should look
|
||||
for?)
|
||||
|
||||
Here's a diff to jobs.c to work around it. Your line numbers will certainly
|
||||
vary (for all I know, the code might, too).
|
||||
|
||||
Chet
|
||||
|
||||
*** jobs.c~ Tue Mar 5 17:41:00 1991
|
||||
--- jobs.c Thu Mar 7 18:50:12 1991
|
||||
***************
|
||||
*** 1839,1842 ****
|
||||
--- 1839,1852 ----
|
||||
}
|
||||
|
||||
+ #if defined (NeXT)
|
||||
+ /* This is to compensate for a bug in the NeXT 2.0 /usr/etc/rlogind. */
|
||||
+ if (shell_pgrp == 0)
|
||||
+ {
|
||||
+ shell_pgrp = getpid ();
|
||||
+ setpgid (0, shell_pgrp);
|
||||
+ tcsetpgrp (shell_tty, shell_pgrp);
|
||||
+ }
|
||||
+ #endif /* NeXT */
|
||||
+
|
||||
while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1)
|
||||
{
|
||||
|
||||
--
|
||||
Chet Ramey ``Now, somehow we've brought our sins
|
||||
Network Services Group back physically -- and they're
|
||||
Case Western Reserve University pissed.''
|
||||
chet@ins.CWRU.Edu My opinions are just those, and mine alone.
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
From gnulists@ai.mit.edu Mon Feb 22 20:41:24 1993
|
||||
Flags: 50
|
||||
Received: from po.CWRU.Edu by odin.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5.4-ins)
|
||||
id AA17713; Mon, 22 Feb 93 20:41:24 -0500 (from gnulists@ai.mit.edu for /usr/homes/chet/bin/mailfilter.sh /usr/homes/chet/mbox)
|
||||
Return-Path: <gnulists@ai.mit.edu>
|
||||
Received: from life.ai.mit.edu by po.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.9)
|
||||
id AA29616; Mon, 22 Feb 93 20:41:17 -0500 (from gnulists@ai.mit.edu for chet@odin.INS.CWRU.Edu)
|
||||
Received: from raisin-nut (raisin-nut.ai.mit.edu) by life.ai.mit.edu (4.1/AI-4.10) id AA01858; Mon, 22 Feb 93 20:40:47 EST
|
||||
Received: by raisin-nut (4.1/AI-4.10) id AA06708; Mon, 22 Feb 93 20:40:46 EST
|
||||
Resent-Date: Mon, 22 Feb 1993 13:29:57 -0500
|
||||
Resent-Message-Id: <9302230140.AA06708@raisin-nut>
|
||||
Received: from odin.INS.CWRU.Edu by life.ai.mit.edu (4.1/AI-4.10) id AA19283; Mon, 22 Feb 93 13:36:48 EST
|
||||
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.5.4-ins)
|
||||
id AA27765; Mon, 22 Feb 93 13:36:44 -0500 (from chet for bug-bash@prep.ai.mit.edu)
|
||||
Date: Mon, 22 Feb 1993 13:29:57 -0500
|
||||
From: Chet Ramey <chet@odin.ins.cwru.edu>
|
||||
Sender: gnulists@ai.mit.edu
|
||||
To: pat@bcserv.wustl.edu
|
||||
Subject: Re: bash for SCO Unix 3.2.2/4
|
||||
Cc: bug-bash@prep.ai.mit.edu, chet@odin.ins.cwru.edu
|
||||
Reply-To: chet@po.cwru.edu
|
||||
In-Reply-To: Message from pat@bcserv.wustl.edu of 22 Feb 93 06:23:34 GMT (id <pat.730362214@bcserv>)
|
||||
Message-Id: <9302221829.AA27553.SM@odin.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Resent-From: bug-bash-request@prep.ai.mit.edu
|
||||
|
||||
> I've had no luck making either bash-1.11 or bash-1.12 for
|
||||
> SCO Unix v 3.2.2 or 3.2.4...
|
||||
>
|
||||
> bash-1.12 says (specifically) that it's making for 3.2.2, but
|
||||
> still has problems.
|
||||
>
|
||||
> It locks up after a few commnds...
|
||||
>
|
||||
> I don't have GCC right now, so I did have to tell it that I don't
|
||||
> have 'alloca' by undefining it in machines.h - if that could be a problem.
|
||||
|
||||
You can't run bash-1.12 on a 3.2.4 system if it's been compiled on a
|
||||
3.2.2 system. Bash contains a fix for the broken sigsuspend in 3.2.2
|
||||
that breaks bash on 3.2.4, because 3.2.4 has the bug fixed.
|
||||
|
||||
Bash 1.12 should build and run OK out of the box on 3.2.2. For 3.2.4
|
||||
you need to locate the code at around line 1250 of jobs.c and change
|
||||
#if !defined (SCO) to #if 1 so that sigsuspend is used. Then take out
|
||||
the SCO defines in flush_child().
|
||||
|
||||
Chet
|
||||
|
||||
--
|
||||
``The use of history as therapy means the corruption of history as history.''
|
||||
-- Arthur Schlesinger
|
||||
|
||||
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From chet@odin.INS.CWRU.Edu Fri May 3 17:22:41 1991
|
||||
Flags: 50
|
||||
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5-UUCPGW)
|
||||
id AA22515; Fri, 3 May 91 17:22:41 -0400 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
|
||||
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.4-ins)
|
||||
id AA07171; Fri, 3 May 91 17:22:21 -0400 (from chet for chet@usenet.INS.CWRU.Edu)
|
||||
Date: Fri, 3 May 91 17:18:03 -0400
|
||||
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
|
||||
To: jp@lysator.liu.se
|
||||
Subject: fixed sequent bug
|
||||
Cc: chet@odin.INS.CWRU.Edu
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
Message-Id: <9105032118.AA07167.SM@odin.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
|
||||
I fixed it. Sequent's fcntl and dup2 are both messed up. They do not set
|
||||
the new descriptor to be open-on-exec. For dup2 it's OK; that's the way
|
||||
4.2 BSD did it. fcntl doing it is a bug, and a bad one.
|
||||
|
||||
Chet
|
||||
|
||||
--
|
||||
Chet Ramey Internet: chet@po.CWRU.Edu
|
||||
Case Western Reserve University NeXT Mail: chet@macbeth.INS.CWRU.Edu
|
||||
|
||||
``Now, somehow we've brought our sins back physically -- and they're pissed.''
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
From chet Mon Jul 27 14:54:45 1992
|
||||
Flags: 50
|
||||
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.5-ins)
|
||||
id AA15494; Mon, 27 Jul 92 14:54:45 -0400 (from chet for /usr/homes/chet/bin/mailfilter.sh /usr/homes/chet/mbox)
|
||||
Date: Mon, 27 Jul 1992 14:29:55 -0400
|
||||
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
|
||||
To: stud7b43@x400gate.bnr.ca
|
||||
Subject: Re: Bug in Bash 1.12.1
|
||||
Cc: bug-bash@ai.mit.edu, chet
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
In-Reply-To: Message from stud7b43@x400gate.bnr.ca of Mon, 27 Jul 1992 12:30:00 +0000
|
||||
Message-Id: <9207271829.AA14484.SM@odin.INS.CWRU.Edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
> I seem to have found a bug in Bash.
|
||||
>
|
||||
> How to cause the bug to appear:
|
||||
> 1) Start a long username-completion, e.g.
|
||||
> cat ~user<TAB>
|
||||
> Let it run for a while (don't know exactly how long...)
|
||||
> Before it's finished, hit ^C (or whatever the break character
|
||||
> is set to)
|
||||
> 2) As the next command, run a filename completion with a username in it, eg.
|
||||
> cat ~username/.log<TAB>
|
||||
>
|
||||
> Error message: "free: Called with already freed block argument
|
||||
|
||||
This is a bug in the Sun YP code that everyone seems to have picked up.
|
||||
|
||||
Sun keeps static state in the YP library code -- a pointer into the
|
||||
data returned from the server. When YP initializes itself (setpwent),
|
||||
it looks at this pointer and calls free on it if it's non-null. So far,
|
||||
so good.
|
||||
|
||||
If one of the YP functions is interrupted during getpwent (the exact function
|
||||
is interpretwithsave()), and returns NULL, the pointer is freed without being
|
||||
reset to NULL, and the function returns. The next time getpwent is called,
|
||||
it sees that this pointer is non-null, calls free, and the Gnu free()
|
||||
blows up because it's being asked to free freed memory.
|
||||
|
||||
The traditional Unix mallocs allow memory to be freed multiple times; that's
|
||||
probably why this has never been fixed. You can probably stop it by adding
|
||||
an #undef USE_GNU_MALLOC to the appropriate machine description in machines.h.
|
||||
|
||||
Chet
|
||||
|
||||
--
|
||||
``The use of history as therapy means the corruption of history as history.''
|
||||
-- Arthur Schlesinger
|
||||
|
||||
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
From chet@odin.INS.CWRU.Edu Fri Dec 21 10:56:27 1990
|
||||
Flags: 50
|
||||
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.61+ida+/CWRU-1.3-UUCPGW)
|
||||
id AA27089; Fri, 21 Dec 90 10:56:27 -0500 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox.test /usr/homes/chet/mbox)
|
||||
Received: by odin.INS.CWRU.Edu (5.61+ida+/CWRU-1.4-ins)
|
||||
id AA17558; Fri, 21 Dec 90 10:56:18 -0500 (from chet for chet@usenet.INS.CWRU.Edu)
|
||||
Date: Fri, 21 Dec 90 10:36:58 -0500
|
||||
From: Chet Ramey <chet@odin.ins.cwru.edu>
|
||||
To: dbrooks@osf.org
|
||||
Subject: Re: bash and OSF/1
|
||||
Cc: chet@odin.INS.CWRU.Edu
|
||||
Reply-To: chet@po.CWRU.Edu
|
||||
In-Reply-To: Message from dbrooks@osf.org of Fri, 21 Dec 90 10:28:26 EST
|
||||
Message-Id: <9012211536.AA17531.SM@odin.ins.cwru.edu>
|
||||
Read-Receipt-To: chet@po.CWRU.Edu
|
||||
|
||||
> Michael Meissner has been suddenly asked to do Real Work (TM) so it's
|
||||
> unlikely he'll get to do anything with OSF/1 until the new year. We
|
||||
> talked about it, however, and there are a few issues.
|
||||
|
||||
Not (gasp) Real Work!
|
||||
|
||||
> The upshot of the above is: expect a block of #defines based on
|
||||
> __OSF1__, and expect it possibly not to work under all
|
||||
> implementations.
|
||||
|
||||
Works for me.
|
||||
|
||||
> I have two new bugs for you in 1.06.
|
||||
>
|
||||
> - Typeahead is very weird. Often, I will be in a state where a
|
||||
> command is busy, and I type a new one. The shell prompts and
|
||||
> nothing happens; I have to type the line again. Later, if I enter
|
||||
> an interactive command (such as "mail") the missing keystrokes get
|
||||
> delivered to it instead. This is on a pmax, Ultrix 3.1, with some
|
||||
> patches of my own and Michael's fignore patch (that may have caused
|
||||
> it; I haven't investigated yet. Just wanted to see if this rang a bell.)
|
||||
|
||||
Typeahead under Ultrix is wierd. This doesn't happen anywhere else. Here's
|
||||
what it does for me:
|
||||
|
||||
cwjcc$ sleep 4
|
||||
echo hi ; echo hi <----- typeahead while sleeping
|
||||
cwjcc$ <----- nothing comes out
|
||||
cwjcc$ more readline.c
|
||||
readline.c: No such file or directory
|
||||
cwjcc$ echo hi ; echo hi <----- now it does...
|
||||
hi
|
||||
hi
|
||||
|
||||
I'll look at it today.
|
||||
|
||||
> - The sequence
|
||||
> echo foo > /dev/tty
|
||||
> cat bar
|
||||
> produces:
|
||||
> cat: write error: Bad file number
|
||||
|
||||
This only happens under Ultrix, too. It's another consequence of Dec's
|
||||
dup2 fuckup (I am *really*pissed*off* about it; it's caused me to waste a
|
||||
lot of time already). File descriptor 1 is getting set to close-on-exec.
|
||||
I haven't decided whether to hack around it in the code or to just make
|
||||
Ultrix use the dup2 emulation in general.c.
|
||||
|
||||
Cheers,
|
||||
|
||||
Chet
|
||||
|
||||
--
|
||||
Chet Ramey ``I die, Horatio''
|
||||
Network Services Group, Case Western Reserve University
|
||||
chet@ins.CWRU.Edu
|
||||
My opinions are just those, and mine alone.
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
Date: Tue, 06 Feb 2007 16:06:58 -0500
|
||||
From: Steve Grubb <sgrubb@redhat.com>
|
||||
Subject: Re: bash and linux audit
|
||||
To: chet.ramey@case.edu
|
||||
Organization: Red Hat
|
||||
|
||||
OK, I released audit 1.4 Sunday which has the logging function for user
|
||||
commands. It produces audit events like this:
|
||||
|
||||
type=USER_CMD msg=audit(01/30/2007 18:23:45.793:143) : user pid=22862 uid=root
|
||||
auid=root subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023
|
||||
msg='cwd=/root/test dir cmd=ls -l (terminal=tty1 res=success)'
|
||||
|
||||
diff -urp bash-3.2.orig/config-bot.h bash-3.2/config-bot.h
|
||||
--- bash-3.2.orig/config-bot.h 2007-01-03 09:01:05.000000000 -0500
|
||||
+++ bash-3.2/config-bot.h 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -97,6 +97,11 @@
|
||||
# define RESTRICTED_SHELL_NAME "rbash"
|
||||
#endif
|
||||
|
||||
+/* If the shell is called by this name, it will become audited. */
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+# define AUDIT_SHELL_NAME "aubash"
|
||||
+#endif
|
||||
+
|
||||
/***********************************************************/
|
||||
/* Make sure feature defines have necessary prerequisites. */
|
||||
/***********************************************************/
|
||||
diff -urp bash-3.2.orig/config.h.in bash-3.2/config.h.in
|
||||
--- bash-3.2.orig/config.h.in 2007-01-03 09:01:05.000000000 -0500
|
||||
+++ bash-3.2/config.h.in 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -81,6 +81,11 @@
|
||||
flag. */
|
||||
#undef RESTRICTED_SHELL
|
||||
|
||||
+/* Define AUDIT_SHELL if you want the generated shell to audit all
|
||||
+ actions performed by root account. The shell thus generated can become
|
||||
+ audited by being run with the name "aubash". */
|
||||
+#undef AUDIT_SHELL
|
||||
+
|
||||
/* Define DISABLED_BUILTINS if you want "builtin foo" to always run the
|
||||
shell builtin "foo", even if it has been disabled with "enable -n foo". */
|
||||
#undef DISABLED_BUILTINS
|
||||
diff -urp bash-3.2.orig/configure.in bash-3.2/configure.in
|
||||
--- bash-3.2.orig/configure.in 2007-01-03 09:01:05.000000000 -0500
|
||||
+++ bash-3.2/configure.in 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -162,6 +162,7 @@ opt_history=yes
|
||||
opt_bang_history=yes
|
||||
opt_dirstack=yes
|
||||
opt_restricted=yes
|
||||
+opt_audit=yes
|
||||
opt_process_subst=yes
|
||||
opt_prompt_decoding=yes
|
||||
opt_select=yes
|
||||
@@ -195,8 +196,8 @@ dnl a minimal configuration turns everyt
|
||||
dnl added individually
|
||||
if test $opt_minimal_config = yes; then
|
||||
opt_job_control=no opt_alias=no opt_readline=no
|
||||
- opt_history=no opt_bang_history=no opt_dirstack=no
|
||||
- opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
|
||||
+ opt_history=no opt_bang_history=no opt_dirstack=no opt_restricted=no
|
||||
+ opt_audit=no opt_process_subst=no opt_prompt_decoding=no
|
||||
opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
|
||||
opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
|
||||
opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
|
||||
@@ -227,6 +228,7 @@ AC_ARG_ENABLE(progcomp, AC_HELP_STRING([
|
||||
AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
|
||||
AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
|
||||
AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
|
||||
+AC_ARG_ENABLE(audit, AC_HELP_STRING([--enable-audit], [enable an audited shell]), opt_audit=$enableval)
|
||||
AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
|
||||
AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
|
||||
AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
|
||||
@@ -254,6 +256,10 @@ fi
|
||||
if test $opt_restricted = yes; then
|
||||
AC_DEFINE(RESTRICTED_SHELL)
|
||||
fi
|
||||
+if test $opt_audit = yes; then
|
||||
+AC_DEFINE(AUDIT_SHELL)
|
||||
+AUDIT_LIB='-laudit'
|
||||
+fi
|
||||
if test $opt_process_subst = yes; then
|
||||
AC_DEFINE(PROCESS_SUBSTITUTION)
|
||||
fi
|
||||
@@ -355,6 +361,8 @@ AC_SUBST(HELPDIRDEFINE)
|
||||
AC_SUBST(HELPINSTALL)
|
||||
AC_SUBST(HELPSTRINGS)
|
||||
|
||||
+AC_SUBST(AUDIT_LIB)
|
||||
+
|
||||
echo ""
|
||||
echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
|
||||
echo ""
|
||||
diff -urp bash-3.2.orig/doc/bash.1 bash-3.2/doc/bash.1
|
||||
--- bash-3.2.orig/doc/bash.1 2007-01-03 09:01:05.000000000 -0500
|
||||
+++ bash-3.2/doc/bash.1 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -155,6 +155,12 @@ single-character options to be recognize
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
+.B \-\-audit
|
||||
+The shell logs all commands run by the root user (see
|
||||
+.SM
|
||||
+.B "AUDIT SHELL"
|
||||
+below).
|
||||
+.TP
|
||||
.B \-\-debugger
|
||||
Arrange for the debugger profile to be executed before the shell
|
||||
starts.
|
||||
@@ -8770,6 +8776,17 @@ turns off any restrictions in the shell
|
||||
script.
|
||||
.\" end of rbash.1
|
||||
.if \n(zY=1 .ig zY
|
||||
+.SH "AUDIT SHELL"
|
||||
+.zY
|
||||
+.PP
|
||||
+If
|
||||
+.B bash
|
||||
+is started with the name
|
||||
+.BR aubash ,
|
||||
+or the
|
||||
+.B \-\-audit
|
||||
+option is supplied at invocation, the shell logs all commands issued by the root user to the audit system.
|
||||
+.if \n(zY=1 .ig zY
|
||||
.SH "SEE ALSO"
|
||||
.PD 0
|
||||
.TP
|
||||
diff -urp bash-3.2.orig/eval.c bash-3.2/eval.c
|
||||
--- bash-3.2.orig/eval.c 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/eval.c 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -45,6 +45,11 @@
|
||||
# include "bashhist.h"
|
||||
#endif
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+# include <libaudit.h>
|
||||
+# include <errno.h>
|
||||
+#endif
|
||||
+
|
||||
extern int EOF_reached;
|
||||
extern int indirection_level;
|
||||
extern int posixly_correct;
|
||||
@@ -58,6 +63,38 @@ extern int rpm_requires;
|
||||
static void send_pwd_to_eterm __P((void));
|
||||
static sighandler alrm_catcher __P((int));
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+static int audit_fd = -1;
|
||||
+
|
||||
+static int
|
||||
+audit_start ()
|
||||
+{
|
||||
+ audit_fd = audit_open ();
|
||||
+ if (audit_fd < 0)
|
||||
+ return -1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+audit (cmd, result)
|
||||
+ char *cmd;
|
||||
+ int result;
|
||||
+{
|
||||
+ int rc;
|
||||
+
|
||||
+ if (audit_fd < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ rc = audit_log_user_command (audit_fd, AUDIT_USER_CMD, cmd,
|
||||
+ NULL, !result);
|
||||
+ close (audit_fd);
|
||||
+ audit_fd = -1;
|
||||
+ return rc;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/* Read and execute commands until EOF is reached. This assumes that
|
||||
the input source has already been initialized. */
|
||||
int
|
||||
@@ -145,7 +182,25 @@ reader_loop ()
|
||||
|
||||
executing = 1;
|
||||
stdin_redir = 0;
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+ if (audited && interactive_shell && getuid () == 0)
|
||||
+ {
|
||||
+ if (audit_start () < 0)
|
||||
+ {
|
||||
+ if (errno != EINVAL && errno != EPROTONOSUPPORT &&
|
||||
+ errno != EAFNOSUPPORT)
|
||||
+ return EXECUTION_FAILURE;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
execute_command (current_command);
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+ {
|
||||
+ extern char *shell_input_line;
|
||||
+ audit (shell_input_line, last_command_exit_value);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
exec_done:
|
||||
QUIT;
|
||||
diff -urp bash-3.2.orig/externs.h bash-3.2/externs.h
|
||||
--- bash-3.2.orig/externs.h 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/externs.h 2007-01-20 12:05:00.000000000 -0500
|
||||
@@ -77,6 +77,10 @@ extern int shell_is_restricted __P((char
|
||||
extern int maybe_make_restricted __P((char *));
|
||||
#endif
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+extern int maybe_make_audited __P((char *));
|
||||
+#endif
|
||||
+
|
||||
extern void unset_bash_input __P((int));
|
||||
extern void get_current_user_info __P((void));
|
||||
|
||||
diff -urp bash-3.2.orig/flags.c bash-3.2/flags.c
|
||||
--- bash-3.2.orig/flags.c 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/flags.c 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -142,6 +142,12 @@ int restricted = 0; /* currently restri
|
||||
int restricted_shell = 0; /* shell was started in restricted mode. */
|
||||
#endif /* RESTRICTED_SHELL */
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+/* Non-zero means that this shell is audited. An audited shell records
|
||||
+ each command that the root user executes. */
|
||||
+int audited = 0; /* shell was started in audit mode. */
|
||||
+#endif /* AUDIT_SHELL */
|
||||
+
|
||||
/* Non-zero means that this shell is running in `privileged' mode. This
|
||||
is required if the shell is to run setuid. If the `-p' option is
|
||||
not supplied at startup, and the real and effective uids or gids
|
||||
diff -urp bash-3.2.orig/flags.h bash-3.2/flags.h
|
||||
--- bash-3.2.orig/flags.h 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/flags.h 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -66,6 +66,10 @@ extern int restricted;
|
||||
extern int restricted_shell;
|
||||
#endif /* RESTRICTED_SHELL */
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+extern int audited;
|
||||
+#endif /* AUDIT_SHELL */
|
||||
+
|
||||
extern int *find_flag __P((int));
|
||||
extern int change_flag __P((int, int));
|
||||
extern char *which_set_flags __P((void));
|
||||
Only in bash-3.2: .made
|
||||
diff -urp bash-3.2.orig/Makefile.in bash-3.2/Makefile.in
|
||||
--- bash-3.2.orig/Makefile.in 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/Makefile.in 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -366,6 +366,8 @@ MALLOC_LIBRARY = @MALLOC_LIBRARY@
|
||||
MALLOC_LDFLAGS = @MALLOC_LDFLAGS@
|
||||
MALLOC_DEP = @MALLOC_DEP@
|
||||
|
||||
+AUDIT_LIB = @AUDIT_LIB@
|
||||
+
|
||||
ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h $(ALLOC_LIBSRC)/shmalloc.h \
|
||||
$(ALLOC_LIBSRC)/imalloc.h $(ALLOC_LIBSRC)/mstats.h \
|
||||
$(ALLOC_LIBSRC)/table.h $(ALLOC_LIBSRC)/watch.h
|
||||
@@ -386,7 +388,7 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.
|
||||
$(BASHINCDIR)/ocache.h
|
||||
|
||||
LIBRARIES = $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
|
||||
- $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS)
|
||||
+ $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS) $(AUDIT_LIB)
|
||||
|
||||
LIBDEP = $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) $(GLOB_DEP) \
|
||||
$(TILDE_DEP) $(MALLOC_DEP)
|
||||
diff -urp bash-3.2.orig/parse.y bash-3.2/parse.y
|
||||
--- bash-3.2.orig/parse.y 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/parse.y 2007-01-20 11:59:23.000000000 -0500
|
||||
@@ -258,7 +258,7 @@ int need_here_doc;
|
||||
|
||||
/* Where shell input comes from. History expansion is performed on each
|
||||
line when the shell is interactive. */
|
||||
-static char *shell_input_line = (char *)NULL;
|
||||
+char *shell_input_line = (char *)NULL;
|
||||
static int shell_input_line_index;
|
||||
static int shell_input_line_size; /* Amount allocated for shell_input_line. */
|
||||
static int shell_input_line_len; /* strlen (shell_input_line) */
|
||||
diff -urp bash-3.2.orig/shell.c bash-3.2/shell.c
|
||||
--- bash-3.2.orig/shell.c 2007-01-03 09:01:06.000000000 -0500
|
||||
+++ bash-3.2/shell.c 2007-01-20 12:04:23.000000000 -0500
|
||||
@@ -240,6 +240,9 @@ struct {
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
{ "restricted", Int, &restricted, (char **)0x0 },
|
||||
#endif
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+ { "audit", Int, &audited, (char **)0x0 },
|
||||
+#endif
|
||||
{ "verbose", Int, &echo_input_at_read, (char **)0x0 },
|
||||
{ "version", Int, &do_version, (char **)0x0 },
|
||||
{ "wordexp", Int, &wordexp_only, (char **)0x0 },
|
||||
@@ -644,6 +647,10 @@ main (argc, argv, env)
|
||||
maybe_make_restricted (shell_name);
|
||||
#endif /* RESTRICTED_SHELL */
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+ maybe_make_audited (shell_name);
|
||||
+#endif
|
||||
+
|
||||
if (wordexp_only)
|
||||
{
|
||||
startup_state = 3;
|
||||
@@ -1143,6 +1150,29 @@ maybe_make_restricted (name)
|
||||
}
|
||||
#endif /* RESTRICTED_SHELL */
|
||||
|
||||
+#if defined (AUDIT_SHELL)
|
||||
+/* Perhaps make this shell an `audited' one, based on NAME. If the
|
||||
+ basename of NAME is "aubash", then this shell is audited. The
|
||||
+ name of the audited shell is a configurable option, see config.h.
|
||||
+ In an audited shell, all actions performed by root will be logged
|
||||
+ to the audit system.
|
||||
+ Do this also if `audited' is already set to 1 maybe the shell was
|
||||
+ started with --audit. */
|
||||
+int
|
||||
+maybe_make_audited (name)
|
||||
+ char *name;
|
||||
+{
|
||||
+ char *temp;
|
||||
+
|
||||
+ temp = base_pathname (name);
|
||||
+ if (*temp == '-')
|
||||
+ temp++;
|
||||
+ if (audited || (STREQ (temp, AUDIT_SHELL_NAME)))
|
||||
+ audited = 1;
|
||||
+ return (audited);
|
||||
+}
|
||||
+#endif /* AUDIT_SHELL */
|
||||
+
|
||||
/* Fetch the current set of uids and gids and return 1 if we're running
|
||||
setuid or setgid. */
|
||||
static int
|
||||
@@ -1,43 +0,0 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined (S_IFDIR) && !defined (S_ISDIR)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
|
||||
#endif
|
||||
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
struct stat sb;
|
||||
int r, fd;
|
||||
char fbuf[32];
|
||||
|
||||
r = stat("/dev/fd", &sb);
|
||||
/* test -d /dev/fd */
|
||||
if (r == -1 || S_ISDIR (sb.st_mode) == 0)
|
||||
exit (1);
|
||||
/* test -r /dev/fd/0 */
|
||||
r = access ("/dev/fd/0", R_OK);
|
||||
if (r == -1)
|
||||
exit (1);
|
||||
/* exec 3</dev/null */
|
||||
fd = open("/dev/null", O_RDONLY, 0666);
|
||||
if (fd == -1)
|
||||
exit (2);
|
||||
if (fd != 3 && (dup2(fd, 3) == -1))
|
||||
exit (1);
|
||||
/* test -r /dev/fd/3 */
|
||||
r = access("/dev/fd/3", R_OK);
|
||||
if (r == -1)
|
||||
exit (1);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined (S_IFDIR) && !defined (S_ISDIR)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
|
||||
#endif
|
||||
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
struct stat sb;
|
||||
int r, fd;
|
||||
char fbuf[32];
|
||||
|
||||
r = stat("/dev/fd", &sb);
|
||||
/* test -d /dev/fd */
|
||||
if (r == -1 || S_ISDIR (sb.st_mode) == 0)
|
||||
exit (1);
|
||||
/* test -r /dev/stdin < /dev/null */
|
||||
fd = open("/dev/null", O_RDONLY, 0666);
|
||||
if (fd == -1)
|
||||
exit (2);
|
||||
if (dup2(fd, 0) == -1)
|
||||
exit (1);
|
||||
r = access("/dev/stdin", R_OK);
|
||||
if (r == -1)
|
||||
exit (1);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#Date: Mon, 14 Dec 1998 23:10:43 -0800
|
||||
#From: John Kinsella <jlk@digex.net>
|
||||
#To: chet@po.cwru.edu
|
||||
#Subject: Re: bash patch
|
||||
|
||||
diff -c bash-2.02.1-old/bashhist.c bash-2.02.1/bashhist.c
|
||||
*** bash-2.02.1-old/bashhist.c Fri Feb 27 09:34:33 1998
|
||||
--- bash-2.02.1/bashhist.c Mon Dec 14 22:39:23 1998
|
||||
***************
|
||||
*** 50,55 ****
|
||||
--- 50,65 ----
|
||||
# include "bashline.h"
|
||||
#endif
|
||||
|
||||
+ /* SYSLOG_HISTORY - define this if you want all commands entered into
|
||||
+ * the shell to be echoed to syslog.
|
||||
+ * (feature added by John Kinsella<jlk@digex.net>)
|
||||
+ */
|
||||
+ #define SYSLOG_HISTORY 1
|
||||
+
|
||||
+ #if defined (SYSLOG_HISTORY)
|
||||
+ # include <syslog.h>
|
||||
+ #endif
|
||||
+
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
***************
|
||||
*** 566,571 ****
|
||||
--- 576,587 ----
|
||||
{
|
||||
hist_last_line_added = 1;
|
||||
add_history (line);
|
||||
+ /* next 3 lines added by John Kinsella<jlk@digex.net>
|
||||
+ * Sends history line to syslog.
|
||||
+ */
|
||||
+ #if defined( SYSLOG_HISTORY )
|
||||
+ syslog( LOG_INFO, "%d - %s", current_user.euid, line );
|
||||
+ #endif
|
||||
history_lines_this_session++;
|
||||
}
|
||||
using_history ();
|
||||
#
|
||||
#--
|
||||
#John Kinsella UNIX ISA
|
||||
#jlk@digex.net DIGEX West Coast Facility
|
||||
#voice 408-873-4278 pager 888-751-7595
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef INTMAX_MAX
|
||||
# ifdef LLONG_MAX
|
||||
# define INTMAX_MAX LLONG_MAX
|
||||
# else
|
||||
# define INTMAX_MAX LONG_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
main(int c, char **v)
|
||||
{
|
||||
printf ("%d\n", INT_MAX);
|
||||
printf ("%ld\n", LONG_MAX);
|
||||
printf ("%lld\n", INTMAX_MAX);
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,449 +0,0 @@
|
||||
From jwe@che.utexas.edu Wed Sep 21 17:23:40 1994
|
||||
Flags: 10
|
||||
Return-Path: jwe@che.utexas.edu
|
||||
Received: from po.CWRU.Edu (root@po.CWRU.Edu [129.22.4.2]) by odin.INS.CWRU.Edu with ESMTP (8.6.8.1+cwru/CWRU-2.1-ins)
|
||||
id RAA04010; Wed, 21 Sep 1994 17:23:39 -0400 (from jwe@che.utexas.edu for <chet@odin.INS.CWRU.Edu>)
|
||||
Received: from life.ai.mit.edu (life.ai.mit.edu [128.52.32.80]) by po.CWRU.Edu with SMTP (8.6.8.1+cwru/CWRU-2.2)
|
||||
id RAA02121; Wed, 21 Sep 1994 17:23:28 -0400 (from jwe@che.utexas.edu for <chet@po.cwru.edu>)
|
||||
Received: from schoch.che.utexas.edu by life.ai.mit.edu (4.1/AI-4.10) for chet@po.cwru.edu id AA09989; Wed, 21 Sep 94 17:23:17 EDT
|
||||
Received: from localhost (jwe@localhost) by schoch.che.utexas.edu (8.6.8.1/8.6) with SMTP id QAA05737; Wed, 21 Sep 1994 16:22:01 -0500
|
||||
Message-Id: <199409212122.QAA05737@schoch.che.utexas.edu>
|
||||
To: march@tudor.com
|
||||
Cc: bug-bash@prep.ai.mit.edu
|
||||
Subject: Re: Completion feature possible?
|
||||
In-Reply-To: Your message of 21 Sep 94 13:30:22 EDT
|
||||
Date: Wed, 21 Sep 94 16:22:00 EDT
|
||||
From: John Eaton <jwe@che.utexas.edu>
|
||||
|
||||
Gregory F. March <march@tudor.com> wrote:
|
||||
|
||||
: I was having a discussion about MH with one of my friends the other
|
||||
: day and I got to thinking that the +folder/subfolder scheme for naming
|
||||
: mail folders is a real pain because completion doesn't work on
|
||||
: them. Someone then mentioned that zsh (I think) has the ability to
|
||||
: specify how to complete (I guess where to look for the files) for
|
||||
: different prefixes. Bash right now knows about '@', '~', and '$' (any
|
||||
: others?). It would be really helpful if one could define something
|
||||
: like:
|
||||
:
|
||||
: completion '+' "$HOME/Mail"
|
||||
:
|
||||
: in a config file someplace. Would this be easy? Is there a list of
|
||||
: TODO item that someone might want to add this to?
|
||||
|
||||
It would be nice to have a general completion feature like this.
|
||||
|
||||
Until that happens, maybe you will find the following patch useful.
|
||||
It makes MH folder name completion work with bash. The diffs are
|
||||
relative to version 1.14.2.
|
||||
|
||||
I realize that changes to readline.c and and complete.c are not good
|
||||
since they add some MH-specific stuff to the readline code and not to
|
||||
bash, but when I first wrote this, I had no idea what else to do.
|
||||
|
||||
Chet, would you consider adding this if it were cleaned up a bit?
|
||||
Made optional with cpp conditionals?
|
||||
|
||||
This feature has been very useful to me for the last several years
|
||||
(since about 1.05 or 1.06, I think).
|
||||
|
||||
Thanks,
|
||||
|
||||
--
|
||||
John W. Eaton | 4.3BSD is not perfect. -- Leffler, et al. (1989).
|
||||
jwe@che.utexas.edu |
|
||||
|
||||
|
||||
-------------------------------cut here-------------------------------
|
||||
diff -rc bash-1.14.2/bashline.c bash-1.14.2.local/bashline.c
|
||||
*** bash-1.14.2/bashline.c Wed Aug 3 09:32:45 1994
|
||||
--- bash-1.14.2.local/bashline.c Wed Sep 21 15:39:04 1994
|
||||
***************
|
||||
*** 58,63 ****
|
||||
--- 58,64 ----
|
||||
static char *hostname_completion_function ();
|
||||
static char *command_word_completion_function ();
|
||||
static char *command_subst_completion_function ();
|
||||
+ static char *mh_folder_completion_function ();
|
||||
|
||||
static void snarf_hosts_from_file (), add_host_name ();
|
||||
static void sort_hostname_list ();
|
||||
***************
|
||||
*** 90,95 ****
|
||||
--- 91,98 ----
|
||||
bash_complete_username_internal (),
|
||||
bash_complete_hostname (), bash_possible_hostname_completions (),
|
||||
bash_complete_hostname_internal (),
|
||||
+ bash_complete_mh_folder (), bash_possible_mh_folder_completions (),
|
||||
+ bash_complete_mh_folder_internal (),
|
||||
bash_complete_variable (), bash_possible_variable_completions (),
|
||||
bash_complete_variable_internal (),
|
||||
bash_complete_command (), bash_possible_command_completions (),
|
||||
***************
|
||||
*** 134,140 ****
|
||||
rl_terminal_name = get_string_value ("TERM");
|
||||
rl_instream = stdin;
|
||||
rl_outstream = stderr;
|
||||
! rl_special_prefixes = "$@";
|
||||
|
||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||
rl_readline_name = "Bash";
|
||||
--- 137,143 ----
|
||||
rl_terminal_name = get_string_value ("TERM");
|
||||
rl_instream = stdin;
|
||||
rl_outstream = stderr;
|
||||
! rl_special_prefixes = "$@+";
|
||||
|
||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||
rl_readline_name = "Bash";
|
||||
***************
|
||||
*** 193,198 ****
|
||||
--- 196,207 ----
|
||||
rl_bind_key_in_map ('@', bash_possible_hostname_completions,
|
||||
emacs_ctlx_keymap);
|
||||
|
||||
+ rl_add_defun ("complete-mh-folder", bash_complete_mh_folder, META('+'));
|
||||
+ rl_add_defun ("possible-mh-folder-completions",
|
||||
+ bash_possible_mh_folder_completions, -1);
|
||||
+ rl_bind_key_in_map ('+', bash_possible_mh_folder_completions,
|
||||
+ emacs_ctlx_keymap);
|
||||
+
|
||||
rl_add_defun ("complete-variable", bash_complete_variable, -1);
|
||||
rl_bind_key_in_map ('$', bash_complete_variable, emacs_meta_keymap);
|
||||
rl_add_defun ("possible-variable-completions",
|
||||
***************
|
||||
*** 656,661 ****
|
||||
--- 665,677 ----
|
||||
if (!matches && *text == '@')
|
||||
matches = completion_matches (text, hostname_completion_function);
|
||||
|
||||
+ /* Another one. Why not? If the word starts in '+', then look for
|
||||
+ matching mh folders for completion first. */
|
||||
+ if (!matches && *text == '+')
|
||||
+ {
|
||||
+ matches = completion_matches (text, mh_folder_completion_function);
|
||||
+ }
|
||||
+
|
||||
/* And last, (but not least) if this word is in a command position, then
|
||||
complete over possible command names, including aliases, functions,
|
||||
and command names. */
|
||||
***************
|
||||
*** 1077,1082 ****
|
||||
--- 1093,1185 ----
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
+ /* How about a completion function for mh folders? */
|
||||
+ static char *
|
||||
+ mh_folder_completion_function (text, state)
|
||||
+ int state;
|
||||
+ char *text;
|
||||
+ {
|
||||
+ extern int rl_filename_completion_desired;
|
||||
+
|
||||
+ extern char *get_mh_path ();
|
||||
+
|
||||
+ static char *mh_path = (char *)NULL;
|
||||
+ static int len;
|
||||
+ static int istate;
|
||||
+ static char *val;
|
||||
+ char *hint;
|
||||
+
|
||||
+ static char *mh_folder_hint = (char *)NULL;
|
||||
+
|
||||
+ /* If we don't have any state, make some. */
|
||||
+ if (!state)
|
||||
+ {
|
||||
+ val = (char *)NULL;
|
||||
+
|
||||
+ if (mh_path)
|
||||
+ free (mh_path);
|
||||
+
|
||||
+ mh_path = get_mh_path ();
|
||||
+ if (!mh_path && !(hint[1] == '/' || hint[1] == '.'))
|
||||
+ return ((char *)NULL);
|
||||
+
|
||||
+ len = strlen (mh_path);
|
||||
+ }
|
||||
+
|
||||
+ if (mh_folder_hint)
|
||||
+ free (mh_folder_hint);
|
||||
+
|
||||
+ hint = text;
|
||||
+ if (*hint == '+')
|
||||
+ hint++;
|
||||
+
|
||||
+ mh_folder_hint = (char *)xmalloc (2 + len + strlen (hint));
|
||||
+ if (*hint == '/' || *hint == '.') {
|
||||
+ len = -1;
|
||||
+ sprintf (mh_folder_hint, "%s", hint);
|
||||
+ } else
|
||||
+ sprintf (mh_folder_hint, "%s/%s", mh_path, hint);
|
||||
+
|
||||
+ istate = (val != (char *)NULL);
|
||||
+
|
||||
+ again:
|
||||
+ val = filename_completion_function (mh_folder_hint, istate);
|
||||
+ istate = 1;
|
||||
+
|
||||
+ if (!val)
|
||||
+ {
|
||||
+ return ((char *)NULL);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ char *ptr = val + len + 1, *temp;
|
||||
+ struct stat sb;
|
||||
+ int status = stat (val, &sb);
|
||||
+
|
||||
+ if (status != 0)
|
||||
+ return ((char *)NULL);
|
||||
+
|
||||
+ if ((sb.st_mode & S_IFDIR) == S_IFDIR)
|
||||
+ {
|
||||
+ temp = (char *)xmalloc (2 + strlen (ptr));
|
||||
+ *temp = '+';
|
||||
+ strcpy (temp + 1, ptr);
|
||||
+
|
||||
+ free (val);
|
||||
+ val = "";
|
||||
+
|
||||
+ rl_filename_completion_desired = 1;
|
||||
+
|
||||
+ return (temp);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ free (val);
|
||||
+ }
|
||||
+ goto again;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* History and alias expand the line. */
|
||||
static char *
|
||||
history_expand_line_internal (line)
|
||||
***************
|
||||
*** 1628,1633 ****
|
||||
--- 1731,1773 ----
|
||||
{
|
||||
bash_specific_completion
|
||||
(what_to_do, (Function *)username_completion_function);
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+ bash_complete_mh_folder (ignore, ignore2)
|
||||
+ int ignore, ignore2;
|
||||
+ {
|
||||
+ bash_complete_mh_folder_internal (TAB);
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+ bash_possible_mh_folder_completions (ignore, ignore2)
|
||||
+ int ignore, ignore2;
|
||||
+ {
|
||||
+ bash_complete_mh_folder_internal ('?');
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+ bash_complete_mh_folder_internal (what_to_do)
|
||||
+ int what_to_do;
|
||||
+ {
|
||||
+ Function *orig_func;
|
||||
+ CPPFunction *orig_attempt_func;
|
||||
+ char *orig_rl_completer_word_break_characters;
|
||||
+ extern char *rl_completer_word_break_characters;
|
||||
+
|
||||
+ orig_func = rl_completion_entry_function;
|
||||
+ orig_attempt_func = rl_attempted_completion_function;
|
||||
+ orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
|
||||
+ rl_completion_entry_function = (Function *)mh_folder_completion_function;
|
||||
+ rl_attempted_completion_function = (CPPFunction *)NULL;
|
||||
+ rl_completer_word_break_characters = " \t\n\"\'";
|
||||
+
|
||||
+ rl_complete_internal (what_to_do);
|
||||
+
|
||||
+ rl_completion_entry_function = orig_func;
|
||||
+ rl_attempted_completion_function = orig_attempt_func;
|
||||
+ rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
|
||||
}
|
||||
|
||||
static void
|
||||
Only in bash-1.14.2.local: bashline.c.orig
|
||||
diff -rc bash-1.14.2/lib/readline/complete.c bash-1.14.2.local/lib/readline/complete.c
|
||||
*** bash-1.14.2/lib/readline/complete.c Tue Jul 26 12:59:57 1994
|
||||
--- bash-1.14.2.local/lib/readline/complete.c Wed Sep 21 15:41:19 1994
|
||||
***************
|
||||
*** 733,751 ****
|
||||
if (rl_filename_completion_desired)
|
||||
{
|
||||
struct stat finfo;
|
||||
! char *filename = tilde_expand (matches[0]);
|
||||
|
||||
! if ((stat (filename, &finfo) == 0) && S_ISDIR (finfo.st_mode))
|
||||
{
|
||||
! if (rl_line_buffer[rl_point] != '/')
|
||||
! rl_insert_text ("/");
|
||||
}
|
||||
! else
|
||||
{
|
||||
! if (rl_point == rl_end)
|
||||
! rl_insert_text (temp_string);
|
||||
}
|
||||
- free (filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
--- 733,768 ----
|
||||
if (rl_filename_completion_desired)
|
||||
{
|
||||
struct stat finfo;
|
||||
! char *tilde_expand ();
|
||||
! char *plus_expand ();
|
||||
! char *filename = (char *) NULL;
|
||||
|
||||
! switch (*matches[0])
|
||||
{
|
||||
! case '+':
|
||||
! filename = plus_expand (matches[0]);
|
||||
! break;
|
||||
! case '~':
|
||||
! default:
|
||||
! filename = tilde_expand (matches[0]);
|
||||
! break;
|
||||
}
|
||||
!
|
||||
! if (filename)
|
||||
{
|
||||
! if ((stat (filename, &finfo) == 0)
|
||||
! && S_ISDIR (finfo.st_mode))
|
||||
! {
|
||||
! if (rl_line_buffer[rl_point] != '/')
|
||||
! rl_insert_text ("/");
|
||||
! }
|
||||
! else
|
||||
! {
|
||||
! if (rl_point == rl_end)
|
||||
! rl_insert_text (temp_string);
|
||||
! }
|
||||
! free (filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Only in bash-1.14.2.local/lib/readline: diffs
|
||||
diff -rc bash-1.14.2/lib/readline/readline.c bash-1.14.2.local/lib/readline/readline.c
|
||||
*** bash-1.14.2/lib/readline/readline.c Fri Aug 12 12:47:46 1994
|
||||
--- bash-1.14.2.local/lib/readline/readline.c Wed Sep 21 15:36:07 1994
|
||||
***************
|
||||
*** 23,28 ****
|
||||
--- 23,29 ----
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#include <stdio.h>
|
||||
+ #include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#if !defined (NO_SYS_FILE)
|
||||
***************
|
||||
*** 3518,3523 ****
|
||||
--- 3519,3616 ----
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
+
|
||||
+ #define cr_whitespace(c) ((c) == '\r' || (c) == '\n' || whitespace(c))
|
||||
+
|
||||
+ char *
|
||||
+ get_mh_path ()
|
||||
+ {
|
||||
+ static FILE *fp = (FILE *)NULL;
|
||||
+ char buf[512]; /* XXX */
|
||||
+ char profile[512]; /* XXX */
|
||||
+ char *bp;
|
||||
+ char *temp_home;
|
||||
+ char *temp_path;
|
||||
+
|
||||
+ temp_home = (char *)getenv ("HOME");
|
||||
+ if (!temp_home)
|
||||
+ return ((char *)NULL);
|
||||
+
|
||||
+ strcpy (profile, temp_home);
|
||||
+ strcat (profile, "/.mh_profile");
|
||||
+
|
||||
+ if (fp)
|
||||
+ fclose (fp);
|
||||
+
|
||||
+ fp = fopen (profile, "r");
|
||||
+ if (fp == (FILE *)NULL)
|
||||
+ return ((char *)NULL);
|
||||
+
|
||||
+ while (fgets (buf, 512, fp) != (char *)NULL) /* XXX */
|
||||
+ {
|
||||
+ if ((bp = strstr (buf, "Path:")) != (char *)NULL)
|
||||
+ {
|
||||
+ bp += 5;
|
||||
+ while (whitespace (*bp))
|
||||
+ bp++;
|
||||
+
|
||||
+ if (*bp == '\0')
|
||||
+ return ((char *)NULL);
|
||||
+
|
||||
+ temp_path = (char *)xmalloc (3 + strlen (bp) + strlen (temp_home));
|
||||
+
|
||||
+ strcpy (temp_path, temp_home);
|
||||
+ strcat (temp_path, "/");
|
||||
+ strcat (temp_path, bp);
|
||||
+
|
||||
+ bp = temp_path;
|
||||
+
|
||||
+ while (!(cr_whitespace (*bp)))
|
||||
+ bp++;
|
||||
+
|
||||
+ *bp = '\0';
|
||||
+
|
||||
+ return temp_path;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ((char *)NULL);
|
||||
+ }
|
||||
+
|
||||
+ /* Expand FILENAME if it begins with a plus. This always returns
|
||||
+ a new string. */
|
||||
+ char *
|
||||
+ plus_expand (filename)
|
||||
+ char *filename;
|
||||
+ {
|
||||
+ static char *dirname = (char *)NULL;
|
||||
+
|
||||
+ if (filename && *filename == '+')
|
||||
+ {
|
||||
+ char *mh_path = get_mh_path ();
|
||||
+
|
||||
+ if (filename[1] == '/' || filename[1] == '.')
|
||||
+ {
|
||||
+ dirname = (char *)xmalloc (1 + strlen (filename));
|
||||
+
|
||||
+ strcpy(dirname, filename+1);
|
||||
+
|
||||
+ return dirname;
|
||||
+ }
|
||||
+
|
||||
+ if (mh_path)
|
||||
+ {
|
||||
+ dirname = (char *)xmalloc (1 + strlen (filename) + strlen (mh_path));
|
||||
+
|
||||
+ strcpy (dirname, mh_path);
|
||||
+ strcat (dirname, "/");
|
||||
+ strcat (dirname, filename+1);
|
||||
+
|
||||
+ return dirname;
|
||||
+ }
|
||||
+ }
|
||||
+ return (char *)NULL;
|
||||
+ }
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int
|
||||
qsort_strcmp(s1, s2)
|
||||
char **s1, **s2;
|
||||
{
|
||||
return (strcoll(*s1, *s2));
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "asort: usage: asort [-v] args\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
int i, verbose;
|
||||
char *dlocale;
|
||||
|
||||
verbose = 0;
|
||||
while ((i = getopt(c, v, "v")) != -1) {
|
||||
switch (i) {
|
||||
case 'v':
|
||||
verbose = 1; break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
c -= optind;
|
||||
v += optind;
|
||||
|
||||
dlocale = setlocale(LC_ALL, "");
|
||||
if (verbose)
|
||||
printf("default locale = %s\n", dlocale ? dlocale : "''");
|
||||
qsort(v, c, sizeof(char *), qsort_strcmp);
|
||||
for (i = 0; i < c; i++) {
|
||||
printf("%s ", v[i]);
|
||||
}
|
||||
printf("\n");
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -1,21 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
union {
|
||||
long int l;
|
||||
char c[sizeof(long int)];
|
||||
} u;
|
||||
int x0, x1, x2, x3;
|
||||
|
||||
u.l = 1;
|
||||
x0 = u.c[0];
|
||||
x3 = u.c[sizeof (long int) - 1];
|
||||
printf ("x0 = %d x3 = %d (%s)\n", x0, x3, x3 == 1 ? "bigendian" : "littleendian");
|
||||
x0 = u.l >> 24;
|
||||
x1 = u.l >> 16;
|
||||
x2 = u.l >> 8;
|
||||
x3 = u.l & 0xff;
|
||||
printf ("x0:x3: %d %d %d %d\n", x0, x1, x2, x3);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int i = 0x12345678;
|
||||
char *x;
|
||||
|
||||
x = (char *)&i;
|
||||
printf ("0x%x\n", *x);
|
||||
printf ((*x == 0x78) ? "little endian\n" : "big endian\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
union {
|
||||
int l;
|
||||
char c[sizeof(int)];
|
||||
} u;
|
||||
int x0, x1, x2, x3;
|
||||
|
||||
u.l = 0x012345678;
|
||||
x0 = u.c[0];
|
||||
x3 = u.c[sizeof (int) - 1];
|
||||
printf ("x0 = 0x%x x3 = 0x%x (%s)\n", x0, x3, x3 == 0x78 ? "bigendian" : "littleendian");
|
||||
x0 = (u.l >> 24) & 0xff;
|
||||
x1 = (u.l >> 16) & 0xff;
|
||||
x2 = (u.l >> 8) & 0xff;
|
||||
x3 = u.l & 0xff;
|
||||
printf ("big endian x0:x3: %x %x %x %x\n", x0, x1, x2, x3);
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)getcwd.c 5.11 (Berkeley) 2/24/91";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#if defined (HAVE_DIRENT_H)
|
||||
#include <dirent.h>
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DIRENT_H
|
||||
# define dirent direct
|
||||
#endif
|
||||
|
||||
#define ISDOT(dp) \
|
||||
(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
|
||||
dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
|
||||
|
||||
#ifndef dirfd
|
||||
# define dirfd(d) ((d)->dd_fd)
|
||||
#endif
|
||||
|
||||
char *
|
||||
getcwd(pt, size)
|
||||
char *pt;
|
||||
size_t size;
|
||||
{
|
||||
register struct dirent *dp;
|
||||
register DIR *dir;
|
||||
register dev_t dev;
|
||||
register ino_t ino;
|
||||
register int first;
|
||||
register char *bpt, *bup;
|
||||
struct stat s;
|
||||
dev_t root_dev;
|
||||
ino_t root_ino;
|
||||
size_t ptsize, upsize;
|
||||
int save_errno;
|
||||
char *ept, *eup, *up;
|
||||
|
||||
/*
|
||||
* If no buffer specified by the user, allocate one as necessary.
|
||||
* If a buffer is specified, the size has to be non-zero. The path
|
||||
* is built from the end of the buffer backwards.
|
||||
*/
|
||||
if (pt) {
|
||||
ptsize = 0;
|
||||
if (!size) {
|
||||
errno = EINVAL;
|
||||
return((char *)NULL);
|
||||
}
|
||||
ept = pt + size;
|
||||
} else {
|
||||
if (!(pt = (char *)malloc(ptsize = 1024 - 4)))
|
||||
return((char *)NULL);
|
||||
ept = pt + ptsize;
|
||||
}
|
||||
bpt = ept - 1;
|
||||
*bpt = '\0';
|
||||
|
||||
/*
|
||||
* Allocate bytes (1024 - malloc space) for the string of "../"'s.
|
||||
* Should always be enough (it's 340 levels). If it's not, allocate
|
||||
* as necessary. Special * case the first stat, it's ".", not "..".
|
||||
*/
|
||||
if (!(up = (char *)malloc(upsize = 1024 - 4)))
|
||||
goto err;
|
||||
eup = up + MAXPATHLEN;
|
||||
bup = up;
|
||||
up[0] = '.';
|
||||
up[1] = '\0';
|
||||
|
||||
/* Save root values, so know when to stop. */
|
||||
if (stat("/", &s))
|
||||
goto err;
|
||||
root_dev = s.st_dev;
|
||||
root_ino = s.st_ino;
|
||||
|
||||
errno = 0; /* XXX readdir has no error return. */
|
||||
|
||||
for (first = 1;; first = 0) {
|
||||
/* Stat the current level. */
|
||||
if (lstat(up, &s))
|
||||
goto err;
|
||||
|
||||
/* Save current node values. */
|
||||
ino = s.st_ino;
|
||||
dev = s.st_dev;
|
||||
|
||||
/* Check for reaching root. */
|
||||
if (root_dev == dev && root_ino == ino) {
|
||||
*--bpt = '/';
|
||||
/*
|
||||
* It's unclear that it's a requirement to copy the
|
||||
* path to the beginning of the buffer, but it's always
|
||||
* been that way and stuff would probably break.
|
||||
*/
|
||||
(void)bcopy(bpt, pt, ept - bpt);
|
||||
free(up);
|
||||
return(pt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build pointer to the parent directory, allocating memory
|
||||
* as necessary. Max length is 3 for "../", the largest
|
||||
* possible component name, plus a trailing NULL.
|
||||
*/
|
||||
if (bup + 3 + MAXNAMLEN + 1 >= eup) {
|
||||
if (!(up = (char *)realloc(up, upsize *= 2)))
|
||||
goto err;
|
||||
eup = up + upsize;
|
||||
}
|
||||
*bup++ = '.';
|
||||
*bup++ = '.';
|
||||
*bup = '\0';
|
||||
|
||||
/* Open and stat parent directory. */
|
||||
if (!(dir = opendir(up)) || fstat(dirfd(dir), &s))
|
||||
goto err;
|
||||
|
||||
/* Add trailing slash for next directory. */
|
||||
*bup++ = '/';
|
||||
|
||||
/*
|
||||
* If it's a mount point, have to stat each element because
|
||||
* the inode number in the directory is for the entry in the
|
||||
* parent directory, not the inode number of the mounted file.
|
||||
*/
|
||||
save_errno = 0;
|
||||
if (s.st_dev == dev) {
|
||||
for (;;) {
|
||||
if (!(dp = readdir(dir)))
|
||||
goto notfound;
|
||||
if (dp->d_fileno == ino)
|
||||
break;
|
||||
}
|
||||
} else
|
||||
for (;;) {
|
||||
if (!(dp = readdir(dir)))
|
||||
goto notfound;
|
||||
if (ISDOT(dp))
|
||||
continue;
|
||||
bcopy(dp->d_name, bup, dp->d_namlen + 1);
|
||||
|
||||
/* Save the first error for later. */
|
||||
if (lstat(up, &s)) {
|
||||
if (!save_errno)
|
||||
save_errno = errno;
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
if (s.st_dev == dev && s.st_ino == ino)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for length of the current name, preceding slash,
|
||||
* leading slash.
|
||||
*/
|
||||
if (bpt - pt <= dp->d_namlen + (first ? 1 : 2)) {
|
||||
size_t len, off;
|
||||
|
||||
if (!ptsize) {
|
||||
errno = ERANGE;
|
||||
goto err;
|
||||
}
|
||||
off = bpt - pt;
|
||||
len = ept - bpt;
|
||||
if (!(pt = (char *)realloc(pt, ptsize *= 2)))
|
||||
goto err;
|
||||
bpt = pt + off;
|
||||
ept = pt + ptsize;
|
||||
(void)bcopy(bpt, ept - len, len);
|
||||
bpt = ept - len;
|
||||
}
|
||||
if (!first)
|
||||
*--bpt = '/';
|
||||
bpt -= dp->d_namlen;
|
||||
bcopy(dp->d_name, bpt, dp->d_namlen);
|
||||
(void)closedir(dir);
|
||||
|
||||
/* Truncate any file name. */
|
||||
*bup = '\0';
|
||||
}
|
||||
|
||||
notfound:
|
||||
/*
|
||||
* If readdir set errno, use it, not any saved error; otherwise,
|
||||
* didn't find the current directory in its parent directory, set
|
||||
* errno to ENOENT.
|
||||
*/
|
||||
if (!errno)
|
||||
errno = save_errno ? save_errno : ENOENT;
|
||||
/* FALLTHROUGH */
|
||||
err:
|
||||
if (ptsize)
|
||||
free(pt);
|
||||
free(up);
|
||||
return((char *)NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
getwd(buf)
|
||||
char *buf;
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (p = getcwd(buf, MAXPATHLEN))
|
||||
return(p);
|
||||
(void)strcpy(buf, strerror(errno));
|
||||
return((char *)NULL);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (sizeof(char *) == sizeof(long))
|
||||
printf("long\n");
|
||||
else if (sizeof(char *) == sizeof(short))
|
||||
printf("short\n");
|
||||
else
|
||||
printf("int\n");
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
main(c, v, e)
|
||||
int c;
|
||||
char **v, **e;
|
||||
{
|
||||
close(0);
|
||||
execv(v[1], v+1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/* $Header:cat.c 12.0$ */
|
||||
/* $ACIS:cat.c 12.0$ */
|
||||
/* $Source: /ibm/acis/usr/src/bin/RCS/cat.c,v $ */
|
||||
|
||||
#ifndef lint
|
||||
static char *rcsid = "$Header:cat.c 12.0$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)cat.c 5.2 (Berkeley) 12/6/85";
|
||||
#endif not lint
|
||||
|
||||
/*
|
||||
* Concatenate files.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* #define OPTSIZE BUFSIZ /* define this only if not 4.2 BSD or beyond */
|
||||
|
||||
int bflg, eflg, nflg, sflg, tflg, uflg, vflg;
|
||||
int spaced, col, lno, inline, ibsize, obsize;
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
sigpipe()
|
||||
{
|
||||
write(2, "pcat: caught SIGPIPE\n", 21);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
int fflg = 0;
|
||||
register FILE *fi;
|
||||
register c;
|
||||
int dev, ino = -1;
|
||||
struct stat statb;
|
||||
int retval = 0;
|
||||
|
||||
signal(SIGPIPE, sigpipe);
|
||||
lno = 1;
|
||||
for( ; argc>1 && argv[1][0]=='-'; argc--,argv++) {
|
||||
switch(argv[1][1]) {
|
||||
case 0:
|
||||
break;
|
||||
case 'u':
|
||||
setbuf(stdout, (char *)NULL);
|
||||
uflg++;
|
||||
continue;
|
||||
case 'n':
|
||||
nflg++;
|
||||
continue;
|
||||
case 'b':
|
||||
bflg++;
|
||||
nflg++;
|
||||
continue;
|
||||
case 'v':
|
||||
vflg++;
|
||||
continue;
|
||||
case 's':
|
||||
sflg++;
|
||||
continue;
|
||||
case 'e':
|
||||
eflg++;
|
||||
vflg++;
|
||||
continue;
|
||||
case 't':
|
||||
tflg++;
|
||||
vflg++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (fstat(fileno(stdout), &statb) == 0) {
|
||||
statb.st_mode &= S_IFMT;
|
||||
if (statb.st_mode!=S_IFCHR && statb.st_mode!=S_IFBLK) {
|
||||
dev = statb.st_dev;
|
||||
ino = statb.st_ino;
|
||||
}
|
||||
#ifndef OPTSIZE
|
||||
obsize = statb.st_blksize;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
obsize = 0;
|
||||
if (argc < 2) {
|
||||
argc = 2;
|
||||
fflg++;
|
||||
}
|
||||
while (--argc > 0) {
|
||||
if (fflg || (*++argv)[0]=='-' && (*argv)[1]=='\0')
|
||||
fi = stdin;
|
||||
else {
|
||||
if ((fi = fopen(*argv, "r")) == NULL) {
|
||||
perror(*argv);
|
||||
retval = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (fstat(fileno(fi), &statb) == 0) {
|
||||
if ((statb.st_mode & S_IFMT) == S_IFREG &&
|
||||
statb.st_dev==dev && statb.st_ino==ino) {
|
||||
fprintf(stderr, "cat: input %s is output\n",
|
||||
fflg?"-": *argv);
|
||||
fclose(fi);
|
||||
retval = 1;
|
||||
continue;
|
||||
}
|
||||
#ifndef OPTSIZE
|
||||
ibsize = statb.st_blksize;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
ibsize = 0;
|
||||
if (nflg||sflg||vflg)
|
||||
copyopt(fi);
|
||||
else if (uflg) {
|
||||
while ((c = getc(fi)) != EOF)
|
||||
putchar(c);
|
||||
} else
|
||||
retval |= fastcat(fileno(fi)); /* no flags specified */
|
||||
if (fi!=stdin)
|
||||
fclose(fi);
|
||||
else
|
||||
clearerr(fi); /* reset sticky eof */
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "cat: output write error\n");
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
exit(retval);
|
||||
}
|
||||
|
||||
copyopt(f)
|
||||
register FILE *f;
|
||||
{
|
||||
register int c;
|
||||
|
||||
top:
|
||||
c = getc(f);
|
||||
if (c == EOF)
|
||||
return;
|
||||
if (c == '\n') {
|
||||
if (inline == 0) {
|
||||
if (sflg && spaced)
|
||||
goto top;
|
||||
spaced = 1;
|
||||
}
|
||||
if (nflg && bflg==0 && inline == 0)
|
||||
printf("%6d\t", lno++);
|
||||
if (eflg)
|
||||
putchar('$');
|
||||
putchar('\n');
|
||||
inline = 0;
|
||||
goto top;
|
||||
}
|
||||
if (nflg && inline == 0)
|
||||
printf("%6d\t", lno++);
|
||||
inline = 1;
|
||||
if (vflg) {
|
||||
if (tflg==0 && c == '\t')
|
||||
putchar(c);
|
||||
else {
|
||||
if (c > 0177) {
|
||||
printf("M-");
|
||||
c &= 0177;
|
||||
}
|
||||
if (c < ' ')
|
||||
printf("^%c", c+'@');
|
||||
else if (c == 0177)
|
||||
printf("^?");
|
||||
else
|
||||
putchar(c);
|
||||
}
|
||||
} else
|
||||
putchar(c);
|
||||
spaced = 0;
|
||||
goto top;
|
||||
}
|
||||
|
||||
fastcat(fd)
|
||||
register int fd;
|
||||
{
|
||||
register int buffsize, n, nwritten, offset;
|
||||
register char *buff;
|
||||
struct stat statbuff;
|
||||
char *malloc();
|
||||
|
||||
#ifndef OPTSIZE
|
||||
if (obsize)
|
||||
buffsize = obsize; /* common case, use output blksize */
|
||||
else if (ibsize)
|
||||
buffsize = ibsize;
|
||||
else
|
||||
buffsize = BUFSIZ;
|
||||
#else
|
||||
buffsize = OPTSIZE;
|
||||
#endif
|
||||
|
||||
if ((buff = malloc(buffsize)) == NULL) {
|
||||
perror("cat: no memory");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that on some systems (V7), very large writes to a pipe
|
||||
* return less than the requested size of the write.
|
||||
* In this case, multiple writes are required.
|
||||
*/
|
||||
while ((n = read(fd, buff, buffsize)) > 0) {
|
||||
offset = 0;
|
||||
do {
|
||||
nwritten = write(fileno(stdout), &buff[offset], n);
|
||||
if (nwritten <= 0) {
|
||||
perror("cat: write error");
|
||||
exit(2);
|
||||
}
|
||||
offset += nwritten;
|
||||
} while ((n -= nwritten) > 0);
|
||||
}
|
||||
|
||||
free(buff);
|
||||
if (n < 0) {
|
||||
perror("cat: read error");
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int pid;
|
||||
int pg1;
|
||||
|
||||
main()
|
||||
{
|
||||
pid = getpid();
|
||||
pg1 = getpgrp(0);
|
||||
|
||||
printf("pid = %d, pgrp = %d\n", pid, pg1);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
fprintf(stderr, "%d\n", getpid());
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "rangecmp: usage: rangecmp [-v] start test end\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
int i, verbose, r1, r2;
|
||||
char *dlocale;
|
||||
|
||||
verbose = 0;
|
||||
while ((i = getopt(c, v, "v")) != -1) {
|
||||
switch (i) {
|
||||
case 'v':
|
||||
verbose = 1; break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
c -= optind;
|
||||
v += optind;
|
||||
|
||||
dlocale = setlocale(LC_ALL, "");
|
||||
if (verbose)
|
||||
printf("default locale = %s\n", dlocale ? dlocale : "''");
|
||||
r1 = strcoll (v[1], v[0]);
|
||||
printf("strcoll (%s, %s) -> %d\n", v[1], v[0], r1);
|
||||
r2 = strcoll (v[1], v[2]);
|
||||
printf("strcoll (%s, %s) -> %d\n", v[1], v[2], r2);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.sigs</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.sigstat</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
@@ -1,12 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
fprintf(stdout, "to stdout\n");
|
||||
fprintf(stderr, "to stderr\n");
|
||||
fprintf(stdout, "to stdout\n");
|
||||
fprintf(stderr, "to stderr\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
double dv, dv2;
|
||||
char *sv, *ep;
|
||||
int r;
|
||||
|
||||
sv = "4.2";
|
||||
dv = 4.2;
|
||||
|
||||
errno = 0;
|
||||
dv2 = strtod(sv, &ep);
|
||||
if (*ep)
|
||||
exit(1);
|
||||
else if (errno == ERANGE)
|
||||
exit(1);
|
||||
if (dv != dv2)
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,115 +0,0 @@
|
||||
This file details the changes between the previous release of CWRU bash
|
||||
(3/10/93) and this release.
|
||||
|
||||
1. Bugs Fixed
|
||||
|
||||
New version of endian.c that handles 64-bit machines better
|
||||
|
||||
added code to make readline reset itself when $TERMINFO changes
|
||||
|
||||
fixed memory leaks in:
|
||||
builtins/exec.def
|
||||
lib/readline/history.c
|
||||
lib/readline/readline.c
|
||||
parse.y
|
||||
subst.c
|
||||
variables.c
|
||||
dispose_cmd.c
|
||||
mailcheck.c
|
||||
bashline.c
|
||||
execute_cmd.c
|
||||
shell.c
|
||||
|
||||
make sure that bash_symbolic_link_hook calls get_working_directory with a
|
||||
non-empty string argument
|
||||
|
||||
check the return value of getdtablesize() for bad values
|
||||
|
||||
make the job control tty handlers print error message only if the shell is
|
||||
currently interactive
|
||||
|
||||
process substitution no longer tries to close every file descriptor
|
||||
|
||||
fixed up the source to contain more extern function declarations rather than
|
||||
casting the return values
|
||||
|
||||
fixed up handling of embedded quoted strings by the parser so that $ is not
|
||||
a special character while parsing one
|
||||
|
||||
added escape handling to the read builtin so backslashes can escape $IFS
|
||||
characters
|
||||
|
||||
fixed the brace expansion code so that backslash can act as a delimiter and
|
||||
can escape `"' in a double-quoted string
|
||||
|
||||
the `<>' redirection needs to open the file O_RDWR|O_CREAT for Posix.2
|
||||
compatibility
|
||||
|
||||
fixed up the here document reading code so that it will remove backslash-
|
||||
quoted newlines if the document delimiter is not quoted
|
||||
|
||||
fixed up the unwind_protect_var code so that the same strategy is used
|
||||
for both saving and restoring variables
|
||||
|
||||
completion functions may now tell readline not to attempt filename completion
|
||||
by returning (char **) -1
|
||||
|
||||
improved the error message printed by get_working_directory
|
||||
|
||||
Compile for solaris if either USGr4 or __svr4__ is defined
|
||||
|
||||
bash does not perform a getwd() on startup unless the inherited value of
|
||||
$PWD is wrong or $PWD was not in the environment
|
||||
|
||||
fixed up the trap saving and restoring code so that savetrap=$(trap) works
|
||||
like Posix.2 says it should
|
||||
|
||||
non-interactive shells are now much better about cleaning up dead processes
|
||||
and jobs on both job control and non job control systems
|
||||
|
||||
fixed the code that saves and restores the dollar variables around a `.'
|
||||
script so that if the script changes the positional parameters, the old
|
||||
values are not restored
|
||||
|
||||
fixed the tokenizer so that it will not return ASSIGNMENT_WORD while
|
||||
parsing a case statement pattern list
|
||||
|
||||
redid the implementation of cprintf for systems without varargs
|
||||
|
||||
fixed up the variable expansion code so that illegal variable names in ${ }
|
||||
expansion now generate errors rather than produce incorrect results
|
||||
|
||||
fixed up some problems with default_buffered_input and the implicit redirection
|
||||
of fd 0 to /dev/null for asynchronous commands without job control
|
||||
|
||||
new function internal_error for shell internal error messages
|
||||
|
||||
changed the sigint signal handler in nojobs.c to do nothing when it's called,
|
||||
not even run a signal handler
|
||||
|
||||
made the command substitution code more careful about file descriptors when
|
||||
errors occur
|
||||
|
||||
2. New Features
|
||||
|
||||
SIGWINCH causes bash to reset the values of $LINES and $COLUMNS for both
|
||||
readline and non-readline systems
|
||||
|
||||
changed the code in readline that handled conditional parsing of `$if term='
|
||||
to test the terminal name given to $if against both the `long' and `short'
|
||||
(portion up to the first `-') forms of the terminal name
|
||||
|
||||
the completion code now single-quotes a match that contains a shell word
|
||||
break character
|
||||
|
||||
the readline code does not define USE_XON_XOFF. This causes output to be
|
||||
swallowed when using bash over a relatively slow line (like a modem line).
|
||||
|
||||
there is now a bindable readline function to do only history expansion;
|
||||
bound to M-^ (M-! was already taken)
|
||||
|
||||
ulimit now has a -u option to set and get the limit for the maximum number
|
||||
of user processes
|
||||
|
||||
config.h.mini is a `minimal' configuration file that compiles out just about
|
||||
everything
|
||||
@@ -1,63 +0,0 @@
|
||||
This file details the changes between the previous release of CWRU bash
|
||||
(5/10/93) and this release.
|
||||
|
||||
1. Bugs Fixed
|
||||
|
||||
commas within backquotes inside matching braces are now treated as
|
||||
quoted (e.g., echo {`echo foo:bar | sed s/:/,/`})
|
||||
|
||||
don't create the export env unless we are running a command with
|
||||
shell_execve (in execute_disk_command), and don't create it anew
|
||||
each time a child is forked
|
||||
|
||||
make execute_disk_command look in the temp environment for an
|
||||
assignment to PATH, and disable hash lookup for the command if
|
||||
such an assignment is present
|
||||
|
||||
fixed here documents so that backslash-quoted newlines are treated as
|
||||
Posix.2 specifies
|
||||
|
||||
removed a number of extraneous unwind-protects or moved them inside
|
||||
if statements
|
||||
|
||||
only call rl_reset_terminal in sv_term if we're actually using readline
|
||||
|
||||
only run traps on SIGCHLD if job_control != 0
|
||||
|
||||
fixed readline so it won't try to pass memory allocated with alloca() to
|
||||
a separate function
|
||||
|
||||
cleaned up the readline global function and variable namespace, and split
|
||||
some more code out from readline.c into separate files
|
||||
|
||||
added header files that declare extern functions rather than having those
|
||||
extern declarations littered throughout the code
|
||||
|
||||
readline now allows ^T to be undone
|
||||
|
||||
fixed readline so that characters whose screen representation is > 1
|
||||
character (e.g., \354) are erased correctly
|
||||
|
||||
the read builtin no longer attempts to split its input into words if
|
||||
$IFS is unset
|
||||
|
||||
changed the terminating signals that bash catches so they're reset to
|
||||
their original handlers when a child is forked
|
||||
|
||||
the Gnu malloc library code was upgraded to Gnu libc version 1.06
|
||||
|
||||
the Gnu termcap library code was upgraded to Gnu termcap version 1.02
|
||||
|
||||
the man page was updated to cover the bind -m option
|
||||
|
||||
2. New Features
|
||||
|
||||
Bash now notices if it's running setuid or setgid and disables $ENV
|
||||
processing and importing shell functions from the environment
|
||||
|
||||
New flag: -p/-o privileged, set if the shell is running setuid or setgid.
|
||||
Turning this off causes the effective uid and gid to be set to the
|
||||
real uid and gid
|
||||
|
||||
New machine descriptions for the Intel Paragon, Symmetric 375, NeXT 486,
|
||||
and HP running 4.4 BSD
|
||||
@@ -1,140 +0,0 @@
|
||||
This file details the changes between the previous release of CWRU bash
|
||||
(07/11/93) and this release.
|
||||
|
||||
1. Bugs Fixed
|
||||
|
||||
Readline's vi-mode once again has TAB bound to completion; entering `posix
|
||||
mode' changes it to self-insert
|
||||
|
||||
Bash now binds its special emacs-mode functions directly into
|
||||
emacs_meta_keymap so that eight-bit character handling does not interfere
|
||||
|
||||
Some source restructuring: more extern functions are defined in header files
|
||||
and not in C source files
|
||||
|
||||
The handling of `line number' inside functions is now more correct and
|
||||
closer to reality
|
||||
|
||||
Some functions of `general use' were moved to general.c (vfree,
|
||||
full_pathname)
|
||||
|
||||
A bug that caused some redirections to be applied twice was fixed in
|
||||
execute_command_internal (dispose of redirection_undo_list after copying it;
|
||||
ditto for exec_redirection_undo_list)
|
||||
|
||||
The exit status of a command that is not found is 126, as Posix.2 specifies
|
||||
|
||||
More speed improvements -- bash now runs as fast as the SunOS sh on
|
||||
Haertel's `shell benchmark'
|
||||
|
||||
Instead of returning pointers to -1, bash and the readline, history, and
|
||||
glob libraries now return pointers to special `error pointers', which the
|
||||
calling code checks for in place of -1
|
||||
|
||||
Fixed a problem with canonicalize_pathname which made it get
|
||||
confused with xxx/./yyy if yyy was `.' or `..'
|
||||
|
||||
Fixes to make bash recognize SVR4.2 and set USGr4_2 for SVR4.2 systems
|
||||
|
||||
Fixes to the HP/UX machine descriptions to make alloca work on HPUX_9
|
||||
and to avoid `M_MACHINE redefined' warnings
|
||||
|
||||
Fixes to the CRAY machine description
|
||||
|
||||
Fixes to the mailpath code to make it Posix.2-compliant -- backslash
|
||||
may now quote `%' and `?'
|
||||
|
||||
The namespace was further cleaned up, and more functions and variables
|
||||
were made static
|
||||
|
||||
On systems with S_IFSOCK or S_ISSOCK defined in sys/stat.h, bash checks
|
||||
whether fd 0 is a socket to decide whether or not it's being started by
|
||||
rshd and to run the startup files
|
||||
|
||||
Bash now gives the signal mask it inherits to its children -- previously,
|
||||
login shells cleared the signal mask
|
||||
|
||||
cpp-Makefile and subst.c both used the `USE_GLOB_LIBRARY' define, but
|
||||
with different meanings; subst.c now uses `USE_POSIX_GLOB_LIBRARY'
|
||||
|
||||
Fixed pattern substitution so that ${a%%$b}, where b was unset, no longer
|
||||
causes a core dump
|
||||
|
||||
Changed the `test_exit' define in test.c to no longer use `longjmp' as
|
||||
the rhs or a comma-ized expression; this causes core dumps on some
|
||||
optimizer/machine combinations
|
||||
|
||||
A speed hack in variables.c: if no local variables are defined for a level
|
||||
of shell context, kill_all_local_variables does not need to search the
|
||||
whole variable hash table when popping a context
|
||||
|
||||
Fixed the `bind' builtin so that -m now changes the keymap for all of the
|
||||
subsequent operations
|
||||
|
||||
Changed some more builtins to use internal_getopt: bind, command, export,
|
||||
readonly, declare, typeset
|
||||
|
||||
Fixed fc to use the Posix.2 format for listing commands in the
|
||||
history list
|
||||
|
||||
Changed bg to set `!', as Posix.2 specifies
|
||||
|
||||
Fixed ulimit.def to compile if RLIMIT_RSS is not defined,
|
||||
as some systems seem to have it
|
||||
|
||||
Replaced lib/malloc/alloca.c with the version from emacs 19. The old one
|
||||
lives in alloca.c.old
|
||||
|
||||
malloc.c now uses the ANSI C features to `stringize' macro arguments if
|
||||
__STDC__ is defined
|
||||
|
||||
Fixes to the GNU malloc library from glibc 1.06 and Mike Haertel
|
||||
|
||||
Fixes to readline key binding and lookup for Cray systems, which don't
|
||||
like the casting that readline does
|
||||
|
||||
Fixes to all readline library source files to clean up the code: make sure
|
||||
`int'-returning functions use `return x;' rather than `return;', declare all
|
||||
arguments, even the `int' ones, and make some functions void. Cleaned up
|
||||
the code formatting a little, too.
|
||||
|
||||
The readline completer now double-quotes filenames with special word-break
|
||||
characters, so that tilde expansion still works
|
||||
|
||||
^C now breaks out of keyboard macros
|
||||
|
||||
If being compiled as part of the shell, readline no longer attempts to
|
||||
handle SIGTTIN, SIGTTOU, or SIGTSTP
|
||||
|
||||
tilde_expansion_failure_hook is now a CPFunction rather than a Function,
|
||||
since that's how it's used
|
||||
|
||||
Readline vi-mode `change case' function now skips over characters which
|
||||
are neither upper nor lower case
|
||||
|
||||
Readline vi-mode now allows replacement to be redoable with `.'
|
||||
|
||||
2. New Features
|
||||
|
||||
A `strict Posix.2' mode, enabled with the -posix startup option or
|
||||
setting the POSIXLY_CORRECT variable (see CWRU/POSIX.NOTES for a
|
||||
description of the changed behavior)
|
||||
|
||||
`ONESHOT' is now an option in config.h
|
||||
|
||||
cpp-Makefile assumes that fixed header files are present if gcc is being
|
||||
used
|
||||
|
||||
The redirections attached to a function declaration are now part of that
|
||||
function, applied when the function is executed, as specified by Posix.2.
|
||||
This caused a change to parse.y that resulted in 66 shift/reduce
|
||||
conflicts(!)
|
||||
|
||||
All of the OP= functions that Posix.2 specifies are now implemented for
|
||||
both `let' and arithmetic substitution
|
||||
|
||||
The `command' builtin has acquired the Posix.2 `-v' and `-V' options
|
||||
(this shares code with the `type' builtin)
|
||||
|
||||
A new `bash_builtins' man page, like the `csh_builtins' page on some
|
||||
systems
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,584 +0,0 @@
|
||||
|
||||
This documents the changes between the first `public' release of CWRU bash
|
||||
and this, its second release. It summarizes, without going into detail,
|
||||
the changes that have been made.
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
o `getopts' builtin, as specified by Posix.2
|
||||
|
||||
o new configuration variable HAVE_UNISTD_H, used to include
|
||||
<unistd.h> and test for Posix features
|
||||
|
||||
o `ulimit' has new -p and -n options to report the pipe buffer size
|
||||
and number of available file descriptors, respectively
|
||||
|
||||
o allow SIGCHLD to be trapped and useful behavior to result if it is
|
||||
|
||||
o Posix termios and signal code for readline and the shell itself
|
||||
|
||||
o can optionally use the GNU termcap library
|
||||
|
||||
o new output for `times' builtin that looks like ksh:
|
||||
|
||||
shell-user shell-sys
|
||||
child-user child-sys
|
||||
|
||||
o `ulimit' limits now apply to both shell and its children
|
||||
|
||||
o new machines.h entries
|
||||
|
||||
o no longer does the costly `close file descriptors 3-NOFILE'
|
||||
each time it exec's a program -- now uses the close-on-exec
|
||||
flag for the files it fiddles with
|
||||
|
||||
NOTABLE BUG FIXES
|
||||
|
||||
o jobs.c only sets and gets the tty state in an interactive shell
|
||||
|
||||
o bash does better process group checking on Posix systems, eliminating
|
||||
some error messages
|
||||
|
||||
o fix for `infinite login' bug on System V machines when executing a
|
||||
script from a .bash_profile
|
||||
|
||||
o the `trap' command now behaves as 1003.2 specifies, as of draft 9
|
||||
|
||||
o restore original terminal process group upon exit, so as to not
|
||||
confuse a parent Bourne shell
|
||||
|
||||
o `bash file', where `file' is a binary file, now reports an error
|
||||
|
||||
o shells started with `-s' now execute the .bashrc file
|
||||
|
||||
|
||||
CHANGES (by date and files affected)
|
||||
9/20 - 9/30
|
||||
-----------
|
||||
|
||||
builtins.c, builtins.c.posix
|
||||
- added getopts help text
|
||||
- removed extra "let" from `let' error message
|
||||
- added correct extern definition for list_rest_of_args() to shift
|
||||
builtin
|
||||
|
||||
jobs.c, jobs.c.posix
|
||||
- removed bogus call to set_process_resource_limits() from
|
||||
make_child() as a consequence of redoing `ulimit'
|
||||
- initialize shell_tty to -1
|
||||
- only get or set the tty state after a command completes if the shell
|
||||
is interactive
|
||||
- use shell_tty in get_tty_state() and set_tty_state() instead of
|
||||
reopening /dev/tty every time
|
||||
|
||||
jobs.c.posix
|
||||
- do better pgrp checking in initialize_jobs() to avoid error message
|
||||
about not being able to setpgid(2) on startup
|
||||
- changed tcsetattr() error messages slightly
|
||||
|
||||
expr.c
|
||||
- avoid advancing beyond the end of the expression when reporting an
|
||||
error
|
||||
- NULL expressions now return 0 ($[], for example)
|
||||
|
||||
mailcheck.c
|
||||
- #ifdef redundant definition of NOW, which is also defined in
|
||||
general.h
|
||||
|
||||
variables.c
|
||||
- initialize $OPTIND and $OPTERR to 1 for getopts
|
||||
- add correct extern definition for itos()
|
||||
|
||||
subst.c
|
||||
- if $IFS is unset, it defaults to " \t\n"
|
||||
- add special variable hack functions for $OPTIND, $OPTERR
|
||||
|
||||
builtins.h
|
||||
- add definition for getopts_builtin()
|
||||
|
||||
getopts.c
|
||||
- new file, source for `getopts' builtin command
|
||||
|
||||
ulimit.c
|
||||
- remove the `struct ResourceLimit' stuff; limits now apply to both
|
||||
the shell and its children
|
||||
- took out set_process_resource_limits(), let ulimit(2) or
|
||||
setrlimit(2) do the work
|
||||
- changed error messages to use builtin_error() instead of
|
||||
report_error()
|
||||
- changed the block factor for RLIMIT_CPU from 1000 (milliseconds)
|
||||
to 1 (seconds)
|
||||
|
||||
|
||||
10/1
|
||||
----
|
||||
|
||||
builtins.c, builtins.c.posix
|
||||
- changed `test' help text for -ef option
|
||||
- made `trap -' reset all signals to their original values
|
||||
|
||||
machines.h
|
||||
- added a new configuration variable, HAVE_UNISTD_H, which should
|
||||
be defined if /usr/include/unistd.h exists
|
||||
|
||||
cpp-Makefile
|
||||
- make HAVE_UNISTD_H show though from machines.h to the bash code
|
||||
- add an explicit build line for ulimit.o so `psize.sh' is run
|
||||
each time ulimit.o is remade. This is kind of flaky.
|
||||
config.h
|
||||
- include <unistd.h> if HAVE_UNISTD_H is defined, use it to test
|
||||
for various Posix features (job control, signals, termios)
|
||||
|
||||
jobs.c, jobs.c.posix
|
||||
- restore original signals to child process in make_child()
|
||||
- keep count of number of children that exit or stop in flush_child(),
|
||||
and call a trap handler for SIGCHLD that many times. This allows
|
||||
SIGCHLD to be trapped without disaster occurring.
|
||||
|
||||
shell.c
|
||||
- If we're on a Posix system, initialize signals the Posix way
|
||||
- clear signal mask in initialize_signals() if on Posix system
|
||||
- set login_shell and make_login_shell to 0 upon entry to main(),
|
||||
solving the System V infinite login bug
|
||||
|
||||
trap.c
|
||||
- preserve value of $? when running traps
|
||||
- don't allow a signal ignored upon entry to the shell to be trapped
|
||||
or reset to the default
|
||||
- do not allow trapping SIGCHLD to change the signal handler, but
|
||||
save the commands to be executed. Run these commands from the
|
||||
SIGCHLD signal handler for each child that exits or stops
|
||||
- don't allow SIGCHLD signal handler to be overridden or have SIGCHLD
|
||||
ignored
|
||||
- new function added to restore all trapped signals to their original
|
||||
values
|
||||
|
||||
ulimit.c
|
||||
- add new -p option to report pipe buffer size. This is flaky on
|
||||
all non-Posix systems (those that do not define PIPE_BUF).
|
||||
|
||||
readline/readline.c
|
||||
- add Posix termios and signal code
|
||||
|
||||
10/2
|
||||
----
|
||||
|
||||
jobs.c, jobs.c.posix
|
||||
- only fetch terminal state in initialize_jobs() if the shell is
|
||||
interactive
|
||||
|
||||
10/3
|
||||
----
|
||||
|
||||
machines.h
|
||||
- new entry for Stardent
|
||||
- new variable USE_TERMCAP_EMULATION, for those systems that have the
|
||||
termcap(3) functions in the curses library, but have not linked
|
||||
/usr/lib/libtermcap.a to libcurses.a
|
||||
|
||||
cpp-Makefile
|
||||
- use USE_TERMCAP_EMULATION to set TERMCAP and TERMLIB
|
||||
|
||||
siglist.c, alias.h, general.c
|
||||
- declare the return values of xmalloc() and malloc() for the benefit
|
||||
of machines which cannot cope with simply casting the return value
|
||||
|
||||
shell.c, execute_cmd.c
|
||||
- change the re-execution of main() when executing a shell script to
|
||||
use setjmp/longjmp
|
||||
|
||||
builtins.c
|
||||
- add code to change the shell level in exec_builtin(), decrementing
|
||||
it before trying the execve(2) and incrementing it again if that
|
||||
fails
|
||||
|
||||
variables.c
|
||||
- new function adjust_shell_level() to change shell level by a
|
||||
specified increment
|
||||
- initialize `noclobber' in shell_initialize(), if we have inherited
|
||||
the `noclobber' variable from a parent shell
|
||||
|
||||
ulimit.c
|
||||
- add new option -n, which reports the max number of available file
|
||||
descriptors as reported by getdtablesize(). On SunOS 4.1, this
|
||||
can be set, too, with setrlimit(RLIM_NOFILE, ...).
|
||||
|
||||
10/4
|
||||
----
|
||||
|
||||
readline/readline.c
|
||||
- Ultrix turns off system call restart when executing in `Posix mode'
|
||||
(when sigaction(3) is used to set signal handling), so make it use
|
||||
the System V version of shell_getc()
|
||||
|
||||
jobs.c.posix
|
||||
- fix a bug in start_job() where `oset' was not initialized in the first
|
||||
call to sigprocmask(), yet was used in subsequent calls
|
||||
- remove the `shadow' instance of shell_tty_info in the code that sets
|
||||
the line discipline in initialize_jobs()
|
||||
|
||||
shell.c
|
||||
- if job control is being used, restore the tty pgrp to its original
|
||||
value so as to not screw the parent
|
||||
|
||||
builtins.c, builtins.c.posix
|
||||
- make the output of `times' look more like ksh
|
||||
|
||||
10/5
|
||||
----
|
||||
|
||||
jobs.c.posix
|
||||
- HP/UX no longer needs the signal handler for SIGCHLD reset via a
|
||||
call to signal() in flush_child() -- this breaks job control
|
||||
|
||||
machines.h
|
||||
- add HAVE_VPRINTF to HP/UX entry
|
||||
|
||||
siglist.c
|
||||
- include <stdio.h>, sprintf(3) requires it on some systems
|
||||
|
||||
10/8
|
||||
----
|
||||
|
||||
execute_cmd.c
|
||||
- make $LINENO in a function count the number of simple commands
|
||||
executed
|
||||
|
||||
10/9
|
||||
----
|
||||
|
||||
termcap, cpp-Makefile
|
||||
- new GNU termcap library, cribbed from Emacs. #define
|
||||
USE_GNU_TERMCAP in machines.h entry to use it. Small changes
|
||||
required to cpp-Makefile to make it work. This works on
|
||||
4.3 BSD, at least.
|
||||
|
||||
machines.h
|
||||
- add new entry for AIX/370
|
||||
|
||||
general.c
|
||||
- sysv_getc() is also needed for Ultrix machines running in Posix
|
||||
mode, so change the #ifdef accordingly (Ultrix passes the
|
||||
SV_INTERRUPT flag to sigvec(2) in sigaction(3)).
|
||||
|
||||
subst.c
|
||||
- use sysv_getc() for Ultrix machines running in Posix mode for
|
||||
command subsitution pipe reading
|
||||
|
||||
10/10
|
||||
-----
|
||||
|
||||
shell.c, execute_cmd.c
|
||||
- if the `file' portion of `bash file' is a binary file, report an
|
||||
error and do not attempt to execute it
|
||||
|
||||
jobs.c, jobs.c.posix
|
||||
- the code that does the guts of `kill' now sends the SIGCONT to a
|
||||
stopped job after it sends the specified signal, not before
|
||||
|
||||
10/11
|
||||
-----
|
||||
|
||||
parse.y
|
||||
- set +H also turned off putting commands into the history list
|
||||
|
||||
shell.c
|
||||
- make shells started with -s read .bashrc
|
||||
|
||||
|
||||
10/14
|
||||
-----
|
||||
|
||||
expr.c
|
||||
- changed calls to `report_error' to call `builtin_error'. I don't
|
||||
know if this is exactly right, but it seems to me that an error
|
||||
in an expression shouldn't kill the shell if -e is set.
|
||||
|
||||
fc.c
|
||||
- changed `report_error' to `builtin_error'
|
||||
|
||||
10/16
|
||||
-----
|
||||
|
||||
readline/vi_mode.c
|
||||
- repeat count to rl_vi_subst() was incorrectly being ignored
|
||||
- don't call rl_vi_change_case() on an empty line; two calls in
|
||||
a row can cause a seg fault
|
||||
|
||||
|
||||
10/17
|
||||
-----
|
||||
|
||||
execute_cmd.c
|
||||
- give builtins run in pipes a useful setting of top_level to
|
||||
longjmp(2) to on errors
|
||||
|
||||
|
||||
builtins.c, builtins.c.posix
|
||||
- replace some occurrences of longjmp (top_level, ...) with simple
|
||||
calls to return (EXECUTION_FAILURE)
|
||||
|
||||
10/18
|
||||
-----
|
||||
|
||||
readline/readline.c
|
||||
- Make O_NDELAY be the same as O_NONBLOCK on Posix systems
|
||||
- Don't use IXANY if it's not defined (some strict Posix systems do
|
||||
not define it)
|
||||
- Posix systems need NOFLSH for c_lflag to avoid flushing the input
|
||||
buffer after a SIGINT, SIGQUIT, or SIGSUSP. This is still wrong,
|
||||
though.
|
||||
|
||||
execute_cmd.c, test.c, general.h
|
||||
- use the Posix S_IS* macros to test file formats instead of explicitly
|
||||
masking with S_IFMT and testing the result. Macros are provided
|
||||
for those systems that do not have them (like 4.3 BSD).
|
||||
|
||||
parse.y
|
||||
- fix expansion of \W in the prompt string so that it works when
|
||||
you're in the root directory
|
||||
|
||||
machines.h
|
||||
- add machine description for concurrent in UCB universe
|
||||
|
||||
Makefile
|
||||
- make sure $(MFLAGS) is passed to the recursive make of bash-Makefile
|
||||
|
||||
10/22
|
||||
-----
|
||||
|
||||
jobs.c.posix
|
||||
- make sure the NOFLSH bit is turned on in the termios c_lflag word
|
||||
so that typeahead doesn't get flushed on receipt of signals. THIS
|
||||
HAS BEEN TAKEN OUT.
|
||||
|
||||
10/23
|
||||
-----
|
||||
|
||||
execute_cmd.c
|
||||
- change extract_colon_unit() to increment the path index past a
|
||||
colon when it is called, before it tries to get the next component
|
||||
from the path. Without doing this, `.' was always found as the
|
||||
second component in the path, whether it was actually there or not.
|
||||
|
||||
trap.c, shell.c
|
||||
- made SIGINT trap handling act the same as that of ksh and the BSD
|
||||
sh. As a side effect (really the reason for doing this in the
|
||||
first place), `read' is now interruptible.
|
||||
|
||||
Makefile
|
||||
- made the CPPFLAGS definition useful by passing it to cpp when
|
||||
making bash-Makefile from cpp-Makefile
|
||||
- made the `echo' line when creating bash-Makefile really echo by
|
||||
quoting the redirection to bash-Makefile
|
||||
|
||||
general.c
|
||||
- make fcntl.h be included only if NO_DUP2 is defined
|
||||
|
||||
10/24
|
||||
-----
|
||||
cpp-Makefile
|
||||
- make libreadline.a depend on the objects, not the sources. Without
|
||||
this, you could delete on of the .o files to try to force a library
|
||||
rebuild and have it not happen.
|
||||
|
||||
10/25
|
||||
-----
|
||||
|
||||
shell.c
|
||||
- make a flag of `-' signal the end of option arguments, like the
|
||||
4.3 BSD sh, and in accordance with the Posix command line syntax
|
||||
standard
|
||||
|
||||
shell.c, builtins.c, builtins.c.posix
|
||||
- shuffle some code around so -o option can be given on the command
|
||||
line -- there's no reason why it shouldn't be allowed.
|
||||
|
||||
variables.c, variables.h, execute_cmd.c, builtins.c, builtins.c.posix, shell.c,
|
||||
subst.c, bashline.c, hash.h, variables.h
|
||||
- change the implementation of shell function and variable storage to
|
||||
a hash table instead of a singly-linked list
|
||||
|
||||
make_cmd.c, shell.c
|
||||
- bug reports only get mailed out if MAIL_BUG_REPORTS is defined
|
||||
|
||||
10/29
|
||||
-----
|
||||
|
||||
bashline.c
|
||||
- some random cleanups from bfox
|
||||
- make sure alias expansion is attempted in shell_expand_line () only
|
||||
if ALIAS is defined
|
||||
|
||||
hash.c
|
||||
- add default case to make_hash_table to force the number of buckets
|
||||
in the table to be the default if 0 is passed as the number of
|
||||
buckets
|
||||
|
||||
variables.c
|
||||
- make initialize_shell_variables () call make_hash_table () with an
|
||||
argument of 0 again (see previous entry).
|
||||
|
||||
|
||||
variables.c, builtins.c, builtins.c.posix
|
||||
- cleanups because map_over(), all_vars(), all_shell_variables(), and
|
||||
all_shell_functions () can possibly return NULL lists, and such
|
||||
lists should not be sorted or freed
|
||||
|
||||
trap.c
|
||||
- make sure we declare `extern int last_command_exit_value' in
|
||||
run_interrupt_trap ().
|
||||
|
||||
variables.c
|
||||
- Don't override a HOSTTYPE variables that comes in from the
|
||||
environment
|
||||
|
||||
10/30
|
||||
-----
|
||||
|
||||
variables.c
|
||||
- Fix a bug in variables.c: make_var_array () where it called
|
||||
array_len on a NULL list
|
||||
|
||||
builtins.c, builtins.c.posix
|
||||
- Add a description of `-m' to the help for the `set' builtin
|
||||
command
|
||||
|
||||
11/1
|
||||
----
|
||||
|
||||
general.c
|
||||
- added a definition of bzero() for USG machines, because
|
||||
there is a reference to it in the new variable hashing code
|
||||
|
||||
11/2
|
||||
----
|
||||
|
||||
shell.c
|
||||
- set forced_interactive to 0 in shell_reinitialize(), otherwise
|
||||
shell scripts get marked as interactive
|
||||
|
||||
11/6
|
||||
----
|
||||
|
||||
execute_cmd.c
|
||||
- eliminated the costly loop from 3 to NOFILE closing all file
|
||||
descriptors each time we exec a command by setting all file
|
||||
descriptors > 2 opened as the result of a redirection and internal
|
||||
to the shell to be close-on-exec, as well as all file descriptors
|
||||
opened to save others in add_undo_redirect(). `internal to the
|
||||
shell' means that the redirections were attached to shell builtin.
|
||||
Other `internal' redirections include while, for, and until
|
||||
loops, and shell functions. I got scared after reading that
|
||||
s5r4 provides 2048 fd's per process -- 2045 (mostly useless)
|
||||
close() calls on *each executed program*? No way, no how.
|
||||
|
||||
This caused the other fixes for this file to be discovered.
|
||||
|
||||
Unfortunately (there always seems to be a catch), 4.3 BSD up to
|
||||
4.3-tahoe leaves a file descriptor open in setpwent() if you're
|
||||
using dbm password files. 4.3+NFS does this if you're not using
|
||||
YP. Arghhhhhhh... I haven't decided yet what to do about this;
|
||||
probably just set fd 3 to close-on-exec when the shell is
|
||||
initialized.
|
||||
|
||||
execute_cmd.c
|
||||
- removed the call to `add_undo_redirect()' when a file is being
|
||||
closed with the redirection operators [n]<&- and [n]>&-. The
|
||||
effect was to make those operators useless. Sad to say, I was
|
||||
probably the dummy who put it in there...
|
||||
|
||||
execute_cmd.c
|
||||
- when calling fcntl(redirector, F_GETFD, 0) in do_redirection() to
|
||||
find out if a file descriptor is active, do it only if redirector
|
||||
is not the same as `fd', which you've just opened. This has
|
||||
spectacularly bad consequences if you do something like
|
||||
|
||||
exec 3</dev/tty 4>/tmp/foo 5</dev/null
|
||||
|
||||
I'm probably to blame for this, too...
|
||||
|
||||
execute_cmd.c
|
||||
- when saving a file descriptor in add_undo_redirect, make sure we
|
||||
save the state of the close-on-exec flag, and restore it when
|
||||
dup2'ing the saved fd back to the orignal.
|
||||
|
||||
execute_cmd.c
|
||||
- when performing a redirection that causes us to open a file, make
|
||||
sure we at least add an undo record to close the file, even if
|
||||
the file descriptor is not already active
|
||||
|
||||
execute_cmd.c
|
||||
- when duplicating a file descriptor as the result of a redirection
|
||||
instruction, make sure to manually duplicate the state of the
|
||||
close-on-exec flag
|
||||
|
||||
11/13
|
||||
-----
|
||||
|
||||
execute_cmd.c
|
||||
- finally tracked down and stamped out the persistant bug that caused
|
||||
the shell to hang when doing a command like "history | more" when
|
||||
there was more than a pipeful of text to send to `more' and you quit
|
||||
out of `more'after the first screenful. An extra read end of the
|
||||
pipe was being left open in the shell started to run `history', the
|
||||
consequence being that that shell at the beginning of the pipeline
|
||||
would never get the SIGPIPE that would cause it to exit. The fix
|
||||
is kind of strange: pass around a file descriptor to close whenever
|
||||
a child process is created in either execute_command_internal or
|
||||
execute_simple_command. We just pass the file descriptor that we
|
||||
want closed to the instance of execute_command_internal that runs
|
||||
the first half of the pipeline, and it gets closed just like we
|
||||
want.
|
||||
|
||||
In the future, this can (and probably should) be made into a bitmap
|
||||
of file descriptors to close. It wouldn't have to be big, 16 should
|
||||
be enough given the ability to do close-on-exec.
|
||||
|
||||
builtins.c, builtins.c.posix
|
||||
- changed the one call to execute_command_internal to add the extra
|
||||
parameter needed by the above fix.
|
||||
|
||||
unwind_prot.c
|
||||
- make without_interrupts() block SIGINT on capable systems (Posix
|
||||
and systems with BSD sigs) instead of ignoring it, which causes
|
||||
interrupts to be dropped. Blocking is what you want, anyway.
|
||||
|
||||
execute_cmd.c
|
||||
- add an unwind_protect for the redirections for a function or
|
||||
builtin. To see why this is needed, define a function shcat:
|
||||
|
||||
shcat()
|
||||
{
|
||||
while read line
|
||||
do
|
||||
echo "$line"
|
||||
done
|
||||
}
|
||||
|
||||
Now execute "shcat < INSTALL" and try to interrupt it. Bash will
|
||||
keep reading the lines from INSTALL and trying to execute them
|
||||
until EOF, at which point the shell exits.
|
||||
|
||||
11/14
|
||||
-----
|
||||
|
||||
execute_cmd.c
|
||||
- a subshell spawned to execute a function or a builtin with a pipe
|
||||
or an asynchronous function or builtin should have login_shell and
|
||||
interactive set to 0. That way, if someone is stupid enough to
|
||||
pipe to `exit' from a login shell, the subshell won't try to exec
|
||||
.bash_logout.
|
||||
|
||||
11/16
|
||||
-----
|
||||
builtins.c, builtins.c.posix
|
||||
- exit status of `type' was wrong for executable files, hashed and
|
||||
unhashed
|
||||
|
||||
bashline.c
|
||||
- Made bash_complete_filename_internal take just about everything
|
||||
as a possible filename character. It still can't do completion
|
||||
of a filename containing blanks if you type one of the blanks,
|
||||
though -- it needs the blanks-as-word-separators logic to work
|
||||
at all.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,234 +0,0 @@
|
||||
This file documents changes to CWRU bash following its first network-wide
|
||||
release.
|
||||
|
||||
3/15
|
||||
----
|
||||
Makefile
|
||||
- change the declaration of $CPP_ARGS so that CPP_CC can have
|
||||
embedded blanks, by adding quotes
|
||||
|
||||
bashline.c
|
||||
- some cosmetic changes to the FIGNORE support functions
|
||||
|
||||
glob.c
|
||||
- don't define USGr3 if it's already defined
|
||||
|
||||
variables.c
|
||||
- a declaration for the argument to put_command_name_into_env was
|
||||
missing
|
||||
|
||||
builtins.c
|
||||
- only print the command name in builtin_error if this_command_name
|
||||
is non-null
|
||||
|
||||
expr.c
|
||||
- catch something % 0 as an error
|
||||
|
||||
subst.c
|
||||
- make sure this_command_name is set to NULL before calling evalexp,
|
||||
because evalexp uses builtin_error
|
||||
|
||||
3/18
|
||||
----
|
||||
|
||||
variables.c
|
||||
- changed getenv() to search the inherited environment if the hash
|
||||
table of shell variables does not exist or has not been created
|
||||
|
||||
3/19
|
||||
----
|
||||
|
||||
subst.c
|
||||
- when doing command substitution, strip only the trailing newlines.
|
||||
This is in accordance with Posix.2.
|
||||
|
||||
general.c
|
||||
- strip_trailing () has aquired a new flag telling whether to strip
|
||||
all white space or just trailing newlines.
|
||||
|
||||
variables.c
|
||||
- since some places in the code rely on bind_variable returning a
|
||||
valid value, the dynamic variable assignment functions have been
|
||||
changed to take a pointer to themselves as the first parameter:
|
||||
|
||||
return ((*(entry->assign_func)) (entry, value));
|
||||
|
||||
and then return that value after doing whatever they need to
|
||||
|
||||
3/30
|
||||
----
|
||||
|
||||
bashline.c
|
||||
- disabled builtin commands should not be returned to the readline
|
||||
completion functions as legal command alternatives
|
||||
|
||||
flags.c
|
||||
- do not redefine NULL; check only after including all needed
|
||||
.h files
|
||||
|
||||
nojobs.c
|
||||
- fix unconditional reference to status.w_*
|
||||
- fix typo after call to WIFCORED in wait_for
|
||||
|
||||
readline/readline.c
|
||||
- make sure all calls to BSD signal mechanism are protected by test
|
||||
for HAVE_BSD_SIGNALS define
|
||||
- make sure declaration of struct ltchars variable is protected by
|
||||
test for definition of TIOCGLTC
|
||||
- change #include file from sys/errno.h to errno.h
|
||||
- added a new function rl_stop_output (), the non-emacs version of
|
||||
^S, to go with rl_restart_output. Haven't done anything with it
|
||||
yet.
|
||||
- added Posix support in the form of tcflow() calls to
|
||||
rl_restart_output and rl_stop_output
|
||||
|
||||
readline/readline.h
|
||||
- change the declaration of rl_filename_completion_ignore_function
|
||||
to extern. It was coming up as multiply defined on some systems
|
||||
|
||||
siglist.c
|
||||
- change #include file from sys/signal.h to signal.h
|
||||
- some systems define _NSIG but not NSIG. Define NSIG in terms of
|
||||
_NSIG on those systems
|
||||
|
||||
ulimit.c
|
||||
- change #include file from sys/errno.h to errno.h
|
||||
|
||||
subst.c
|
||||
- string_extract_double_quoted() needs to ignore "" inside `` pair,
|
||||
but this code should be executed only if the ` is not backslash-
|
||||
escaped.
|
||||
- changed sv_uids() to give UID, EUID the integer attribute
|
||||
automatically
|
||||
|
||||
machines.h
|
||||
- check for the DG AViiON defining either __DGUX__ or DGUX, make
|
||||
sure DGUX is defined in any case
|
||||
|
||||
trap.c
|
||||
- change run_pending_traps to loop from 1 to NSIG instead of 0 to
|
||||
NSIG
|
||||
|
||||
execute_cmd.c
|
||||
- For a command run explicitly in a subshell via (), run_exit_trap ()
|
||||
needs to be called after that command has executed for /bin/sh
|
||||
compatibility
|
||||
|
||||
variables.c
|
||||
- make $PPID have the integer attribute when it is intialized
|
||||
|
||||
4/2
|
||||
---
|
||||
|
||||
subst.c
|
||||
- make string_extract_double_quoted handle backslash-escaped
|
||||
` correctly when parsing a `` pair
|
||||
|
||||
4/3
|
||||
---
|
||||
|
||||
jobs.c
|
||||
- make sure job_control is set to 1 before the first time
|
||||
give_terminal_to is called, so that it does its job and the
|
||||
process groups are correct.
|
||||
|
||||
subst.c
|
||||
- make string_extract_double_quoted() not turn \\ into \ inside
|
||||
quoted strings. The translations will be taken care of later.
|
||||
|
||||
nojobs.c
|
||||
- make sure we get the tty state in initialize_jobs(), and don't
|
||||
try to set it in set_tty_state until we know we have saved
|
||||
valid settings.
|
||||
|
||||
4/6
|
||||
---
|
||||
|
||||
shell.c, execute_cmd.c, shell.h
|
||||
- shell now exits with status 127 when asked to execute a binary
|
||||
file as a shell script
|
||||
|
||||
builtins.c
|
||||
- `local' is once again an error outside a function
|
||||
- `trap' now formats output differently when given no arguments;
|
||||
the new format is suitable for feeding back to the shell as
|
||||
input to `trap'
|
||||
- cleaned up a contradiction in the help text for the `export'
|
||||
builtin
|
||||
- `export' and `readonly' now accept a -p flag for Posix.2 compliance
|
||||
that acts the same as if no flags had been specified, and take a
|
||||
`--' option to disable further option processing
|
||||
- `unset' takes a `--' argument to disable further option
|
||||
processing
|
||||
- when given the -f flag, unset will now try to unset a variable
|
||||
if no function is found for the name supplied
|
||||
- `kill' now takes a -s signal argument as equivalent to -signal
|
||||
- `kill' takes a `--' argument to disable further option processing,
|
||||
since a negative number may be used to denote a process group
|
||||
- `kill -l' now takes arguments and lists the names for individual
|
||||
signals by number. If the number given as argument is > 128, it
|
||||
is assumed to be an exit status, and 128 is subtracted before
|
||||
further processing
|
||||
|
||||
builtins.c, variables.c
|
||||
- `set +' is no more; print_vars_no_values() is no longer needed
|
||||
|
||||
flags.c, builtins.c
|
||||
- `set -C' is now an alias for noclobber
|
||||
|
||||
trap.c
|
||||
- SIGNULL is no longer a valid name for signal 0
|
||||
|
||||
getopts.c, subst.c
|
||||
- resetopts () --> getopts_reset ()
|
||||
- rewrote getopt() per Brian's request
|
||||
|
||||
builtins.c
|
||||
- `return' is now valid when executing a file with the `.' builtin
|
||||
and causes the execution to be aborted
|
||||
|
||||
execute_cmd.c
|
||||
- file descriptors > 2 manipulated via `exec' are no longer set to
|
||||
close-on-exec
|
||||
|
||||
4/8
|
||||
---
|
||||
|
||||
cpp-Makefile
|
||||
- fixed the bad definition of RANLIB if RANLIB_LOCATION was defined
|
||||
- pass the correct definition of ranlib through to the make of
|
||||
readline
|
||||
|
||||
readline/readline.c
|
||||
- make sure some defaults for screen size are defined in the case
|
||||
of a dumb terminal
|
||||
|
||||
builtins.c
|
||||
- `return' now works for aborting files executed with the `.'
|
||||
builtin
|
||||
|
||||
parse.y
|
||||
- a `"' before a closing ) in a $( ) construct within double
|
||||
quotes is no longer an error
|
||||
|
||||
subst.c
|
||||
- string_extract_double_quoted now passes everything between $(
|
||||
and ) through verbatim, without scanning it for double quotes.
|
||||
This way, `echo "$(echo "*")"' will echo `*' like it should.
|
||||
|
||||
documentation/bash.1
|
||||
- updated to reflect the changes from Posix.2 draft 11.
|
||||
|
||||
4/10
|
||||
----
|
||||
|
||||
execute_cmd.c, builtins.c
|
||||
- changed some instances of absolute_pathname to absolute_program
|
||||
(like doing PATH, CDPATH searching, the `type' builtin, and
|
||||
filename hashing)
|
||||
|
||||
readline/readline.c
|
||||
- made rl_deprep_terminal do a little sanity checking on the
|
||||
values in otio that it is restoring
|
||||
|
||||
Minor update of tar files available for FTP from CWRU
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,671 +0,0 @@
|
||||
[Beginning of work with version 1.11]
|
||||
|
||||
10/31
|
||||
-----
|
||||
Makefile
|
||||
- changed instances of $(AWK) to $(GAWK) -- political correctness from
|
||||
bfox
|
||||
|
||||
builtins.h, builtins/help.def, builtins/mkbuiltins.c
|
||||
- changed representation of long_doc from a single string to an
|
||||
array of strings
|
||||
|
||||
execute_cmd.c
|
||||
- only call __setostype() if on isc386 and _POSIX_SOURCE is
|
||||
defined
|
||||
|
||||
general.c
|
||||
- only define functions for index and rindex if index and rindex
|
||||
are not already cpp defines
|
||||
|
||||
jobs.c
|
||||
- #undef some things that clash between <sys/ioctl.h> and <termios.h>
|
||||
on Posix suns
|
||||
|
||||
machines.h
|
||||
- make isc386 machines links with the shared C library explicitly
|
||||
(-lc_s)
|
||||
- new entry for a MagicStation (?) from bfox
|
||||
|
||||
variables.c
|
||||
- use a cpp define _CONST_HACK to determine whether the parameter to
|
||||
getenv() is a char const * (yes for _STDC_, no otherwise)
|
||||
|
||||
builtins/type.def
|
||||
- make found_file local to the block that searches for executable
|
||||
disk files
|
||||
|
||||
11/4
|
||||
----
|
||||
execute_cmd.c
|
||||
- make execute_function_or_builtin use unwind protects to protect
|
||||
the `return catch' variables
|
||||
|
||||
support/getcppsyms.c
|
||||
- added definitions for M_UNIX, M_XENIX, and _AIX
|
||||
|
||||
11/5
|
||||
----
|
||||
bashline.c
|
||||
- fix a call to savestring in command_word_completion_function with
|
||||
a post-incremented int parameter, since savestring is a macro that
|
||||
evaluates its argument twice (builtin completion)
|
||||
|
||||
lib/glob/fnmatch.c
|
||||
- add `^' as a character that negates a character class ([])
|
||||
|
||||
11/6
|
||||
----
|
||||
subst.c
|
||||
- add a new variable last_command_subst_pid to keep track of the
|
||||
pid of the last child created for command substitution. Used
|
||||
to determine whether or not command substitution has taken
|
||||
place.
|
||||
|
||||
execute_cmd.c
|
||||
- made the exit status of a command that has only assignments and
|
||||
redirections obey the Posix spec
|
||||
|
||||
unwind_prot.c, trap.c
|
||||
- make sure all sigset_t variables are initialized with sigemptyset
|
||||
before use
|
||||
|
||||
lib/glob/fnmatch.c
|
||||
- fixed a couple of bugs with [] classes in fnmatch: not checking
|
||||
whether or not we've hit the ']' and not incrementing the string
|
||||
argument in the right place
|
||||
|
||||
11/7
|
||||
----
|
||||
braces.c
|
||||
- Make backquotes inhibit brace expansion -- defer it until the
|
||||
subshell runs
|
||||
- Ditto for $( )
|
||||
|
||||
subst.c
|
||||
- since braces.c now calls unquoted_member and unquoted_substring,
|
||||
they can no longer be static functions
|
||||
|
||||
config.h
|
||||
- two new configuration options: ALLOW_RIGID_POSIX_COMPLIANCE and
|
||||
DISABLED_BUILTINS
|
||||
|
||||
shell.c, jobs.c
|
||||
- define and use top_level_signal_mask, restored on longjmps to
|
||||
top_level by throw_to_top_level
|
||||
|
||||
builtins/builtin.def
|
||||
- use builtin_address to find the function (if so configured) so
|
||||
that `builtin foo' still works after `enable -n foo'
|
||||
|
||||
builtins/common.c
|
||||
- have both find_shell_builtin, which never finds disabled builtins,
|
||||
and builtin_address, which does
|
||||
|
||||
11/8
|
||||
----
|
||||
general.c
|
||||
- the getdtablesize emulation should ensure that _SC_OPEN_MAX is
|
||||
defined on Posix systems before trying to use it in a call to
|
||||
sysconf()
|
||||
|
||||
|
||||
11/10
|
||||
-----
|
||||
lib/glob/fnmatch.c
|
||||
- fixes from Roland McGrath for some of the more egregious bugs
|
||||
- naturally, Roland missed a few
|
||||
|
||||
lib/readline/readline.c
|
||||
- add missing calls to sigemptyset(), since Posix specifies that
|
||||
all sigset_t variables be initialized before use using it
|
||||
- only turn off ISTRIP and INPCK in the termio(s) code if the
|
||||
character size is 8 bits ((otio.c_cflag & CSIZE) == CS8)
|
||||
- Sequents running Dynix/ptx should include <sys/pte.h> rather
|
||||
that <sys/ptem.h>
|
||||
|
||||
builtins/type.def
|
||||
- change a call to printf to builtin_error when printing a
|
||||
diagnostic that something is not found
|
||||
|
||||
builtins/times.def
|
||||
- changed file inclusion code to include <sys/time.h> and
|
||||
<sys/resource.h> if HAVE_RESOURCE is defined, then to include
|
||||
<sys/times.h> if !HAVE_RESOURCE and RUSAGE_SELF is not defined.
|
||||
This catches systems with deficient <sys/resource.h> files
|
||||
|
||||
11/11
|
||||
-----
|
||||
lib/readline/readline.c
|
||||
- Don't try to dereference funmap in rl_named_function() if it's
|
||||
null (as it is before rl_initialize_funmap is called)
|
||||
|
||||
11/12
|
||||
-----
|
||||
lib/readline/readline.c
|
||||
- backed out of change of 11/11 to rl_named_function
|
||||
|
||||
bashline.c
|
||||
- add a state variable bash_readline_initialized to keep track of
|
||||
whether or not readline has been initialized with a call to
|
||||
initialize_readline()
|
||||
|
||||
builtins/bind.def
|
||||
- if readline has not been initialized the first time this is
|
||||
called, call initialize_readline
|
||||
|
||||
11/13
|
||||
-----
|
||||
execute_cmd.c
|
||||
- execute_subshell_builtin_or_function would only let the output
|
||||
of `jobs' be piped if pipe_in and pipe_out were both != NO_PIPE
|
||||
(?). Obviously a typo.
|
||||
|
||||
builtins/command.def
|
||||
- add an unwind_protect to dispose of the new command created
|
||||
by the call to make_bare_simple_command
|
||||
|
||||
builtins/jobs.def
|
||||
- add the `jobs -x command args' form from the System V.4 sh
|
||||
All job specs in `args' are replaced with the appropriate
|
||||
job's process group id and `command' is executed
|
||||
|
||||
builtins/getopt.c
|
||||
- if getopt() finds that optind > argc when it is called, it
|
||||
sets optind = argc and returns EOF
|
||||
|
||||
builtins/times.def
|
||||
- backed out of 11/10 change. Some systems, most notably
|
||||
HP/UX have all the correct includes and defines and simply
|
||||
do not implement getrusage(). At all.
|
||||
|
||||
subst.c
|
||||
- if sv_optind finds that OPTIND has been unset or set to an
|
||||
empty string, call getopts_reset (0). The Gnu getopt
|
||||
resets its internal state when optind == 0.
|
||||
- call getopts_reset(0) if OPTIND=1, because that's what the
|
||||
Posix spec says to use to reset
|
||||
|
||||
11/14
|
||||
-----
|
||||
builtins/alias.def
|
||||
- fixed a typo in the SHORT_DOC for the unalias builtin
|
||||
|
||||
builtins/shift.def
|
||||
- allowed the shift count to be 0
|
||||
|
||||
11/15
|
||||
-----
|
||||
lib/readline/readline.c
|
||||
- turn on 8 bit characters if NO_EIGHT_BIT_CHARACTERS is not
|
||||
defined and the Posix termios code path is being taken
|
||||
|
||||
[The following two entries describe what's needed for an initial
|
||||
implementation of the vi mode `.' command]
|
||||
|
||||
lib/readline/vi_mode.c
|
||||
- new variables:
|
||||
vi_last_command: last command that modified text in
|
||||
the buffer
|
||||
vi_last_repeat: the repeat count to vi_last_command
|
||||
vi_last_arg_sign: arg sign for vi_last_repeat
|
||||
vi_last_motion: the last motion qualifier for the
|
||||
text modification commands that use one
|
||||
vi_redoing: state variable, if 1 we're re-doing a
|
||||
command
|
||||
vi_textmod: list of commands that modify text
|
||||
(initially "_*\\AaIiCcDdPpYyRrSsXx~")
|
||||
|
||||
- new functions:
|
||||
rl_vi_redo: an initial implementation of the vi mode
|
||||
`.' command
|
||||
rl_vi_set_last: initialize the state of the new variables
|
||||
described above
|
||||
rl_vi_textmod_command: return true if command passed is
|
||||
a text modification command
|
||||
- changed rl_vi_domove to save the movement command information in
|
||||
vi_last_motion
|
||||
- changed rl_vi_movement_mode to call rl_vi_set_last to initialize
|
||||
the `last command' state
|
||||
|
||||
lib/readline/readline.c
|
||||
- changed rl_dispatch to save vi_last_command, vi_last_repeat,
|
||||
and vi_last_arg_sign
|
||||
- changed rl_newline to call vi_set_last
|
||||
|
||||
lib/readline/readline.h
|
||||
- new function rl_vi_redo
|
||||
|
||||
lib/readline/vi_keymap.c
|
||||
- bind rl_vi_redo to `.'
|
||||
|
||||
11/20
|
||||
-----
|
||||
posixstat.h
|
||||
- make isc386 defines for S_IFDIR and S_IFMT be used if they
|
||||
do not already appear, no matter whether or not gcc is being
|
||||
used for the compile
|
||||
|
||||
machines.h
|
||||
- new entry for Omron Luna 88k running Mach 2.5 (nice machines)
|
||||
|
||||
lib/readline/vi_mode.c
|
||||
- fixed a bug with rl_vi_domove and the last word on the line.
|
||||
If rl_point ended up > rl_end, it was being set to rl_end - 1
|
||||
rather than to rl_end.
|
||||
|
||||
cpp-Makefile
|
||||
- quote the values of RANLIB and AR passed to makes in
|
||||
subdirectories
|
||||
|
||||
shell.c
|
||||
- instead of making all Xenix systems swap the second and third
|
||||
arguments to setvbuf, make that behavior dependent on the
|
||||
definition of REVERSED_SETVBUF_ARGS
|
||||
|
||||
11/21
|
||||
-----
|
||||
lib/readline/readline.c
|
||||
- fixed an error in rl_forward that caused vi-mode to walk off
|
||||
the end of the line after executing `l' in command mode on an
|
||||
empty line
|
||||
|
||||
11/22
|
||||
-----
|
||||
support/getcppsyms.c
|
||||
- added the `luna88k' define
|
||||
|
||||
11/24
|
||||
-----
|
||||
execute_cmd.c
|
||||
- all calls to dup2 in do_redirection_internal should be checked
|
||||
for errors and the redirection should fail if the dup2 fails
|
||||
|
||||
shell.h, parse.y, execute_cmd.c, print_cmd.c, make_cmd.c
|
||||
- replaced the single redirection operator `r_duplicating' with
|
||||
r_duplicating_input and r_duplicating_output to avoid the
|
||||
read 1<&7 getting printed as read 1>&7 problem:
|
||||
foo()
|
||||
{
|
||||
exec 9</dev/tty
|
||||
read 1<&9
|
||||
exec 9<&-
|
||||
}
|
||||
is printed wrong when `type foo' is executed
|
||||
|
||||
shell.h
|
||||
- added two new redirection_operators, r_duplicating_input_word and
|
||||
r_duplicating_output_word to implement true sh semantics for
|
||||
[n]<&word and [n]>&word
|
||||
parse.y
|
||||
- eliminated the old yacc production for >& word, meaning put stdout
|
||||
and stderr into `word'
|
||||
- added productions for [n]<&word and [n]>&word that use the new
|
||||
redirection operators
|
||||
execute_cmd.c
|
||||
- the first thing done in do_redirection_internal is now a check for
|
||||
r_duplicating_input_word and r_duplicating_output_word. If the
|
||||
redirection is one of those two, `word' is expanded and a new
|
||||
redirection is made
|
||||
print_cmd.c
|
||||
- new code to print the [n]<&word and [n]>&word redirections
|
||||
(r_duplicating_input_word and r_duplicating_output_word)
|
||||
make_cmd.c
|
||||
- new code for make_redirection to handle r_duplicating_input_word
|
||||
and r_duplicating_output_word
|
||||
|
||||
documentation/bash.1
|
||||
- added documentation for the -x option to `jobs' + minor cleanups
|
||||
and corrections
|
||||
|
||||
11/25
|
||||
-----
|
||||
cpp-Makefile
|
||||
- added GCC_EXTRAS for gcc-specific compiler flags
|
||||
|
||||
execute_cmd.c
|
||||
- removed some unused functions (close_all_files) and variables
|
||||
(file_exists_p)
|
||||
|
||||
parse.y
|
||||
- added new command-oriented-style history: all lines of a multiple
|
||||
line command will be added to the same history line
|
||||
- new variable current_command_line_count to keep track of the
|
||||
number of lines in the current command. If > 1, a line is appended
|
||||
to the current history line to implement command-oriented history
|
||||
- new function bash_add_history
|
||||
|
||||
shell.c
|
||||
- added code to reset current_command_line_count to 0 before calling
|
||||
parse_command and yyparse
|
||||
|
||||
subst.c
|
||||
- the command-oriented history is controlled by the setting of the
|
||||
variable command_oriented_history
|
||||
|
||||
builtins/reserved.def
|
||||
- a new help topic: `variables', giving help on some common shell
|
||||
variables
|
||||
|
||||
11/26
|
||||
-----
|
||||
lib/glob/glob.c
|
||||
- if the filename portion of the pathname to be matched is null
|
||||
(e.g. a*/), do not call glob_vector to attempt to match each
|
||||
file in the expanded directories against the null string.
|
||||
|
||||
11/27
|
||||
-----
|
||||
lib/glob/glob.c
|
||||
- force globbing of directory names even if the metacharacters
|
||||
contained therein are protected by backslashes. The globbing
|
||||
strips the quotes correctly
|
||||
|
||||
shell.c
|
||||
- make sure current_command_line_count is declared everywhere
|
||||
it's used
|
||||
|
||||
parse.y
|
||||
- remove declaration of history_lines_this_session from
|
||||
pre_process_line
|
||||
- add extern declaration of history_lines_this_session to
|
||||
bash_add_history
|
||||
|
||||
12/2
|
||||
----
|
||||
trap.h
|
||||
- removed inclusion of <sys/types.h> because most files include it
|
||||
themselves, and this is dangerous on systems that do not protect
|
||||
against multiple inclusion of header files
|
||||
|
||||
trap.c
|
||||
- include <sys/types.h> before "trap.h" since it was the only file
|
||||
in the distribution not to do so
|
||||
|
||||
shell.c
|
||||
- Install the SIGINT sighandler the Posix way on machines with
|
||||
_POSIX_VERSION defined
|
||||
|
||||
12/3
|
||||
----
|
||||
dispose_cmd.c
|
||||
- make sure dispose_redirects properly handles r_duplicating_input_word
|
||||
and r_duplicating_output_word by freeing the `filename'
|
||||
|
||||
execute_cmd.c
|
||||
- fix do_redirection_internal to copy new_redirect->redirectee.filename
|
||||
using alloca() so no memory has to be freed at function exit
|
||||
|
||||
12/4
|
||||
----
|
||||
parse.y
|
||||
- expand \n in PS1 or PS2 into \r\n only if line editing is enabled
|
||||
|
||||
shell.c
|
||||
- define top_level_mask if _POSIX_VERSION defined
|
||||
|
||||
newversion.c
|
||||
- made it write a definition of SCCSVERSION to version.h -- an SCCS
|
||||
string so the `what' command will be useful
|
||||
|
||||
version.c
|
||||
- new variable `sccsversion' set to SCCSVERSION
|
||||
|
||||
12/5
|
||||
----
|
||||
builtins/fc.def
|
||||
- make fc_gethist check that the history list is non-null before
|
||||
trying to access its members
|
||||
|
||||
12/6
|
||||
----
|
||||
lib/readline/readline.c
|
||||
- changed the ISTRIP code (again) to force bash to disable ISTRIP
|
||||
only if the tty driver guarantees eight bits (cflag & CSIZE == CS8)
|
||||
|
||||
12/9
|
||||
----
|
||||
lib/readline/readline.c
|
||||
- tgetent returns 0 if it can't find the terminal name in /etc/termcap,
|
||||
so we failed if it returns <= 0, not < 0.
|
||||
|
||||
12/11
|
||||
-----
|
||||
machines.h
|
||||
- Sony machines running NEWS-OS 4.0 (V.4) should have strerror(),
|
||||
so define HAVE_STRERROR
|
||||
- Pyramids running BSD do not all have the vprintf family of functions,
|
||||
so remove the definition of HAVE_VPRINTF
|
||||
|
||||
12/12
|
||||
-----
|
||||
parse.y
|
||||
- make sure that shell_getc always checks that shell_input_line is
|
||||
valid before trying to reference shell_input_line[0]
|
||||
|
||||
12/13
|
||||
-----
|
||||
mailcheck.c
|
||||
- Since `dollar_underscore' saves the value of $_ in a local variable,
|
||||
it's possible that bind_variable can free and reallocate the cell
|
||||
for $_, leaving dollar_underscore pointing at freed storage. The
|
||||
fix is to copy it into freshly-allocated memory.
|
||||
- ensure that when saving and restoring dollar_underscore that we do
|
||||
not try to call strlen on a null string
|
||||
|
||||
12/15
|
||||
-----
|
||||
general.c, execute_cmd.c
|
||||
- moved the utility function `all_digits' from execute_cmd.c to
|
||||
general.c
|
||||
|
||||
builtins/kill.def
|
||||
- remove use of sscanf, used calls to all_digits and atoi instead
|
||||
|
||||
machines.h
|
||||
- if not using gcc, need to make SYSDEP_LDFLAGS = -Xp for Posix
|
||||
on isc386
|
||||
|
||||
12/16
|
||||
-----
|
||||
machines.h
|
||||
- isc386 has multiple groups
|
||||
|
||||
execute_cmd.c
|
||||
- add a QUIT to the while loop in find_user_command_in_path that
|
||||
searches the path, so users can interrupt a lengthy path search
|
||||
|
||||
12/17
|
||||
-----
|
||||
builtins/alias.def
|
||||
- added the Posix-specified -a option to unalias, made unalias obey
|
||||
the getopt argument syntax guidelines
|
||||
|
||||
builtins/jobs.def
|
||||
- made `jobs' handle the -- option to signal the end of arguments
|
||||
|
||||
flags.c
|
||||
- Posix.2a has specified that the -b flag stand for asynchronous
|
||||
notification, so move the definition of asynchronous_notification
|
||||
here and add a new entry to the `flags' struct if JOB_CONTROL is
|
||||
defined
|
||||
|
||||
flags.h
|
||||
- add an extern declaration of asynchronous_notification
|
||||
|
||||
jobs.c
|
||||
- change the definition of asynchronous_notification to extern, since
|
||||
it's now declared in flags.c
|
||||
|
||||
builtins/set.def
|
||||
- change documentation strings to add -b option, note that
|
||||
set -o notify is now the same as set -b
|
||||
- change the code to make set -o notify the same as set -b
|
||||
(list_long_opts(), take the special case out of set_minus_o_option)
|
||||
|
||||
12/19
|
||||
-----
|
||||
lib/readline/readline.c
|
||||
- added support for $LINES, $COLUMNS. The variables are read after
|
||||
the ioctl(TIOCGWINSZ) and before calls to tgetent
|
||||
|
||||
builtins/fc.def
|
||||
- made the fc output format correspond to that specified by Posix.2a
|
||||
("%d\t%s\n")
|
||||
|
||||
12/20
|
||||
-----
|
||||
execute_cmd.c
|
||||
- user_command_matches did not properly handle a null $PATH element,
|
||||
which should be the same as ".". Changed the code to mirror
|
||||
find_user_command_in_path ()
|
||||
|
||||
|
||||
12/23
|
||||
-----
|
||||
execute_cmd.c
|
||||
- added a new function get_next_path_element, which calls
|
||||
extract_colon_unit and interprets the result, translating
|
||||
"" to "."
|
||||
|
||||
builtins/cd.def
|
||||
- added description of -l option to dirs short_doc
|
||||
- fixed the bug that caused `dirs' to always print an extra
|
||||
trailing space
|
||||
|
||||
documentation/bash.1
|
||||
- added description of -l option to dirs
|
||||
|
||||
parse.y
|
||||
- added optional leading ( for case clause, as per Posix.2
|
||||
|
||||
12/30
|
||||
-----
|
||||
lib/readline/vi_mode.c
|
||||
- removed unused variable `added_blank'
|
||||
|
||||
bashline.c
|
||||
- added dynamic completion from bfox
|
||||
|
||||
execute_cmd.c
|
||||
- redirections must be performed in a child before execution of
|
||||
the command is attempted or aborted (because it's not found
|
||||
by a hash table or $PATH search), according to Posix.2
|
||||
|
||||
getcwd.c
|
||||
- new file, from the Gnu C library, for systems that don't do
|
||||
this right -- they use popen("/bin/pwd", "r") instead
|
||||
|
||||
12/31
|
||||
-----
|
||||
builtins/type.def
|
||||
- the type builtin would not report a name as not found if any name
|
||||
had previously been found because the flag variable used to report
|
||||
this (found_something) was not reset each time through the loop.
|
||||
Added a variable `found_any' to be global and reset found_something
|
||||
to 0 each time through the loop
|
||||
|
||||
1/4
|
||||
---
|
||||
builtins/jobs.def
|
||||
- make sure that the call to add_unwind_protect in
|
||||
execute_list_with_replacements is made after the new command
|
||||
struct is completely initialized
|
||||
|
||||
support/mksysdefs
|
||||
- look for /dev/fd, define HAVE_DEV_FD if present
|
||||
|
||||
cpp-Makefile
|
||||
- pass HAVE_DEV_FD through to make in SYSTEM_FLAGS
|
||||
|
||||
shell.c, execute_cmd.c
|
||||
- call unlink_fifo_list only if HAVE_DEV_FD is not defined and
|
||||
PROCESS_SUBSTITUTION is defined
|
||||
|
||||
subst.c
|
||||
- new function make_dev_fd_filename to return /dev/fd/xx, where
|
||||
xx corresponds to the parent end of the pipe
|
||||
- all the named pipe utility functions should be #if !defined
|
||||
(HAVE_DEV_FD)
|
||||
- change process_subsitute to do the following on systems with /dev/fd:
|
||||
1. Make a pipe in the parent
|
||||
2. if (open_for_read_in_child)
|
||||
parent_pipe_fd = fildes[1]
|
||||
child_pipe_fd = fildes[0]
|
||||
else
|
||||
parent_pipe_fd = fildes[0]
|
||||
child_pipe_fd = fildes[1]
|
||||
3. pathname = make_dev_fd_filename (parent_pipe_fd);
|
||||
4. fork
|
||||
5. In parent, close child_pipe_fd and return pathname
|
||||
6. In child, turn off job control, dup child_pipe_fd to
|
||||
either fd 0 or 1 depending on OPEN_FOR_READ_IN_CHILD,
|
||||
close parent_pipe_fd, parse and execute the string,
|
||||
and exit
|
||||
|
||||
shell.c
|
||||
- added call to unlink_fifo_list in reader_loop so that all fifos
|
||||
get closed, even after builtin commands are executed
|
||||
|
||||
1/6
|
||||
---
|
||||
machines.h, make_cmd.c, print_cmd.c, shell.c, cpp-Makefile
|
||||
- HAVE_VPRINTF --> HAVE_VFPRINTF
|
||||
|
||||
cpp-Makefile, machines.h, test.c
|
||||
- HAVE_MULTIPLE_GROUPS --> HAVE_GETGROUPS
|
||||
|
||||
cpp-Makefile, machines.h
|
||||
- HAVE_SIGLIST --> HAVE_SYS_SIGLIST
|
||||
|
||||
parse.y
|
||||
- add if_command production
|
||||
|
||||
builtins/echo.def
|
||||
- validate all arguments before using them so that -nanything != -n
|
||||
- document the -E option and its use
|
||||
|
||||
builtins/umask.def
|
||||
- allow other arguments to be used with -S
|
||||
|
||||
subst.c
|
||||
- make sure to close all files in the child created to run a
|
||||
process substutition to avoid holding write file descriptors
|
||||
to pipes that will cause the shell to hang
|
||||
|
||||
1/7
|
||||
---
|
||||
cpp-Makefile
|
||||
- fixed a typo: SEARCHLIB -> SEARCH_LIB
|
||||
|
||||
machines.h
|
||||
- new description for Amiga 3000 running System V.4
|
||||
|
||||
shell.c
|
||||
- default secondary prompt is now "> "
|
||||
|
||||
builtins/bashgetopt.c
|
||||
- more internal cleanups and bug fixes
|
||||
|
||||
support/mksysdefs
|
||||
- detect the amiga by the presence of /usr/amiga
|
||||
|
||||
1/9
|
||||
---
|
||||
general.c
|
||||
- canonicalize_pathname should remove ./ only if it's at the
|
||||
beginning of the pathname, or immediately preceded by a `/'
|
||||
|
||||
1/10
|
||||
----
|
||||
documentation/bash.1
|
||||
- clean up the documentation for test -t, since according to
|
||||
Posix, it always requires an argument
|
||||
|
||||
general.c
|
||||
- don't build index and rindex for DG machines
|
||||
|
||||
|
||||
machines.h
|
||||
- description for System V.4 on IBM 370 architecture
|
||||
- fixed up DG/UX machine description
|
||||
@@ -1,251 +0,0 @@
|
||||
[ Work begins after network release of version 1.11 ]
|
||||
|
||||
1/11
|
||||
----
|
||||
nojobs.c
|
||||
- Posix systems now reap zombie children and retry a fork() once if
|
||||
it fails
|
||||
- Posix systems should use waitpid() rather than wait() wherever
|
||||
possible
|
||||
- Posix systems do not need to validate a pid before calling waitpid()
|
||||
in wait_for_single_pid(); waitpid takes a pid argument
|
||||
|
||||
1/13
|
||||
----
|
||||
execute_cmd.c
|
||||
- get_next_path_element can return NULL, so the code that calls it
|
||||
must take that possibility into account
|
||||
|
||||
jobs.c
|
||||
- there was an extra parameter in the select() call
|
||||
|
||||
builtins/type.def
|
||||
- successful_finds needed to be initialized to 0
|
||||
|
||||
machines.h
|
||||
- fixed a typo (_D -> -D) in the DG/UX machine description
|
||||
|
||||
1/14
|
||||
----
|
||||
execute_cmd.c
|
||||
- fixed extract_colon_unit to return "" in the case of a trailing
|
||||
colon in the path
|
||||
|
||||
INSTALL
|
||||
- note that on SCO Xenix 386 one must use cc -E rather than /lib/cpp
|
||||
to process cpp-Makefile
|
||||
|
||||
cpp-Makefile
|
||||
- fixed the problem of a single quote in a makefile comment
|
||||
|
||||
machines.h
|
||||
- Xenix 386 machines need -DUSG in SYSDEP_CFLAGS
|
||||
|
||||
lib/readline/readline.c
|
||||
- changed the includes around so that the Xenix 386 support is
|
||||
in the same section as the USGr3 code, and the Xenix 286
|
||||
support is in the same section as the plain USG code
|
||||
|
||||
shell.c
|
||||
- split the `int code = setjmp (top_level)' statement in
|
||||
reader_loop into two statements -- some compilers don't like
|
||||
it
|
||||
|
||||
parse.y
|
||||
- changed the overloaded `yy_input_dev' to a `union STREAM',
|
||||
where a `union STREAM' is
|
||||
|
||||
typedef union STREAM {
|
||||
FILE *s_file;
|
||||
char *s_string;
|
||||
} STREAM;
|
||||
|
||||
and changed the parameter to init_yy_io and all the functions
|
||||
that call it to use a STREAM argument instead of casting back
|
||||
and forth between a (char *) and a (FILE *)
|
||||
|
||||
builtins/times.def
|
||||
- If hpux or USGr4, #undef HAVE_RESOURCE, rather than try to fit
|
||||
all the special cases onto a single line deciding whether or
|
||||
not to include <sys/resource.h>
|
||||
|
||||
1/15
|
||||
----
|
||||
bashline.c
|
||||
- changed the bindable name for the ksh-style ^O function from
|
||||
operate_and_get_next to operate-and-get-next
|
||||
|
||||
execute_cmd.c
|
||||
- some systems (e.g SGI) allow the result of alloca to be assigned
|
||||
only to a `simple' variable, so I introduced a dummy one instead
|
||||
of assigning to redirectee->word directly
|
||||
|
||||
shell.c
|
||||
- fixed a typo: PENDANTIC -> PEDANTIC
|
||||
|
||||
machines.h
|
||||
- took -DREVERESED_SETVBUF_ARGS out of the entries for Xenix 386
|
||||
|
||||
cpp-Makefile
|
||||
- added double quotes around the RHS of the assignment to
|
||||
SYSTEM_NAME to avoid further cpp processing if the system name
|
||||
happens to be a cpp define
|
||||
|
||||
bashline.c
|
||||
- added `search-forward', `search-backward' functions that perform
|
||||
non-incremental history searches using the vi-mode code
|
||||
|
||||
1/16
|
||||
----
|
||||
builtins/ulimit.def
|
||||
- fixed a typo in a comment
|
||||
- added parens around the object in an #if defined preprocessor
|
||||
statement
|
||||
|
||||
machines.h
|
||||
- the Xenix 386 machine descriptions need to #undef HAVE_GETWD
|
||||
|
||||
builtins/read.def
|
||||
- Fixed read to treat backslash as an escape character unless
|
||||
-r is given, as per Posix.2
|
||||
|
||||
lib/readline/readline.c
|
||||
- Fixed up the maze of dire[cn]t includes and defines so that
|
||||
they're correct for Xenix (finally)
|
||||
|
||||
lib/glob/glob.c
|
||||
- ditto. Now the defines/includes are correct for Xenix 386
|
||||
|
||||
execute_cmd.c
|
||||
- a loop of the form
|
||||
while : ; do echo -n 1; done
|
||||
can run a machine using Gwyn's alloca() emulation out of memory
|
||||
because alloca() keeps getting called at the same stack level
|
||||
and never frees anything up. Added a call to alloca(0) after
|
||||
the call to execute_simple_command in execute_command_internal
|
||||
- added Karl Kleinpaste's workaround for the AFS file creation
|
||||
bug, dependent on AFS_CREAT_BUG
|
||||
|
||||
parse.y
|
||||
- \s in a prompt string needs to decode to the shell basename, as
|
||||
per the documentation, rather than the full shell name
|
||||
|
||||
1/17
|
||||
----
|
||||
nojobs.c
|
||||
- fixed a typo in one of the WAITPID calls, thanks to Bruce Evans
|
||||
|
||||
[At this point, all of these fixes were sent along to bfox]
|
||||
|
||||
support/getcppsyms.c
|
||||
- now recognizes cpp symbol __hppa for use on HP precision
|
||||
architecture machines
|
||||
|
||||
machines.h
|
||||
- M_MACHINE is now `hppa' for HP Precision Architecture machines, so
|
||||
to make sure hpux is defined, it's now in SYSDEP_CFLAGS
|
||||
- Make sure that the RS6000/AIXv3 description defines M_OS as AIX,
|
||||
not "AIX". The quotes are added in cpp-Makefile
|
||||
|
||||
1/27
|
||||
----
|
||||
parser.h
|
||||
- new file, contains structures necessary to parse commands
|
||||
|
||||
input.h
|
||||
- new file, contains definitions and structures used to read input
|
||||
|
||||
bashline.c
|
||||
- removed the definitions for search-backward, search-forward
|
||||
|
||||
cpp-Makefile
|
||||
- removed the definition of DESTDIR; now passed down from Makefile
|
||||
|
||||
error.c, error.h
|
||||
- new files to isolate the error-handling functions
|
||||
|
||||
command.h
|
||||
- new file including structures used internally to represent
|
||||
commands
|
||||
|
||||
parse.y
|
||||
- include input.h, parser.h
|
||||
- changed all the code that deals with input streams to fit the
|
||||
new framework defined in input.h
|
||||
|
||||
make_cmd.c
|
||||
- moved the error reporting code to error.c
|
||||
- added cpp code to ensure that alloca is defined correctly
|
||||
|
||||
shell.h
|
||||
- removed the code that was moved to input.h, parser.h, command.h
|
||||
|
||||
builtins/common.c
|
||||
- moved a call to setjmp out of an if statement
|
||||
- changed the input code to work with the new input framework
|
||||
|
||||
builtins/getopt.c
|
||||
-include config.h if compiling for the shell
|
||||
|
||||
lib/readline/readline.c
|
||||
- change representation of characters > 127 to octal
|
||||
rather than M-c
|
||||
- changed representation of characters < ' ' to ^X rather
|
||||
than C-x
|
||||
- fixed a memory leak in parser_if () by freeing `tname'
|
||||
|
||||
machines.h
|
||||
- removed MIPS_CFLAGS from the ultrix Decstation entry, since the
|
||||
limit no longer needs increasing
|
||||
|
||||
variables.c
|
||||
- move the initialization of PWD before the environment is read, so
|
||||
an exported version of PWD takes precedence
|
||||
|
||||
readline.c, funmap.c, emacs_keymap.c
|
||||
- removed support for rl_arrow_keys -- it should now be done by the
|
||||
inputrc file
|
||||
|
||||
documentation/bash.1
|
||||
- only non-job-control shells start background jobs ignoring SIGINT
|
||||
and SIGQUIT
|
||||
|
||||
builtins/umask.def
|
||||
- don't print the octal representation of the umask if the symbolic
|
||||
representation has already been displayed
|
||||
- a bad option to umask should return EXECUTION_FAILURE, not -1
|
||||
|
||||
shell.c
|
||||
- new function, init_signal_handler (sig), to initialize the SIG
|
||||
signal hander, call it in main loop
|
||||
|
||||
nojobs.c
|
||||
- call init_signal_handler (SIGINT, sigint_sighandler) so the correct
|
||||
thing happens on Posix systems
|
||||
|
||||
general.c
|
||||
- updated the comment above the fallback implemenation of killpg()
|
||||
|
||||
machines.h
|
||||
- machine entry for the Unix PC
|
||||
- new variable HAVE_DIRENT
|
||||
|
||||
1/28
|
||||
----
|
||||
machines.h
|
||||
- SCO needs to #undef HAVE_GETCWD so that the getcwd() function
|
||||
supplied with bash is used
|
||||
|
||||
subst.c
|
||||
- USG machines should include <string.h>, others <strings.h>
|
||||
- sub_append_number should use itos() rather than xmalloc and
|
||||
sprintf
|
||||
|
||||
builtins/ulimit.def
|
||||
- changed the resource limit struct to one that has no explicit
|
||||
size to account for systems with differing numbers of resource
|
||||
limits
|
||||
|
||||
lib/readline/readline.c
|
||||
- there was an off-by-one error in the code that counts the number
|
||||
of items to list when doing completion listing
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,116 +0,0 @@
|
||||
# Hey Emacs, this Makefile is in -*- makefile -*- mode!
|
||||
#
|
||||
# Makefile for Bash.
|
||||
# If your cpp doesn't like -P, just get rid of it (the -P, not cpp).
|
||||
# If you wish to use Gcc, then type `make CC=gcc CPPNAME='$(CC) -E''.
|
||||
# If you wish to use GNU's Make, then change `MAKE'.
|
||||
# If you don't like the destination, then change `bindir'.
|
||||
# The file that you most likely want to look at is cpp-Makefile.
|
||||
#
|
||||
# If you haven't read README, now might be a good time.
|
||||
|
||||
# Include some boilerplate Gnu makefile definitions.
|
||||
prefix = /usr/local
|
||||
exec_prefix = $(prefix)
|
||||
bindir = $(exec_prefix)/bin
|
||||
srcdir = .
|
||||
VPATH = $(srcdir)
|
||||
|
||||
# MAKE = make
|
||||
RM = rm -f
|
||||
SHELL = /bin/sh
|
||||
GAWK = awk
|
||||
# GAWK = gawk
|
||||
|
||||
# Force CPPNAME to be the name of your C preprocesor if Bash can't
|
||||
# find it. For instance, `CPPNAME=/usr/libexec/cpp' on 4.4 BSD.
|
||||
# If all else fails, set CPPNAME=$(CC) -E
|
||||
CPPNAME =
|
||||
CPP = `/bin/sh $(CPPMAGIC) $(GETCPPSYMS) "$(CPPNAME)"` -P
|
||||
|
||||
CPP_MAKEFILE = $(srcdir)/cpp-Makefile
|
||||
ANSI_MAKEFILE = ansi-Makefile
|
||||
|
||||
# CPPFLAGS = $(SYSTEM) $(CPP_DEFINES)
|
||||
CPPFLAGS = $(CPP_DEFINES) -I. -I$(srcdir)
|
||||
CPP_ARGS = -DCPP_CC="$(CC)"
|
||||
|
||||
SUPPORTDIR = ./support/
|
||||
SUPPORTSRC = $(srcdir)/support/
|
||||
|
||||
MKSYSDEFS = $(SUPPORTSRC)mksysdefs
|
||||
CPPMAGIC = $(SUPPORTSRC)cppmagic
|
||||
CAT_S = $(SUPPORTSRC)cat-s
|
||||
GETCPPSYMS = $(SUPPORTDIR)getcppsyms
|
||||
GETCPPSYMS_SRC = $(SUPPORTSRC)getcppsyms.c
|
||||
|
||||
# Here is a command which compresses runs of multiple blank lines to a
|
||||
# single blank line. "cat -s" works for BSD systems, but not for USG
|
||||
# systems. You can use an awk script if you like. If you have too
|
||||
# much trouble with this, just forget it. It is for making
|
||||
# bash-Makefile pretty and readable; something that isn't strictly
|
||||
# necessary.
|
||||
# SQUASH_BLANKS = cat -s
|
||||
#
|
||||
SQUASH_BLANKS = $(GAWK) -f $(CAT_S)
|
||||
|
||||
all: .notified bash-Makefile
|
||||
$(MAKE) -f bash-Makefile $(MFLAGS) $(MAKEARGS) srcdir=$(srcdir) \
|
||||
prefix=$(prefix)
|
||||
|
||||
bash-Makefile: $(CPP_MAKEFILE) Makefile machines.h sysdefs.h config.h
|
||||
@-if [ -f ansi-Makefile ]; then \
|
||||
echo "cp ansi-Makefile tmp-Makefile.c"; \
|
||||
cp ansi-Makefile tmp-Makefile.c; else \
|
||||
echo "cp $(CPP_MAKEFILE) tmp-Makefile.c"; \
|
||||
cp $(CPP_MAKEFILE) tmp-Makefile.c; \
|
||||
fi
|
||||
$(RM) $(GETCPPSYMS)
|
||||
$(SHELL) $(SUPPORTSRC)mkdirs support
|
||||
$(CC) -o $(GETCPPSYMS) $(GETCPPSYMS_SRC)
|
||||
rm -f bash-Makefile
|
||||
@$(SHELL) -c 'echo $(CPP) $(CPPFLAGS) $(CPP_ARGS) tmp-Makefile.c \| $(SQUASH_BLANKS) \> bash-Makefile'
|
||||
@$(SHELL) -c '$(CPP) $(CPPFLAGS) $(CPP_ARGS) tmp-Makefile.c | $(SQUASH_BLANKS) >bash-Makefile'
|
||||
rm -f tmp-Makefile.c
|
||||
@test -s bash-Makefile || { rm -f bash-Makefile ; exit 1; }
|
||||
|
||||
sysdefs.h: $(MKSYSDEFS)
|
||||
$(SHELL) $(MKSYSDEFS) -s $(srcdir)
|
||||
|
||||
# This is also performed by support/mksysdefs, but there's no way to change
|
||||
# it if cpp-Makefile is changed without changing anything else, since there
|
||||
# are no dependencies. This lets you run `make ansi-Makefile'.
|
||||
ansi-Makefile: $(CPP_MAKEFILE)
|
||||
grep -v '/\*\*/' $(CPP_MAKEFILE) > $@
|
||||
|
||||
# Subsequent lines contain targets that are correctly handled by an
|
||||
# existing bash-Makefile.
|
||||
|
||||
install uninstall newversion architecture: bash-Makefile
|
||||
$(MAKE) -f bash-Makefile $(MFLAGS) $(MAKEARGS) bindir=$(bindir) \
|
||||
prefix=$(prefix) $@
|
||||
|
||||
tests DEFINES tags documentation: bash-Makefile directory-frob
|
||||
$(MAKE) -f bash-Makefile $(MFLAGS) $(MAKEARGS) bindir=$(bindir) $@
|
||||
|
||||
clean distclean realclean: bash-Makefile directory-frob
|
||||
rm -f .notified
|
||||
$(MAKE) -f bash-Makefile $(MFLAGS) $(MAKEARGS) bindir=$(bindir) $@
|
||||
|
||||
directory-frob:
|
||||
|
||||
.NOEXPORT:
|
||||
|
||||
.notified:
|
||||
@echo ""
|
||||
@echo " You are about to make this version of GNU Bash for"
|
||||
@echo " this architecture for the first time. If you haven't"
|
||||
@echo " yet read the README file, you may want to do so. If"
|
||||
@echo " you wish to report a bug in Bash, or in the installation"
|
||||
@echo " procedure, please run the bashbug script and include:"
|
||||
@echo ""
|
||||
@echo " * a description of the bug,"
|
||||
@echo " * a recipe for recreating the bug reliably,"
|
||||
@echo " * a fix for the bug if you have one!"
|
||||
@echo ""
|
||||
@touch .notified
|
||||
@@ -1,268 +0,0 @@
|
||||
# This Makefile for building libbuiltins.a is in -*- text -*- for Emacs.
|
||||
#
|
||||
MKBUILTINS = mkbuiltins
|
||||
RANLIB = ranlib
|
||||
CFLAGS = -g -I.. -I.
|
||||
SHELL = /bin/sh
|
||||
# CC = cc
|
||||
AR = ar
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
|
||||
srcdir = .
|
||||
VPATH = .:$(srcdir)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .def .c .o
|
||||
# How to make a .o file from a .def file.
|
||||
.def.o:
|
||||
$(RM) $@
|
||||
./$(MKBUILTINS) $(DIRECTDEFINE) $<
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $*.c || ( $(RM) $*.c ; exit 1 )
|
||||
$(RM) $*.c
|
||||
|
||||
# How to make a .c file from a .def file.
|
||||
.def.c:
|
||||
$(RM) $@
|
||||
./$(MKBUILTINS) $(DIRECTDEFINE) $<
|
||||
|
||||
# Here is a rule for making .o files from .c files that does not
|
||||
# force the type of the machine (like -M_MACHINE) into the flags.
|
||||
.c.o:
|
||||
$(RM) $@
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $<
|
||||
|
||||
DEFS = $(srcdir)/alias.def $(srcdir)/bind.def $(srcdir)/break.def \
|
||||
$(srcdir)/builtin.def $(srcdir)/cd.def $(srcdir)/colon.def \
|
||||
$(srcdir)/command.def $(srcdir)/declare.def $(srcdir)/echo.def \
|
||||
$(srcdir)/enable.def $(srcdir)/eval.def $(srcdir)/getopts.def \
|
||||
$(srcdir)/exec.def $(srcdir)/exit.def $(srcdir)/fc.def \
|
||||
$(srcdir)/fg_bg.def $(srcdir)/hash.def $(srcdir)/help.def \
|
||||
$(srcdir)/history.def $(srcdir)/jobs.def $(srcdir)/kill.def \
|
||||
$(srcdir)/let.def $(srcdir)/read.def $(srcdir)/return.def \
|
||||
$(srcdir)/set.def $(srcdir)/setattr.def $(srcdir)/shift.def \
|
||||
$(srcdir)/source.def $(srcdir)/suspend.def $(srcdir)/test.def \
|
||||
$(srcdir)/times.def $(srcdir)/trap.def $(srcdir)/type.def \
|
||||
$(srcdir)/ulimit.def $(srcdir)/umask.def $(srcdir)/wait.def \
|
||||
$(srcdir)/reserved.def $(srcdir)/pushd.def $(srcdir)/shopt.def
|
||||
|
||||
STATIC_SOURCE = common.c getopt.c bashgetopt.c getopt.h
|
||||
|
||||
OFILES = builtins.o \
|
||||
alias.o bind.o break.o builtin.o cd.o colon.o command.o \
|
||||
common.o declare.o echo.o enable.o eval.o exec.o exit.o \
|
||||
fc.o fg_bg.o hash.o help.o history.o jobs.o kill.o let.o \
|
||||
pushd.o read.o return.o set.o setattr.o shift.o source.o \
|
||||
suspend.o test.o times.o trap.o type.o ulimit.o umask.o \
|
||||
wait.o getopts.o shopt.o getopt.o bashgetopt.o
|
||||
|
||||
THINGS_TO_TAR = $(DEFS) $(STATIC_SOURCE) Makefile ChangeLog
|
||||
|
||||
CREATED_FILES = builtext.h builtins.c psize.aux pipesize.h
|
||||
|
||||
all: $(MKBUILTINS) libbuiltins.a
|
||||
|
||||
libbuiltins.a: $(MKBUILTINS) $(OFILES)
|
||||
$(RM) $@
|
||||
$(AR) cq $@ $(OFILES)
|
||||
-$(RANLIB) $@
|
||||
|
||||
builtext.h builtins.c: $(MKBUILTINS) $(DEFS)
|
||||
$(RM) builtext.h builtins.c
|
||||
./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
|
||||
-noproduction $(DIRECTDEFINE) $(DEFS)
|
||||
|
||||
mkbuiltins: $(srcdir)/mkbuiltins.c ../config.h
|
||||
$(CC) $(CFLAGS) -o $(MKBUILTINS) $(srcdir)/mkbuiltins.c
|
||||
|
||||
ulimit.o: ulimit.def pipesize.h
|
||||
|
||||
pipesize.h: psize.aux
|
||||
$(SHELL) $(srcdir)/psize.sh > pipesize.h
|
||||
|
||||
psize.aux: psize.c
|
||||
$(CC) $(CFLAGS) -o $@ $(srcdir)/psize.c
|
||||
|
||||
documentation: builtins.texi
|
||||
|
||||
$(OFILES): $(MKBUILTINS) ../config.h
|
||||
|
||||
builtins.texi: $(MKBUILTINS)
|
||||
./$(MKBUILTINS) -documentonly $(DEFS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OFILES) $(CREATED_FILES) $(MKBUILTINS) libbuiltins.a
|
||||
|
||||
alias.o: alias.def
|
||||
bind.o: bind.def
|
||||
break.o: break.def
|
||||
builtin.o: builtin.def
|
||||
cd.o: cd.def
|
||||
colon.o: colon.def
|
||||
command.o: command.def
|
||||
declare.o: declare.def
|
||||
echo.o: echo.def
|
||||
enable.o: enable.def
|
||||
eval.o: eval.def
|
||||
exec.o: exec.def
|
||||
exit.o: exit.def
|
||||
fc.o: fc.def
|
||||
fg_bg.o: fg_bg.def
|
||||
hash.o: hash.def
|
||||
help.o: help.def
|
||||
history.o: history.def
|
||||
jobs.o: jobs.def
|
||||
kill.o: kill.def
|
||||
let.o: let.def
|
||||
pushd.o: pushd.def
|
||||
read.o: read.def
|
||||
return.o: return.def
|
||||
set.o: set.def
|
||||
setattr.o: setattr.def
|
||||
shift.o: shift.def
|
||||
source.o: source.def
|
||||
suspend.o: suspend.def
|
||||
test.o: test.def
|
||||
times.o: times.def
|
||||
trap.o: trap.def
|
||||
type.o: type.def
|
||||
umask.o: umask.def
|
||||
wait.o: wait.def
|
||||
getopts.o: getopts.def
|
||||
reserved.o: reserved.def
|
||||
|
||||
common.o: ../shell.h ../command.h ../config.h ../memalloc.h ../general.h
|
||||
common.o: ../variables.h ../input.h hashcom.h ../bashhist.h
|
||||
common.o: ../quit.h ../unwind_prot.h ../maxpath.h ../jobs.h ../builtins.h
|
||||
common.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
common.o: ../execute_cmd.h ../error.h
|
||||
alias.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
alias.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
alias.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../maxpath.h
|
||||
bind.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
bind.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
bind.o: ../maxpath.h ../bashline.h
|
||||
bind.o: ../shell.h ../unwind_prot.h ../variables.h bashgetopt.h
|
||||
break.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
break.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
break.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
builtin.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
builtin.o: ../quit.h common.h ../maxpath.h
|
||||
builtin.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
builtin.o: ../shell.h ../unwind_prot.h ../variables.h
|
||||
cd.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
cd.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
cd.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../maxpath.h
|
||||
command.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
command.o: ../quit.h bashgetopt.h ../maxpath.h
|
||||
command.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
command.o: ../shell.h ../unwind_prot.h ../variables.h
|
||||
declare.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
declare.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
declare.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
echo.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
echo.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
echo.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
enable.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
enable.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
enable.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
eval.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
eval.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
eval.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
exec.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
exec.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
exec.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../execute_cmd.h
|
||||
exec.o: ../maxpath.h ../flags.h
|
||||
exit.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
exit.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
exit.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
fc.o: ../builtins.h ../command.h bashgetopt.h ../bashhist.h
|
||||
fc.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
fc.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
fc.o: ../flags.h ../unwind_prot.h ../variables.h ../shell.h ../maxpath.h
|
||||
fg_bg.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
fg_bg.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
fg_bg.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
getopts.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
getopts.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
getopts.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
hash.o: ../builtins.h ../command.h ../quit.h ../execute_cmd.h
|
||||
hash.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
hash.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../maxpath.h
|
||||
help.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
help.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
help.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
history.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
history.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
history.o: ../filecntl.h ../shell.h ../unwind_prot.h ../variables.h
|
||||
history.o: ../bashhist.h ../maxpath.h
|
||||
inlib.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
inlib.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
inlib.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
jobs.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
jobs.o: ../quit.h bashgetopt.h ../maxpath.h
|
||||
jobs.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
jobs.o: ../shell.h ../unwind_prot.h ../variables.h
|
||||
kill.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
kill.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
kill.o: ../shell.h ../trap.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
let.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
let.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
let.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
pushd.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
pushd.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
pushd.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h common.h
|
||||
read.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
read.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
read.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
return.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
return.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
return.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
set.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
set.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
set.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
setattr.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
setattr.o: ../quit.h common.h bashgetopt.h ../maxpath.h
|
||||
setattr.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
setattr.o: ../shell.h ../unwind_prot.h ../variables.h
|
||||
shift.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
shift.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
shift.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
source.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
source.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
source.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
suspend.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
suspend.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
suspend.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
test.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
test.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
test.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
times.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
times.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
times.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
trap.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
trap.o: ../quit.h common.h ../maxpath.h
|
||||
trap.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
trap.o: ../shell.h ../unwind_prot.h ../variables.h ../execute_cmd.h
|
||||
type.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
type.o: ../quit.h common.h ../maxpath.h
|
||||
type.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
type.o: ../shell.h ../unwind_prot.h ../variables.h
|
||||
ulimit.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
ulimit.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
ulimit.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
umask.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
umask.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
umask.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
wait.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
wait.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
wait.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
shopt.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
|
||||
shopt.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
|
||||
shopt.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
|
||||
shopt.o: common.h bashgetopt.h
|
||||
bashgetopt.o: ../bashansi.h ../ansi_stdlib.h
|
||||
mkbuiltins.o: ../bashansi.h ../ansi_stdlib.h
|
||||
fc.o: ../bashansi.h ../ansi_stdlib.h
|
||||
|
||||
#bind.o: $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)readline.h $(RL_LIBSRC)keymaps.h
|
||||
@@ -1,119 +0,0 @@
|
||||
# This Makefile is for the Bash/documentation directory -*- text -*-.
|
||||
#
|
||||
CP = cp
|
||||
RM = rm -f
|
||||
|
||||
INSTALL_DATA = install -c -m 644
|
||||
|
||||
DOC_SUPPORT = ../lib/doc-support/
|
||||
TEXINDEX = $(DOC_SUPPORT)texindex
|
||||
TEXINDSRC = $(DOC_SUPPORT)texindex.c
|
||||
TEX = tex
|
||||
QUIETPS = #set this to -q to shut up dvips
|
||||
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
|
||||
TEXINPUTS = ./../lib/readline/doc
|
||||
MAKEINFO = makeinfo
|
||||
|
||||
# Change to groff -Tascii if you don't have nroff
|
||||
NROFF = nroff
|
||||
|
||||
# This should be a program that converts troff to postscript
|
||||
GROFF = groff
|
||||
|
||||
HSUSER = ./../lib/readline/doc/hsuser.texinfo
|
||||
RLUSER = ./../lib/readline/doc/rluser.texinfo
|
||||
|
||||
.SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi
|
||||
|
||||
.1.ps:
|
||||
$(RM) $@
|
||||
-${GROFF} -man $< > $@
|
||||
|
||||
.1.0:
|
||||
$(RM) $@
|
||||
-${NROFF} -man $< > $@
|
||||
|
||||
.ms.ps:
|
||||
$(RM) $@
|
||||
-${GROFF} -ms $< > $@
|
||||
|
||||
.ms.txt:
|
||||
$(RM) $@
|
||||
-${NROFF} -ms $< > $@
|
||||
|
||||
.3.ps:
|
||||
$(RM) $@
|
||||
-${GROFF} -man $< > $@
|
||||
|
||||
.3.0:
|
||||
$(RM) $@
|
||||
-${NROFF} -man $< > $@
|
||||
|
||||
all: ps info dvi text
|
||||
|
||||
ps: bash.ps builtins.ps readline.ps article.ps
|
||||
dvi: features.dvi features.ps
|
||||
info: features.info
|
||||
text: bash.0 builtins.0 readline.0
|
||||
|
||||
features.dvi: features.texi $(HSUSER) $(RLUSER)
|
||||
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) features.texi
|
||||
$(TEXINDEX) features.??
|
||||
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) features.texi
|
||||
|
||||
features.ps: features.dvi
|
||||
$(RM) $@
|
||||
$(DVIPS) features.dvi
|
||||
|
||||
features.info: features.texi $(HSUSER) $(RLUSER)
|
||||
$(MAKEINFO) --no-split -I$(TEXINPUTS) features.texi
|
||||
|
||||
bash.dvi: $(TEXINDEX) bash.texinfo $(HSUSER) $(RLUSER)
|
||||
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) bash.texinfo
|
||||
$(TEXINDEX) bash.??
|
||||
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) bash.texinfo
|
||||
|
||||
bashman.ps: bash.dvi
|
||||
rm -f $@
|
||||
$(DVIPS) bash.dvi
|
||||
|
||||
bash.txt: bash.1
|
||||
bash.ps: bash.1
|
||||
builtins.ps: builtins.1 bash.1
|
||||
builtins.txt: builtins.1 bash.1
|
||||
readline.txt: readline.3
|
||||
readline.ps: readline.3
|
||||
article.ps: article.ms
|
||||
|
||||
$(TEXINDEX): $(TEXINDSRC)
|
||||
(cd $(DOC_SUPPORT); $(MAKE) $(MFLAGS) texindex)
|
||||
|
||||
hsuser.texinfo: ../lib/readline/doc/hsuser.texinfo
|
||||
ln -s ../lib/readline/doc/hsuser.texinfo .
|
||||
|
||||
rluser.texinfo: ../lib/readline/doc/rluser.texinfo
|
||||
ln -s ../lib/readline/doc/rluser.texinfo .
|
||||
|
||||
clean:
|
||||
rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
|
||||
*.fns *.kys *.tps *.vrs *.o core texindex rluser.texinfo hsuser.texinfo
|
||||
|
||||
distclean:
|
||||
rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
|
||||
*.dvi *.info *.info-* *.fns *.kys *.tps *.vrs *.o core texindex \
|
||||
rluser.texinfo hsuser.texinfo
|
||||
|
||||
realclean: clean
|
||||
|
||||
install: all
|
||||
-[ -d $(mandir) ] || mkdir $(mandir)
|
||||
$(INSTALL_DATA) bash.1 $(mandir)
|
||||
sed 's:so bash.1:so man1/bash.1:' < builtins.1 > $(mandir)/bash_builtins.1
|
||||
-[ -d $(man3dir) ] || mkdir $(man3dir)
|
||||
$(INSTALL_DATA) readline.3 $(man3dir)
|
||||
-[ -d $(infodir) ] || mkdir $(infodir)
|
||||
$(INSTALL_DATA) features.info $(infodir)/bash.info
|
||||
|
||||
uninstall:
|
||||
$(RM) $(mandir)/bash.1 $(mandir)/bash_builtins.1
|
||||
$(RM) $(man3dir)/readline.3 $(infodir)/bash.info
|
||||
@@ -1,92 +0,0 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for the GNU Glob Library. #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
# This Makefile is hand made from a template file, found in
|
||||
# ../template. Each library must provide several Makefile
|
||||
# targets: `all', `clean', `documentation', `install', and
|
||||
# `what-tar'. The `what-tar' target reports the names of the
|
||||
# files that need to be included in a tarfile to build the full
|
||||
# code and documentation for this library.
|
||||
|
||||
# Please note that the values for INCLUDES, CC, AR, RM, CP,
|
||||
# RANLIB, and selfdir are passed in from ../Makefile, and do
|
||||
# not need to be defined here.
|
||||
srcdir = .
|
||||
VPATH = .:$(srcdir)
|
||||
|
||||
# Here is a rule for making .o files from .c files that doesn't force
|
||||
# the type of the machine (like -sun3) into the flags.
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(LOCAL_DEFINES) $(CPPFLAGS) $<
|
||||
|
||||
# LOCAL_DEFINES are flags that are specific to this library.
|
||||
# Define -DUSG if you are using a System V operating system.
|
||||
LOCAL_DEFINES = $(LOCAL_INCLUDES) #-DUSG
|
||||
|
||||
# For libraries which include headers from other libraries.
|
||||
LOCAL_INCLUDES = -I..
|
||||
|
||||
# The name of the library target.
|
||||
LIBRARY_NAME = libglob.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = $(srcdir)glob.c $(srcdir)fnmatch.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = $(srcdir)fnmatch.h
|
||||
|
||||
OBJECTS = glob.o fnmatch.o
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/glob.texi
|
||||
DOCOBJECT = doc/glob.dvi
|
||||
DOCSUPPORT = doc/Makefile
|
||||
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
||||
|
||||
SUPPORT = Makefile ChangeLog $(DOCSUPPORT)
|
||||
|
||||
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
|
||||
|
||||
######################################################################
|
||||
|
||||
all: $(LIBRARY_NAME)
|
||||
|
||||
$(LIBRARY_NAME): $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(AR) cq $@ $(OBJECTS)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
|
||||
|
||||
what-tar:
|
||||
@for file in $(THINGS_TO_TAR); do \
|
||||
echo $(selfdir)$$file; \
|
||||
done
|
||||
|
||||
documentation: force
|
||||
-(cd doc; $(MAKE) $(MFLAGS))
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install:
|
||||
-$(MV) $(bindir)/$(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)-old
|
||||
$(CP) $(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $(bindir)/$(LIBRARY_NAME)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(LIBRARY_NAME)
|
||||
-(cd doc; $(MAKE) $(MFLAGS) clean)
|
||||
|
||||
|
||||
######################################################################
|
||||
# #
|
||||
# Dependencies for the object files which make up this library. #
|
||||
# #
|
||||
######################################################################
|
||||
|
||||
fnmatch.o: fnmatch.c fnmatch.h
|
||||
@@ -1,33 +0,0 @@
|
||||
# Skeleton Makefile for the GNU malloc code
|
||||
#
|
||||
# Maybe this should really create a library instead of just compiling
|
||||
# source files
|
||||
|
||||
srcdir = .
|
||||
VPATH = .:$(srcdir)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
.s.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
MALLOC_SOURCE = malloc.c
|
||||
|
||||
ALLOCA_SOURCE = alloca.c
|
||||
ALLOCA_OBJECT = alloca.o
|
||||
|
||||
libmalloc.a: malloc.o $(ALLOCA)
|
||||
rm -f $@
|
||||
ar cq $@ malloc.o $(ALLOCA)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
|
||||
|
||||
malloc.o: malloc.c getpagesize.h
|
||||
|
||||
$(ALLOCA_OBJECT): $(ALLOCA_SOURCE)
|
||||
|
||||
alloca.o: $(ALLOCA_SOURCE)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
@- if [ "$(ALLOCA_OBJECT)" != alloca.o ]; then \
|
||||
mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \
|
||||
fi
|
||||
@@ -1,154 +0,0 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for the GNU Readline and History Libraries. #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
srcdir = .
|
||||
VPATH = .:$(srcdir)
|
||||
|
||||
INSTALL = install -c
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
|
||||
RANLIB = ranlib
|
||||
AR = ar
|
||||
RM = rm
|
||||
CP = cp
|
||||
MV = mv
|
||||
|
||||
# See the file STANDALONE for the -D defines that readline understands
|
||||
DEFS =
|
||||
# For libraries which include headers from other libraries.
|
||||
LOCAL_INCLUDES = -I. -I..
|
||||
|
||||
CPPFLAGS = $(DEFS) $(LOCAL_INCLUDES)
|
||||
|
||||
# Here is a rule for making .o files from .c files that doesn't force
|
||||
# the type of the machine (like -sun3) into the flags.
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
# The name of the main library target.
|
||||
LIBRARY_NAME = libreadline.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = $(srcdir)readline.c $(srcdir)funmap.c $(srcdir)keymaps.c \
|
||||
$(srcdir)vi_mode.c $(srcdir)parens.c $(srcdir)rltty.c \
|
||||
$(srcdir)complete.c $(srcdir)bind.c $(srcdir)isearch.c \
|
||||
$(srcdir)display.c $(srcdir)signals.c $(srcdir)emacs_keymap.c \
|
||||
$(srcdir)vi_keymap.c $(srcdir)util.c $(srcdir)kill.c \
|
||||
$(srcdir)undo.c $(srcdir)macro.c $(srcdir)input.c \
|
||||
$(srcdir)callback.c $(srcdir)xmalloc.c \
|
||||
$(srcdir)history.c $(srcdir)histsearch.c $(srcdir)histexpand.c \
|
||||
$(srcdir)histfile.c \
|
||||
$(srcdir)tilde.c \
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
|
||||
posixstat.h tilde.h rlconf.h
|
||||
|
||||
HISTOBJ = history.o histexpand.o histfile.o histsearch.o
|
||||
TILDEOBJ= tilde.o
|
||||
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
|
||||
rltty.o complete.o bind.o isearch.o display.o signals.o \
|
||||
util.o kill.o undo.o macro.o input.o callback.o xmalloc.o \
|
||||
$(HISTOBJ) $(TILDEOBJ)
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
|
||||
DOCOBJECT = doc/readline.dvi
|
||||
DOCSUPPORT = doc/Makefile
|
||||
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
||||
|
||||
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
|
||||
|
||||
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
|
||||
|
||||
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
|
||||
|
||||
##########################################################################
|
||||
|
||||
all: libreadline.a libhistory.a
|
||||
|
||||
libreadline.a: $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(AR) cq $@ $(OBJECTS)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
|
||||
|
||||
libhistory.a: $(HISTOBJ) xmalloc.o
|
||||
$(RM) -f $@
|
||||
$(AR) cq $@ $(HISTOBJ) xmalloc.o
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
|
||||
|
||||
documentation: force
|
||||
[ ! -d doc ] && mkdir doc
|
||||
(if [ -d doc ]; then cd doc; $(MAKE) $(MFLAGS); fi)
|
||||
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install: installdirs libreadline.a
|
||||
for file in $(INSTALLED_HEADERS) ; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file $(incdir)/readline ; \
|
||||
done
|
||||
${INSTALL_DATA} readline.h keymaps.h chardefs.h history.h \
|
||||
$(incdir)/readline
|
||||
-${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
|
||||
${INSTALL_DATA} libreadline.a $(bindir)/libreadline.a
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $(bindir)/libreadline.a
|
||||
|
||||
installdirs:
|
||||
-[ ! -d $(incdir)/readline ] && { \
|
||||
mkdir $(incdir)/readline && chmod 755 $(incdir)/readline; }
|
||||
-[ ! -d $(libdir) ] && mkdir $(libdir)
|
||||
|
||||
uninstall:
|
||||
cd $(incdir)/readline && ${RM} -f ${INSTALLED_HEADERS}
|
||||
cd $(libdir) && ${RM} -f libreadline.a libreadline.old
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) *.a
|
||||
(if [ -d doc ]; then cd doc; $(MAKE) $(MFLAGS) $@; fi)
|
||||
|
||||
tags: force
|
||||
etags $(CSOURCES) $(HSOURCES)
|
||||
|
||||
TAGS: force
|
||||
ctags -x $(CSOURCES) $(HSOURCES) > $@
|
||||
|
||||
readline: readline.h rldefs.h chardefs.h
|
||||
readline: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
|
||||
$(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
|
||||
keymaps.o -ltermcap
|
||||
|
||||
realclean distclean mostlyclean: clean
|
||||
|
||||
# Dependencies
|
||||
readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h
|
||||
readline.o: keymaps.h history.h
|
||||
vi_mode.o: rldefs.h rlconf.h readline.h history.h
|
||||
funmap.o: funmap.c readline.h rlconf.h
|
||||
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
|
||||
history.o: history.h histlib.h
|
||||
histexpand.o: history.h histlib.h
|
||||
histsearch.o: history.h histlib.h
|
||||
histfile.o: history.h histlib.h
|
||||
isearch.o: readline.h history.h
|
||||
search.o: readline.h history.h
|
||||
display.o: readline.h history.h rldefs.h rlconf.h
|
||||
complete.o: readline.h rldefs.h rlconf.h
|
||||
rltty.o: rldefs.h rlconf.h readline.h
|
||||
bind.o: rldefs.h rlconf.h readline.h history.h
|
||||
signals.o: rldefs.h rlconf.h readline.h history.h
|
||||
parens.o: readline.h
|
||||
kill.o: rldefs.h rlconf.h readline.h history.h
|
||||
macro.o: rldefs.h rlconf.h readline.h history.h
|
||||
undo.o: rldefs.h rlconf.h readline.h history.h
|
||||
input.o: rldefs.h rlconf.h readline.h history.h
|
||||
callback.o: rlconf.h rldefs.h readline.h
|
||||
@@ -1,64 +0,0 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for termcap replacement libbrary. #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
# Here is a rule for making .o files from .c files that doesn't force
|
||||
# the type of the machine (like -sun3) into the flags.
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $*.c
|
||||
|
||||
# Destination installation directory. The libraries are copied to DESTDIR
|
||||
# when you do a `make install'.
|
||||
DESTDIR = /usr/local/lib
|
||||
|
||||
DEBUG_FLAGS = -g
|
||||
#OPTIMIZE_FLAGS = -O
|
||||
LDFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS = $(DEBUG_FLAGS) $(OPTIMIZE_FLAGS)
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# A good alternative is gcc -traditional.
|
||||
#CC = gcc -traditional
|
||||
CC = cc
|
||||
RANLIB = /usr/bin/ranlib
|
||||
AR = ar
|
||||
RM = rm
|
||||
CP = cp
|
||||
|
||||
CSOURCES = termcap.c tparam.c
|
||||
|
||||
SOURCES = $(CSOURCES)
|
||||
|
||||
OBJECTS = termcap.o tparam.o
|
||||
|
||||
DOCUMENTATION = termcap.texinfo
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(DOCUMENTATION)
|
||||
|
||||
##########################################################################
|
||||
|
||||
all: libtermcap.a
|
||||
|
||||
libtermcap.a: $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(AR) clq $@ $(OBJECTS)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
|
||||
|
||||
termcap.tar: $(THINGS_TO_TAR)
|
||||
tar -cf $@ $(THINGS_TO_TAR)
|
||||
|
||||
termcap.tar.Z: termcap.tar
|
||||
compress -f termcap.tar
|
||||
|
||||
install: $(DESTDIR)/libtermcap.a
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
|
||||
|
||||
$(DESTDIR)/libtermcap.a: libtermcap.a
|
||||
-mv $(DESTDIR)/libtermcap.a $(DESTDIR)/libtermcap.old
|
||||
cp libtermcap.a $@
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $@
|
||||
@@ -1,94 +0,0 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for the GNU Tilde Library. #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
# This Makefile is hand made from a template file, found in
|
||||
# ../template. Each library must provide several Makefile
|
||||
# targets: `all', `clean', `documentation', `install', and
|
||||
# `what-tar'. The `what-tar' target reports the names of the
|
||||
# files that need to be included in a tarfile to build the full
|
||||
# code and documentation for this library.
|
||||
|
||||
# Please note that the values for INCLUDES, CC, AR, RM, CP,
|
||||
# RANLIB, and selfdir are passed in from ../Makefile, and do
|
||||
# not need to be defined here.
|
||||
RM = rm
|
||||
|
||||
srcdir = .
|
||||
VPATH = .:$(srcdir)
|
||||
|
||||
# Here is a rule for making .o files from .c files that doesn't force
|
||||
# the type of the machine (like -sun3) into the flags.
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(LOCAL_DEFINES) $(CPPFLAGS) $<
|
||||
|
||||
# LOCAL_DEFINES are flags that are specific to this library.
|
||||
# Define -DUSG if you are using a System V operating system.
|
||||
LOCAL_DEFINES = $(LOCAL_INCLUDES) #-DUSG
|
||||
|
||||
# For libraries which include headers from other libraries.
|
||||
LOCAL_INCLUDES = -I..
|
||||
|
||||
# The name of the library target.
|
||||
LIBRARY_NAME = libtilde.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = $(srcdir)/tilde.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = $(srcdir)/tilde.h
|
||||
|
||||
OBJECTS = tilde.o
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/tilde.texi
|
||||
DOCOBJECT = doc/tilde.dvi
|
||||
DOCSUPPORT = doc/Makefile
|
||||
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
||||
|
||||
SUPPORT = Makefile ChangeLog $(DOCSUPPORT)
|
||||
|
||||
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
|
||||
|
||||
######################################################################
|
||||
|
||||
all: $(LIBRARY_NAME)
|
||||
|
||||
$(LIBRARY_NAME): $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(AR) cq $@ $(OBJECTS)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
|
||||
|
||||
what-tar:
|
||||
@for file in $(THINGS_TO_TAR); do \
|
||||
echo $(selfdir)$$file; \
|
||||
done
|
||||
|
||||
documentation: force
|
||||
-(cd doc; $(MAKE) $(MFLAGS))
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install:
|
||||
-$(MV) $(bindir)/$(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)-old
|
||||
$(CP) $(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)
|
||||
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $(bindir)/$(LIBRARY_NAME)
|
||||
|
||||
clean:
|
||||
$(RM) -f $(OBJECTS) $(LIBRARY_NAME)
|
||||
-(cd doc; $(MAKE) $(MFLAGS) clean)
|
||||
|
||||
|
||||
######################################################################
|
||||
# #
|
||||
# Dependencies for the object files which make up this library. #
|
||||
# #
|
||||
######################################################################
|
||||
|
||||
tilde.o: tilde.h tilde.c
|
||||
@@ -1,178 +0,0 @@
|
||||
/* config.h -- Configuration file for bash. */
|
||||
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_CONFIG_H_)
|
||||
#define _CONFIG_H_
|
||||
|
||||
#if !defined (BUILDING_MAKEFILE)
|
||||
#include "memalloc.h"
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H) && !defined (BUILDING_MAKEFILE)
|
||||
# ifdef CRAY
|
||||
# define word __word
|
||||
# endif
|
||||
#include <unistd.h>
|
||||
# ifdef CRAY
|
||||
# undef word
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define JOB_CONTROL if your operating system supports
|
||||
BSD-like job control. */
|
||||
#define JOB_CONTROL
|
||||
|
||||
/* Note that vanilla System V machines don't support BSD job control,
|
||||
although some do support Posix job control. */
|
||||
#if defined (USG) || defined (MINIX) || defined (Minix)
|
||||
# if !defined (_POSIX_JOB_CONTROL)
|
||||
# undef JOB_CONTROL
|
||||
# endif /* !_POSIX_JOB_CONTROL */
|
||||
#endif /* USG || Minix || MINIX */
|
||||
|
||||
/* Define ALIAS if you want the alias features. */
|
||||
#define ALIAS
|
||||
|
||||
/* Define PUSHD_AND_POPD if you want those commands to be compiled in.
|
||||
(Also the `dirs' commands.) */
|
||||
#define PUSHD_AND_POPD
|
||||
|
||||
/* Define BRACE_EXPANSION if you want curly brace expansion a la Csh:
|
||||
foo{a,b} -> fooa foob. Even if this is compiled in (the default) you
|
||||
can turn it off at shell startup with `-nobraceexpansion', or during
|
||||
shell execution with `set +o braceexpand'. */
|
||||
#define BRACE_EXPANSION
|
||||
|
||||
/* Define READLINE to get the nifty/glitzy editing features.
|
||||
This is on by default. You can turn it off interactively
|
||||
with the -nolineediting flag. */
|
||||
#define READLINE
|
||||
|
||||
/* Define BANG_HISTORY if you want to have Csh style "!" history expansion.
|
||||
This is unrelated to READLINE. */
|
||||
#define BANG_HISTORY
|
||||
|
||||
/* Define HISTORY if you want to have access to previously typed commands.
|
||||
|
||||
If both HISTORY and READLINE are defined, you can get at the commands
|
||||
with line editing commands, and you can directly manipulate the history
|
||||
from the command line.
|
||||
|
||||
If only HISTORY is defined, the `fc' and `history' builtins are
|
||||
available. */
|
||||
#define HISTORY
|
||||
|
||||
#if defined (BANG_HISTORY) && !defined (HISTORY)
|
||||
/* BANG_HISTORY requires HISTORY. */
|
||||
# define HISTORY
|
||||
#endif /* BANG_HISTORY && !HISTORY */
|
||||
|
||||
#if defined (READLINE) && !defined (HISTORY)
|
||||
# define HISTORY
|
||||
#endif
|
||||
|
||||
/* Define this if you want completion that puts all alternatives into
|
||||
a brace expansion shell expression. */
|
||||
#if defined (BRACE_EXPANSION) && defined (READLINE)
|
||||
# define BRACE_COMPLETION
|
||||
#endif /* BRACE_EXPANSION */
|
||||
|
||||
/* The default value of the PATH variable. */
|
||||
#define DEFAULT_PATH_VALUE \
|
||||
"/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:."
|
||||
|
||||
/* 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:/etc:/usr/etc"
|
||||
|
||||
/* Define V9_ECHO if you want to give the echo builtin backslash-escape
|
||||
interpretation using the -e option, in the style of the Bell Labs 9th
|
||||
Edition version of echo. */
|
||||
#define V9_ECHO
|
||||
|
||||
/* Define DEFAULT_ECHO_TO_USG if you want the echo builtin to interpret
|
||||
the backslash-escape characters by default, like the System V echo.
|
||||
This requires that V9_ECHO be defined. */
|
||||
/* #define DEFAULT_ECHO_TO_USG */
|
||||
#if !defined (V9_ECHO)
|
||||
# undef DEFAULT_ECHO_TO_USG
|
||||
#endif
|
||||
|
||||
/* Define CONTINUE_AFTER_KILL_ERROR if you want the kill command to
|
||||
continue processing arguments after one of them fails. */
|
||||
#define CONTINUE_AFTER_KILL_ERROR
|
||||
|
||||
/* Define BREAK_COMPLAINS if you want the non-standard, but useful
|
||||
error messages about `break' and `continue' out of context. */
|
||||
#define BREAK_COMPLAINS
|
||||
|
||||
/* Define HELP_BUILTIN if you want the `help' shell builtin and the long
|
||||
documentation strings compiled into the shell. */
|
||||
#define HELP_BUILTIN
|
||||
|
||||
/* Define RESTRICTED_SHELL if you want the generated shell to have the
|
||||
ability to be a restricted one. The shell thus generated can become
|
||||
restricted by being run with the name "rbash", or by setting the -r
|
||||
flag. */
|
||||
#define RESTRICTED_SHELL
|
||||
|
||||
/* If the shell is called by this name, it will become restricted. */
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
#define RESTRICTED_SHELL_NAME "rbash"
|
||||
#endif
|
||||
|
||||
/* Define DISABLED_BUILTINS if you want "builtin foo" to always run the
|
||||
shell builtin "foo", even if it has been disabled with "enable -n foo". */
|
||||
/* #define DISABLED_BUILTINS */
|
||||
|
||||
/* Define PROCESS_SUBSTITUTION if you want the K*rn shell-like process
|
||||
substitution features "<(file)". */
|
||||
/* Right now, you cannot do this on machines without fully operational
|
||||
FIFO support. This currently include NeXT and Alliant. */
|
||||
#if !defined (MKFIFO_MISSING) || defined (HAVE_DEV_FD)
|
||||
# define PROCESS_SUBSTITUTION
|
||||
#endif /* !MKFIFO_MISSING */
|
||||
|
||||
/* Define PROMPT_STRING_DECODE if you want the backslash-escaped special
|
||||
characters in PS1 and PS2 expanded. Variable expansion will still be
|
||||
performed. */
|
||||
#define PROMPT_STRING_DECODE
|
||||
|
||||
/* Define BUFFERED_INPUT if you want the shell to do its own input
|
||||
buffering. */
|
||||
#define BUFFERED_INPUT
|
||||
|
||||
/* Define ONESHOT if you want sh -c 'command' to avoid forking to execute
|
||||
`command' whenever possible. */
|
||||
#define ONESHOT
|
||||
|
||||
/* Default primary and secondary prompt strings. */
|
||||
#define PPROMPT "\\s\\$ "
|
||||
#define SPROMPT "> "
|
||||
|
||||
/* Define SELECT_COMMAND if you want the Korn-shell style `select' command:
|
||||
select word in word_list; do command_list; done */
|
||||
#define SELECT_COMMAND
|
||||
|
||||
/* Define ARRAY_VARS if you want ksh-style one-dimensional array variables. */
|
||||
#define ARRAY_VARS
|
||||
|
||||
#endif /* !_CONFIG_H_ */
|
||||
@@ -1,191 +0,0 @@
|
||||
/* config.h -- Configuration file for bash. */
|
||||
|
||||
/* This is a `minimal' configuration file. It will create a shell without:
|
||||
job control
|
||||
aliases
|
||||
pushd and popd
|
||||
readline
|
||||
history
|
||||
restricted shell mode
|
||||
`disabled' builtins (builtin xxx finds xxx even after enable -n xxx)
|
||||
process substitution
|
||||
prompt string decoding (though variable expansion is still done)
|
||||
the `select' command
|
||||
the `help' builtin
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_CONFIG_H_)
|
||||
#define _CONFIG_H_
|
||||
|
||||
#include "memalloc.h"
|
||||
|
||||
#if defined (HPUX) || defined (UNIXPC) || defined (Xenix)
|
||||
# if !defined (USG)
|
||||
# define USG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H) && !defined (BUILDING_MAKEFILE)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Define JOB_CONTROL if your operating system supports
|
||||
BSD-like job control. */
|
||||
/* #define JOB_CONTROL */
|
||||
|
||||
/* Note that vanilla System V machines don't support BSD job control,
|
||||
although some do support Posix job control. */
|
||||
#if defined (USG) && !defined (_POSIX_JOB_CONTROL)
|
||||
# undef JOB_CONTROL
|
||||
#endif /* USG && !_POSIX_JOB_CONTROL */
|
||||
|
||||
/* Define ALIAS if you want the alias features. */
|
||||
/* #define ALIAS */
|
||||
|
||||
/* Define PUSHD_AND_POPD if you want those commands to be compiled in.
|
||||
(Also the `dirs' commands.) */
|
||||
/* #define PUSHD_AND_POPD */
|
||||
|
||||
/* Define BRACE_EXPANSION if you want curly brace expansion a la Csh:
|
||||
foo{a,b} -> fooa foob. Even if this is compiled in (the default) you
|
||||
can turn it off at shell startup with `-nobraceexpansion', or during
|
||||
shell execution with `set +o braceexpand'. */
|
||||
/* #define BRACE_EXPANSION */
|
||||
|
||||
/* Define READLINE to get the nifty/glitzy editing features.
|
||||
This is on by default. You can turn it off interactively
|
||||
with the -nolineediting flag. */
|
||||
/* #define READLINE */
|
||||
|
||||
/* Define BANG_HISTORY if you want to have Csh style "!" history expansion.
|
||||
This is unrelated to READLINE. */
|
||||
/* #define BANG_HISTORY */
|
||||
|
||||
/* Define HISTORY if you want to have access to previously typed commands.
|
||||
|
||||
If both HISTORY and READLINE are defined, you can get at the commands
|
||||
with line editing commands, and you can directly manipulate the history
|
||||
from the command line.
|
||||
|
||||
If only HISTORY is defined, the `fc' and `history' builtins are
|
||||
available. */
|
||||
/* #define HISTORY */
|
||||
|
||||
#if defined (BANG_HISTORY) && !defined (HISTORY)
|
||||
/* BANG_HISTORY requires HISTORY. */
|
||||
# define HISTORY
|
||||
#endif /* BANG_HISTORY && !HISTORY */
|
||||
|
||||
#if defined (READLINE) && !defined (HISTORY)
|
||||
# define HISTORY
|
||||
#endif
|
||||
|
||||
/* Define this if you want completion that puts all alternatives into
|
||||
a brace expansion shell expression. */
|
||||
#if defined (BRACE_EXPANSION) && defined (READLINE)
|
||||
# define BRACE_COMPLETION
|
||||
#endif /* BRACE_EXPANSION */
|
||||
|
||||
/* The default value of the PATH variable. */
|
||||
#define DEFAULT_PATH_VALUE \
|
||||
"/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:."
|
||||
|
||||
/* 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:/etc:/usr/etc"
|
||||
|
||||
/* The default directory in which to look for mail files when
|
||||
checking mail. The trailing slash is required. */
|
||||
#if defined (USG)
|
||||
# define DEFAULT_MAIL_PATH "/usr/mail/"
|
||||
#else
|
||||
# define DEFAULT_MAIL_PATH "/usr/spool/mail/"
|
||||
#endif
|
||||
|
||||
/* Define V9_ECHO if you want to give the echo builtin backslash-escape
|
||||
interpretation using the -e option, in the style of the Bell Labs 9th
|
||||
Edition version of echo. */
|
||||
#define V9_ECHO
|
||||
|
||||
/* Define DEFAULT_ECHO_TO_USG if you want the echo builtin to interpret
|
||||
the backslash-escape characters by default, like the System V echo.
|
||||
This requires that V9_ECHO be defined. */
|
||||
/* #define DEFAULT_ECHO_TO_USG */
|
||||
#if !defined (V9_ECHO)
|
||||
# undef DEFAULT_ECHO_TO_USG
|
||||
#endif
|
||||
|
||||
/* Define CONTINUE_AFTER_KILL_ERROR if you want the kill command to
|
||||
continue processing arguments after one of them fails. */
|
||||
#define CONTINUE_AFTER_KILL_ERROR
|
||||
|
||||
/* Define BREAK_COMPLAINS if you want the non-standard, but useful
|
||||
error messages about `break' and `continue' out of context. */
|
||||
#define BREAK_COMPLAINS
|
||||
|
||||
/* Define HELP_BUILTIN if you want the `help' shell builtin and the long
|
||||
documentation strings compiled into the shell. */
|
||||
/* #define HELP_BUILTIN */
|
||||
|
||||
/* Define RESTRICTED_SHELL if you want the generated shell to have the
|
||||
ability to be a restricted one. The shell thus generated can become
|
||||
restricted by being run with the name "rbash", or by setting the -r
|
||||
flag. */
|
||||
/* #define RESTRICTED_SHELL */
|
||||
|
||||
/* Define DISABLED_BUILTINS if you want "builtin foo" to always run the
|
||||
shell builtin "foo", even if it has been disabled with "enable -n foo". */
|
||||
/* #define DISABLED_BUILTINS */
|
||||
|
||||
/* Define PROCESS_SUBSTITUTION if you want the K*rn shell-like process
|
||||
substitution features "<(file)". */
|
||||
/* Right now, you cannot do this on machines without fully operational
|
||||
FIFO support. This currently include NeXT and Alliant. */
|
||||
#if !defined (MKFIFO_MISSING)
|
||||
# define PROCESS_SUBSTITUTION
|
||||
#endif /* !MKFIFO_MISSING */
|
||||
|
||||
/* Define PROMPT_STRING_DECODE if you want the backslash-escaped special
|
||||
characters in PS1 and PS2 expanded. Variable expansion will still be
|
||||
performed. */
|
||||
/* #define PROMPT_STRING_DECODE */
|
||||
|
||||
/* Define BUFFERED_INPUT if you want the shell to do its own input
|
||||
buffering. */
|
||||
#define BUFFERED_INPUT
|
||||
|
||||
/* Define ONESHOT if you want sh -c 'command' to avoid forking to execute
|
||||
`command' whenever possible. */
|
||||
#define ONESHOT
|
||||
|
||||
/* Default primary and secondary prompt strings. */
|
||||
#define PPROMPT "\\s\\$ "
|
||||
#define SPROMPT "> "
|
||||
|
||||
/* Define SELECT_COMMAND if you want the Korn-shell style `select' command:
|
||||
select word in word_list; do command_list; done */
|
||||
/* #define SELECT_COMMAND */
|
||||
|
||||
/* Define ARRAY if you want ksh-style one-dimensional arrays. */
|
||||
/* #define ARRAY_VARS */
|
||||
|
||||
#endif /* !_CONFIG_H_ */
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This shell script does nothing since Bash doesn't require
|
||||
# configuration to be forced on it; it auto-configures. You can
|
||||
# change the location of the source directory with +srcdir.
|
||||
#
|
||||
echo "Bash is configured to auto configure."
|
||||
exit 0
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
||||
# This awk script is called from within Makefile to strip multiple blank
|
||||
# lines from stdin.
|
||||
BEGIN { newlines = 0 }
|
||||
{
|
||||
if (NF == 0)
|
||||
newlines = 1;
|
||||
else
|
||||
{
|
||||
if (newlines)
|
||||
{
|
||||
printf "\n";
|
||||
newlines = 0;
|
||||
}
|
||||
print $0;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Return a full cpp specification, complete with system dependent flags.
|
||||
#
|
||||
# Syntax: cppmagic [ program-to-generate-flags [ guessed-cpp ]]
|
||||
#
|
||||
# If only one arg is present it is the name of a program to invoke
|
||||
# which should generate -Dfoo defines.
|
||||
#
|
||||
# If two args are present the second arg is the name of the C
|
||||
# preprocessor to use.
|
||||
#
|
||||
# Invoked with no args, provides a C preprocessor name and
|
||||
# -traditional flag if that is appropriate.
|
||||
#
|
||||
# ../Makefile calls this file thusly: "cppmagic getcppsyms".
|
||||
#
|
||||
# Typical output:
|
||||
#
|
||||
# /lib/cpp -Dunix -Dm68k
|
||||
#
|
||||
|
||||
Cpp=
|
||||
|
||||
if [ "$2" ]; then
|
||||
Cpp=$2
|
||||
else
|
||||
for cpp in /lib/cpp /usr/lib/cpp /usr/ccs/lib/cpp; do
|
||||
if [ -f $cpp ]; then
|
||||
Cpp=$cpp
|
||||
fi
|
||||
done
|
||||
if [ "$Cpp" = "" ]; then
|
||||
Cpp=cpp
|
||||
fi
|
||||
fi
|
||||
|
||||
TRADITIONAL=
|
||||
FLAGS=
|
||||
|
||||
# First flag might be `-traditional' if this is Gnu Cpp.
|
||||
unknown_flag=`$Cpp -traditional /dev/null 2>&1 |
|
||||
egrep 'known|recognized|valid|bad|legal'`
|
||||
if [ "$unknown_flag" = "" ]; then
|
||||
TRADITIONAL=-traditional
|
||||
fi
|
||||
|
||||
if [ "$1" ]; then
|
||||
FLAGS=`$1`
|
||||
fi
|
||||
|
||||
echo $Cpp $TRADITIONAL $FLAGS
|
||||
@@ -1,427 +0,0 @@
|
||||
/* getcppsyms.c - Find unique compiler symbols. */
|
||||
|
||||
/* Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Some cpp's do not define any symbols, but instead let /bin/cc do it
|
||||
for them. For such machines, running this file may prove useful. It
|
||||
outputs the list of symbols which /bin/cc or /lib/cpp define and which
|
||||
we had the foresight to guess at. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#if defined (__BSD_4_4__)
|
||||
printf ("-D__BSD_4_4__");
|
||||
#endif /* __BSD_4_4__ */
|
||||
#if defined (CMU)
|
||||
printf (" -DCMU");
|
||||
#endif /* CMU */
|
||||
#if defined (_COFF)
|
||||
printf (" -D_COFF");
|
||||
#endif /* _COFF */
|
||||
#if defined (DGUX)
|
||||
printf (" -DDGUX");
|
||||
#endif /* DGUX */
|
||||
#if defined (GOULD_PN)
|
||||
printf (" -DGOULD_PN");
|
||||
#endif /* GOULD_PN */
|
||||
#if defined (MACH)
|
||||
printf (" -DMACH");
|
||||
#endif /* MACH */
|
||||
#if defined (MIPSEB)
|
||||
printf (" -DMIPSEB");
|
||||
#endif /* MIPSEB */
|
||||
#if defined (MIPSEL)
|
||||
printf (" -DMIPSEL");
|
||||
#endif /* MIPSEL */
|
||||
#if defined (MULTIMAX)
|
||||
printf (" -DMULTIMAX");
|
||||
#endif /* MULTIMAX */
|
||||
#if defined (M_UNIX)
|
||||
printf (" -DM_UNIX");
|
||||
#endif /* M_UNIX */
|
||||
#if defined (M_XENIX)
|
||||
printf (" -DM_XENIX");
|
||||
#endif /* M_XENIX */
|
||||
#if defined (_M_XENIX)
|
||||
printf (" -D_M_XENIX");
|
||||
#endif /* _M_XENIX */
|
||||
#if defined (NeXT)
|
||||
printf (" -DNeXT");
|
||||
#endif /* NeXT */
|
||||
#if defined (__PARAGON__)
|
||||
printf (" -D__PARAGON__");
|
||||
#endif /* __PARAGON__ */
|
||||
#if defined (_PGC_)
|
||||
printf (" -D_PGC_");
|
||||
#endif /* _PGC_ */
|
||||
#if defined (__PGC__)
|
||||
printf (" -D__PGC__");
|
||||
#endif /* __PGC__ */
|
||||
#if defined (RES)
|
||||
printf (" -DRES");
|
||||
#endif /* RES */
|
||||
#if defined (RISC6000)
|
||||
printf (" -DRISC6000");
|
||||
#endif /* RISC6000 */
|
||||
#if defined (RT)
|
||||
printf (" -DRT");
|
||||
#endif /* RT */
|
||||
#if defined (SYSTYPE_BSD)
|
||||
printf (" -DSYSTYPE_BSD");
|
||||
#endif /* SYSTYPE_BSD */
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf (" -DSYSTYPE_SYSV");
|
||||
#endif /* SYSTYPE_SYSV */
|
||||
#if defined (Sun386i)
|
||||
printf (" -DSun386i");
|
||||
#endif /* Sun386i */
|
||||
#if defined (Tek4132)
|
||||
printf (" -DTek4132");
|
||||
#endif /* Tek4132 */
|
||||
#if defined (Tek4300)
|
||||
printf (" -DTek4300");
|
||||
#endif /* Tek4300 */
|
||||
#if defined (UMAXV)
|
||||
printf (" -DUMAXV");
|
||||
#endif /* UMAXV */
|
||||
#if defined (USGr4)
|
||||
printf (" -DUSGr4");
|
||||
#endif /* USGr4 */
|
||||
#if defined (USGr4_2)
|
||||
printf (" -DUSGr4_2");
|
||||
#endif /* USGr4_2 */
|
||||
#if defined (__SVR4_2__)
|
||||
printf (" -D__SVR4_2__");
|
||||
#endif /* __SVR4_2__ */
|
||||
#if defined (Xenix286)
|
||||
printf (" -DXenix286");
|
||||
#endif /* Xenix286 */
|
||||
#if defined (_AIX)
|
||||
printf (" -D_AIX");
|
||||
#endif /* _AIX */
|
||||
#if defined (_AIX370)
|
||||
printf (" -D_AIX370");
|
||||
#endif /* _AIX370 */
|
||||
#if defined (_IBMESA)
|
||||
printf (" -D_IBMESA");
|
||||
#endif /* _IBMESA */
|
||||
#if defined (__ibmesa)
|
||||
printf (" -D__ibmesa");
|
||||
#endif /* __ibmesa */
|
||||
#if defined (_U370)
|
||||
printf (" -D_U370");
|
||||
#endif /* _U370 */
|
||||
#if defined (_NLS)
|
||||
printf (" -D_NLS");
|
||||
#endif /* _NLS */
|
||||
#if defined (_CX_UX)
|
||||
printf (" -D_CX_UX");
|
||||
#endif /* _CX_UX */
|
||||
#if defined (_IBMR2)
|
||||
printf (" -D_IBMR2");
|
||||
#endif /* _IBMR2 */
|
||||
#if defined (_M88K)
|
||||
printf (" -D_M88K");
|
||||
#endif /* _M88K */
|
||||
#if defined (_M88KBCS_TARGET)
|
||||
printf (" -D_M88KBCS_TARGET");
|
||||
#endif /* _M88KBCS_TARGET */
|
||||
#if defined (__DGUX__)
|
||||
printf (" -D__DGUX__");
|
||||
#endif /* __DGUX__ */
|
||||
#if defined (__UMAXV__)
|
||||
printf (" -D__UMAXV__");
|
||||
#endif /* __UMAXV__ */
|
||||
#if defined (__m88k)
|
||||
printf (" -D__m88k");
|
||||
#endif /* __m88k */
|
||||
#if defined (__uxpm__)
|
||||
printf (" -DUSGr4 -Du370 -D__uxpm__");
|
||||
#endif /* __uxpm__ */
|
||||
#if defined (__uxps__)
|
||||
printf (" -D__svr4__ -D__uxps__");
|
||||
#endif /* __uxps__ */
|
||||
#if defined (alliant)
|
||||
printf (" -Dalliant");
|
||||
#endif /* alliant */
|
||||
#if defined (alpha)
|
||||
printf (" -Dalpha");
|
||||
#endif /* alpha */
|
||||
#if defined (__alpha)
|
||||
printf (" -D__alpha");
|
||||
#endif /* __alpha */
|
||||
#if defined (aix)
|
||||
printf (" -Daix");
|
||||
#endif /* aix */
|
||||
#if defined (aixpc)
|
||||
printf (" -Daixpc");
|
||||
#endif /* aixpc */
|
||||
#if defined (apollo)
|
||||
printf (" -Dapollo");
|
||||
#endif /* apollo */
|
||||
#if defined (ardent)
|
||||
printf (" -Dardent");
|
||||
#endif /* ardent */
|
||||
#if defined (att386)
|
||||
printf (" -Datt386");
|
||||
#endif /* att386 */
|
||||
#if defined (att3b)
|
||||
printf (" -Datt3b");
|
||||
#endif /* att3b */
|
||||
#if defined (bsd4_2)
|
||||
printf (" -Dbsd4_2");
|
||||
#endif /* bsd4_2 */
|
||||
#if defined (bsd4_3)
|
||||
printf (" -Dbsd4_3");
|
||||
#endif /* bsd4_3 */
|
||||
#if defined (__bsdi__)
|
||||
printf (" -D__bsdi__");
|
||||
#endif /* __bsdi__ */
|
||||
#if defined (bsdi)
|
||||
printf (" -Dbsdi");
|
||||
#endif /* bsdi */
|
||||
#if defined (__386BSD__)
|
||||
printf (" -D__386BSD__");
|
||||
#endif /* __386BSD__ */
|
||||
#if defined (cadmus)
|
||||
printf (" -Dcadmus");
|
||||
#endif /* cadmus */
|
||||
#if defined (clipper)
|
||||
printf (" -Dclipper");
|
||||
#endif /* clipper */
|
||||
#if defined (concurrent)
|
||||
printf (" -Dconcurrent");
|
||||
#endif /* concurrent */
|
||||
#if defined (convex) || defined (__convex__) || defined (__convexc__)
|
||||
# if !defined (__GNUC__)
|
||||
printf (" -pcc");
|
||||
# endif /* !__GNUC__ */
|
||||
printf (" -Dconvex");
|
||||
#endif /* convex */
|
||||
#if defined (dmert)
|
||||
printf (" -Ddmert");
|
||||
#endif /* dmert */
|
||||
#if defined (gcos)
|
||||
printf (" -Dgcos");
|
||||
#endif /* gcos */
|
||||
#if defined (gcx)
|
||||
printf (" -Dgcx");
|
||||
#endif /* gcx */
|
||||
#if defined (gould)
|
||||
printf (" -Dgould");
|
||||
#endif /* gould */
|
||||
#if defined (hbullx20)
|
||||
printf (" -Dhbullx20");
|
||||
#endif /* hbullx20 */
|
||||
#if defined (hcx)
|
||||
printf (" -Dhcx");
|
||||
#endif /* hcx */
|
||||
#if defined (host_mips)
|
||||
printf (" -Dhost_mips");
|
||||
#endif /* host_mips */
|
||||
#if defined (hp9000) || defined (__hp9000)
|
||||
printf (" -Dhp9000");
|
||||
#endif /* hp9000 || __hp9000 */
|
||||
#if defined (hp9000s200) || defined (__hp9000s200)
|
||||
printf (" -Dhp9000s200");
|
||||
#endif /* hp9000s200 || __hp9000s200 */
|
||||
#if defined (hp9000s300) || defined (__hp9000s300)
|
||||
printf (" -Dhp9000s300");
|
||||
#endif /* hp9000s300 || __hp9000s300 */
|
||||
#if defined (hp9000s500) || defined (__hp9000s500)
|
||||
printf (" -Dhp9000s500");
|
||||
#endif /* hp9000s500 || __hp9000s500 */
|
||||
#if defined (hp9000s700) || defined (__hp9000s700)
|
||||
printf (" -Dhp9000s700");
|
||||
#endif /* hp9000s700 || __hp9000s700 */
|
||||
#if defined (hp9000s800) || defined (__hp9000s800)
|
||||
printf (" -Dhp9000s800");
|
||||
#endif /* hp9000s800 || __hp9000s800 */
|
||||
#if defined (hppa) || defined (__hppa)
|
||||
printf (" -Dhppa");
|
||||
#endif /* hppa || __hppa */
|
||||
#if defined (hpux) || defined (__hpux)
|
||||
printf (" -Dhpux");
|
||||
#endif /* hpux */
|
||||
#if defined (__hp_osf)
|
||||
printf (" -D__hp_osf");
|
||||
#endif /* __hp_osf */
|
||||
#if defined (i386)
|
||||
printf (" -Di386");
|
||||
#endif /* i386 */
|
||||
#if defined (__i386__)
|
||||
printf (" -D__i386__");
|
||||
#endif
|
||||
#if defined (__i860)
|
||||
printf(" -D__i860");
|
||||
#endif /* __i860 */
|
||||
#if defined (__i860__)
|
||||
printf(" -D__i860__");
|
||||
#endif /* __i860__ */
|
||||
#if defined (ibm)
|
||||
printf (" -Dibm");
|
||||
#endif /* ibm */
|
||||
#if defined (ibm032)
|
||||
printf (" -Dibm032");
|
||||
#endif /* ibm032 */
|
||||
#if defined (ibmrt)
|
||||
printf (" -Dibmrt");
|
||||
#endif /* ibmrt */
|
||||
#if defined (interdata)
|
||||
printf (" -Dinterdata");
|
||||
#endif /* interdata */
|
||||
#if defined (is68k)
|
||||
printf (" -Dis68k");
|
||||
#endif /* is68k */
|
||||
#if defined (ksr1)
|
||||
printf (" -Dksr1");
|
||||
#endif /* ksr1 */
|
||||
#if defined (__ksr1__)
|
||||
printf (" -D__ksr1__");
|
||||
#endif /* __ksr1__ */
|
||||
#if defined (linux)
|
||||
printf (" -Dlinux");
|
||||
#endif /* linux */
|
||||
#if defined (__linux__)
|
||||
printf (" -D__linux__");
|
||||
#endif /* __linux__ */
|
||||
#if defined (luna88k)
|
||||
printf (" -Dluna88k");
|
||||
#endif /* luna88k */
|
||||
#if defined (m68k)
|
||||
printf (" -Dm68k");
|
||||
#endif /* m68k */
|
||||
#if defined (m88k)
|
||||
printf (" -Dm88k");
|
||||
#endif /* m88k */
|
||||
#if defined (mc68010)
|
||||
printf (" -Dmc68010");
|
||||
#endif /* mc68010 */
|
||||
#if defined (mc68020)
|
||||
printf (" -Dmc68020");
|
||||
#endif /* mc68020 */
|
||||
#if defined (mc68030)
|
||||
printf (" -Dmc68030");
|
||||
#endif /* mc68030 */
|
||||
#if defined (mc68040)
|
||||
printf (" -Dmc68040");
|
||||
#endif /* mc68040 */
|
||||
#if defined (mc68k32)
|
||||
printf (" -Dmc68k32");
|
||||
#endif /* mc68k32 */
|
||||
#if defined (mips)
|
||||
printf (" -Dmips");
|
||||
#endif /* mips */
|
||||
#if defined (n16)
|
||||
printf (" -Dn16");
|
||||
#endif /* n16 */
|
||||
#if defined (ns32000)
|
||||
printf (" -Dns32000");
|
||||
#endif /* ns32000 */
|
||||
#if defined (os)
|
||||
printf (" -Dos");
|
||||
#endif /* os */
|
||||
#if defined (osf)
|
||||
printf (" -Dosf");
|
||||
#endif /* osf */
|
||||
#if defined (__osf__)
|
||||
printf (" -D__osf__");
|
||||
#endif /* __osf__ */
|
||||
#if defined (__OSF1__)
|
||||
printf(" -D__OSF1__");
|
||||
#endif /* __OSF1__ */
|
||||
#if defined (pdp11)
|
||||
printf (" -Dpdp11");
|
||||
#endif /* pdp11 */
|
||||
#if defined (plexus)
|
||||
printf (" -Dplexus")
|
||||
#endif /* plexus */
|
||||
#if defined (pyr)
|
||||
printf (" -Dpyr");
|
||||
#endif /* pyr */
|
||||
#if defined (scs)
|
||||
printf (" -Dscs");
|
||||
#endif /* scs */
|
||||
#if defined (sequent)
|
||||
printf (" -Dsequent");
|
||||
#endif /* sequent */
|
||||
#if defined (sgi)
|
||||
printf (" -Dsgi");
|
||||
#endif /* sgi */
|
||||
#if defined (sony)
|
||||
printf (" -Dsony");
|
||||
#endif /* sony */
|
||||
#if defined (sparc)
|
||||
printf (" -Dsparc");
|
||||
#endif /* sparc */
|
||||
#if defined (stardent)
|
||||
printf (" -Dstardent");
|
||||
#endif /* stardent */
|
||||
#if defined (sun)
|
||||
printf (" -Dsun");
|
||||
#endif /* sun */
|
||||
#if defined (sun2)
|
||||
printf (" -Dsun2");
|
||||
#endif /* sun2 */
|
||||
#if defined (sun3)
|
||||
printf (" -Dsun3");
|
||||
#endif /* sun3 */
|
||||
#if defined (sun4)
|
||||
printf (" -Dsun4");
|
||||
#endif /* sun4 */
|
||||
#if defined (__svr4__)
|
||||
printf (" -D__svr4__");
|
||||
#endif /* __svr4__ */
|
||||
#if defined (tower32)
|
||||
printf (" -Dtower32");
|
||||
#endif /* tower32 */
|
||||
#if defined (tss)
|
||||
printf (" -Dtss");
|
||||
#endif /* tss */
|
||||
#if defined (u370)
|
||||
printf (" -Du370");
|
||||
#endif /* u370 */
|
||||
#if defined (u3b)
|
||||
printf (" -Du3b");
|
||||
#endif /* u3b */
|
||||
#if defined (u3b2)
|
||||
printf (" -Du3b2");
|
||||
#endif /* u3b2 */
|
||||
#if defined (u3b20d)
|
||||
printf (" -Du3b20d");
|
||||
#endif /* u3b20d */
|
||||
#if defined (u3b5)
|
||||
printf (" -Du3b5");
|
||||
#endif /* u3b5 */
|
||||
#if defined (ultrix)
|
||||
printf (" -Dultrix");
|
||||
#endif /* ultrix */
|
||||
#if defined (unix)
|
||||
printf (" -Dunix");
|
||||
#endif /* unix */
|
||||
#if defined (vax)
|
||||
printf (" -Dvax");
|
||||
#endif /* vax */
|
||||
|
||||
printf ("\n");
|
||||
exit (0);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Search $PATH for a file the same name as $1; return TRUE if found.
|
||||
#
|
||||
|
||||
command=$1
|
||||
[ -n "$command" ] || exit 1
|
||||
|
||||
set `echo $PATH | sed 's/^:/.:/
|
||||
s/::/:.:/g
|
||||
s/:$/:./
|
||||
s/:/ /g'`
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
[ -f $1/$command ] && exit 0 # test -x not universal
|
||||
shift
|
||||
done
|
||||
|
||||
exit 1
|
||||
@@ -1,282 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This script attempts to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:1.*:*)
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo alpha-dec-osf${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OSF1:V1.*:*)
|
||||
# 1.3 uses "V1.3" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
sun4*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
echo sparc-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:5*:RISCos)
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
*:IRIX:*:*)
|
||||
echo mips-sgi-irix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i[34]86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
echo rs6000-ibm-aix3.2
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/31?:HP-UX:*:*)
|
||||
echo m68000-hp-hpux
|
||||
exit 0 ;;
|
||||
9000/[34]??:HP-UX:*:*)
|
||||
echo m68k-hp-hpux
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* )
|
||||
echo hppa1.1-hp-hpux
|
||||
exit 0 ;;
|
||||
9000/8??:HP-UX:*:*)
|
||||
echo hppa1.0-hp-hpux
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:*)
|
||||
echo c2-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:UNICOS:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:UNICOS:*:*)
|
||||
echo ymp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY-2:UNICOS:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i[34]86:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd{$UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i[34]86:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux
|
||||
exit 0 ;;
|
||||
i[34]86:UNIX_SV:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i[34]86:*:3.2:*)
|
||||
if /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-sysv3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M680[234]0:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:*)
|
||||
uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m680[234]0:LynxOS:2.2*:*)
|
||||
echo m68k-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i[34]86:LynxOS:2.2*:*)
|
||||
echo i386-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.2*:*)
|
||||
echo sparc-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
main()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
#else
|
||||
printf("m68k-sony-newsos\n"); exit(0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined(hp300) && !defined(hpux)
|
||||
printf("m68k-hp-bsd\n"); exit(0);
|
||||
#endif
|
||||
|
||||
#if defined(NeXT)
|
||||
printf("m68k-next-bsd\n"); exit(0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf("ns32k-encore-sysv\n"); exit(0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf("ns32k-encore-mach\n"); exit(0);
|
||||
#else
|
||||
printf("ns32k-encore-bsd\n"); exit(0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__))
|
||||
printf("i386-unknown-bsd\n"); exit(0);
|
||||
#endif
|
||||
|
||||
#if defined(sequent)
|
||||
#if defined(i386)
|
||||
printf("i386-sequent-dynix\n"); exit(0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf("ns32k-sequent-dynix\n"); exit(0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_SEQUENT_)
|
||||
printf("i386-sequent-ptx\n"); exit(0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
||||
@@ -1,489 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This file creates a file called "sysdefs.h" which contains CPP defines
|
||||
# helping to describe the operating system features. We just take guesses
|
||||
# by looking at random files.
|
||||
|
||||
# Removes any inherited definitions.
|
||||
SYSDEF=
|
||||
MAKE_ANSI=
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-s) shift; srcdir=$1; shift ;;
|
||||
-i) shift; incdir="$1"; shift ;;
|
||||
-A) shift; MAKE_ANSI=true ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
sysdefs=${1-./sysdefs.h}
|
||||
: ${srcdir=.}
|
||||
|
||||
rm -f $sysdefs
|
||||
|
||||
echo "/* sysdefs.h -- #defines for your system created by $0." >>$sysdefs
|
||||
echo " Do NOT EDIT this file, since any changes will disappear." >>$sysdefs
|
||||
echo " Instead, edit $0, or config.h, or machines.h. */" >>$sysdefs
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (_SYSDEFS_H_)" >>$sysdefs
|
||||
echo "# define _SYSDEFS_H_" >>$sysdefs
|
||||
|
||||
# was if [ -f /usr/bin/uname ] || [ -f /bin/uname ]
|
||||
if ( uname >/dev/null 2>&1 ) 2>/dev/null
|
||||
then
|
||||
UNAME=`uname` # SunOS
|
||||
UNAME_R=`uname -r 2>/dev/null` # 4.1.2
|
||||
UNAME_M=`uname -m 2>/dev/null` # sun4m
|
||||
UNAME_V=`uname -v 2>/dev/null` # 13
|
||||
UNAME_S=`uname -s 2>/dev/null` # SunOS
|
||||
RELEASE=`expr "$UNAME_R" : '[^0-9]*\([0-9]*\)'` # 4
|
||||
case "$RELEASE" in
|
||||
"") RELEASE=0 ;;
|
||||
*) RELEASE=`expr "$RELEASE" + 0` ;;
|
||||
esac
|
||||
LEVEL=`expr "$UNAME_R" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
|
||||
SUBLEVEL=`expr "$UNAME_R" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
|
||||
fi
|
||||
|
||||
# check for versions of SunOS and BSD/OS
|
||||
case "${UNAME}${RELEASE}" in
|
||||
SunOS4*) SYSDEF=SunOS4 ;;
|
||||
SunOS5*) SYSDEF=SunOS5 ;;
|
||||
BSD/OS2*) SYSDEF=BSDI2 ;;
|
||||
esac
|
||||
|
||||
# Test for NeXT
|
||||
if [ -d /NextLibrary ]; then
|
||||
MAKE_ANSI=true
|
||||
fi
|
||||
|
||||
# Intel Paragon
|
||||
case "$UNAME_M" in
|
||||
paragon) MAKE_ANSI=true ;;
|
||||
esac
|
||||
|
||||
# Test for shared libraries (this is pretty sVr4ish).
|
||||
if [ -f /usr/ccs/lib/libc.so ]; then
|
||||
SYSDEF=USGr4
|
||||
fi
|
||||
|
||||
# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
|
||||
# is contrary to all other versions of uname
|
||||
if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
|
||||
UNAME=UNIX_SV
|
||||
fi
|
||||
|
||||
# another check for SVR4 on 386 or 486 machines
|
||||
case "${UNAME_M}:${UNAME}:${UNAME_R}" in
|
||||
i[34]86:UNIX_SV:4.*) SYSDEF=USGr4 ;;
|
||||
esac
|
||||
|
||||
# A check for Mips RISCos
|
||||
case "$UNAME_V" in
|
||||
UMIPS|RISCos) SYSDEF=RISCos_${RELEASE}_${LEVEL} ;;
|
||||
esac
|
||||
|
||||
# A check for Amdahl UTS
|
||||
case "$UNAME" in
|
||||
uts) SYSDEF=UTS ;;
|
||||
esac
|
||||
|
||||
# Look for an error message when trying to exec bison. If we find
|
||||
# what we're looking for, then we don't have it. If we get something
|
||||
# else (like an error message about no grammar file), then we have
|
||||
# it.
|
||||
YACC=yacc
|
||||
if ( cd /tmp ; bison /dev/null 2>&1 >/dev/null | grep 'no input grammar' >/dev/null 2>&1 ) 2>/dev/null; then
|
||||
YACC="bison -y"
|
||||
elif ( cd /tmp ; byacc /dev/null 2>&1 >/dev/null | grep 'unexpected ' >/dev/null 2>&1) 2>/dev/null; then
|
||||
YACC=byacc
|
||||
fi
|
||||
|
||||
# Try to locate ranlib. I think this is a bad idea.
|
||||
if sh ${srcdir}/support/inpath ranlib; then
|
||||
RANLIB_LOCATION=ranlib
|
||||
elif [ -f /usr/bin/ranlib ]; then
|
||||
RANLIB_LOCATION=/usr/bin/ranlib;
|
||||
elif [ -f /bin/ranlib ]; then
|
||||
RANLIB_LOCATION=/bin/ranlib;
|
||||
elif [ -f /usr/local/bin/ranlib ]; then
|
||||
RANLIB_LOCATION=/usr/local/bin/ranlib;
|
||||
elif [ -f /usr/gnu/bin/ranlib ]; then
|
||||
RANLIB_LOCATION=/usr/gnu/bin/ranlib
|
||||
elif [ -f /usr/local/gnubin/ranlib ]; then
|
||||
RANLIB_LOCATION=/usr/local/gnubin/ranlib;
|
||||
else
|
||||
RANLIB_LOCATION=: # XXX
|
||||
fi
|
||||
|
||||
if [ -n "${RANLIB_LOCATION}" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (RANLIB_LOCATION)" >>$sysdefs
|
||||
echo "# define RANLIB_LOCATION ${RANLIB_LOCATION}" >>$sysdefs
|
||||
echo "#endif /* RANLIB_LOCATION */" >>$sysdefs
|
||||
fi
|
||||
|
||||
#
|
||||
# Is this a Xenix system?
|
||||
#
|
||||
if [ -f /xenix ]; then
|
||||
SYSDEF="Xenix"
|
||||
case "`/bin/uname -p`" in
|
||||
*286) SYSDEF="Xenix286" ;;
|
||||
*386) SYSDEF="Xenix386" ;;
|
||||
esac
|
||||
|
||||
# make sure that `i386' is defined for machines.h
|
||||
if [ "$SYSDEF" = "Xenix386" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (i386)" >>$sysdefs
|
||||
echo "# define i386" >>$sysdefs
|
||||
echo "#endif /* !i386 */" >>$sysdefs
|
||||
fi
|
||||
|
||||
# Pass the release number of the OS through to the machine descriptions
|
||||
# in machines.h.
|
||||
if [ -f /etc/perms/soft ]; then
|
||||
rel=`grep rel= /etc/perms/soft`
|
||||
case "$rel" in
|
||||
*2.2.*) XREL=XENIX_22 ;;
|
||||
*2.3.*) XREL=XENIX_23 ;;
|
||||
*3.2.*) XREL=XENIX_32 ;;
|
||||
*) XREL= ;;
|
||||
esac
|
||||
|
||||
if [ "$XREL" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined ($XREL)" >>$sysdefs
|
||||
echo "# define $XREL" >>$sysdefs
|
||||
echo "#endif /* !$XREL */" >>$sysdefs
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Is this some kind of Sys Vish system?
|
||||
#
|
||||
if [ -f /unix ]; then
|
||||
if [ -d /generic ]; then # This is an AIX system.
|
||||
SYSDEF="aixpc"
|
||||
MAKE_ANSI=true
|
||||
elif [ -d /etc/conf/kconfig.d ] && [ -f /usr/include/sys/limits.h ]; then
|
||||
SYSDEF="isc386" # This is a 386 running ISC?
|
||||
ISCREL="ISC_$RELEASE"
|
||||
echo "#if !defined ($ISCREL)" >>$sysdefs
|
||||
echo "# define $ISCREL" >>$sysdefs
|
||||
echo "#endif /* $ISCREL */" >>$sysdefs
|
||||
elif [ -f /etc/xlc.cfg ]; then
|
||||
if fgrep _IBMR2 /etc/xlc.cfg >/dev/null 2>&1; then
|
||||
SYSDEF=RISC6000
|
||||
MAKE_ANSI=true
|
||||
fi
|
||||
elif [ -f /bin/4d -a -f /bin/uname ]; then
|
||||
case "$UNAME_R" in
|
||||
3.*) SYSDEF="Irix3" ;;
|
||||
4.*) SYSDEF="Irix4" ;;
|
||||
5.*) SYSDEF="Irix5" ;;
|
||||
6.*) SYSDEF="Irix6" ;;
|
||||
*) SYSDEF="Irix3" ;;
|
||||
esac
|
||||
elif [ -d /usr/amiga ]; then
|
||||
SYSDEF="amiga" # An Amiga running V.4.
|
||||
elif [ -f /bin/fxc.info ]; then
|
||||
SYSDEF="alliant"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Is this a Unicos system?
|
||||
if [ -f /unicos ]; then
|
||||
MAKE_ANSI=true
|
||||
UnicosMachine=
|
||||
|
||||
# Test for the variaous flavors of Cray machines.
|
||||
if [ -x /bin/cray1 ] && /bin/cray1 2>/dev/null; then
|
||||
UnicosMachine=Cray1
|
||||
fi
|
||||
|
||||
if [ -x /bin/cray2 ] && /bin/cray2 2>/dev/null; then
|
||||
UnicosMachine=Cray2
|
||||
fi
|
||||
|
||||
if [ -x /bin/crayxmp ] && /bin/crayxmp 2>/dev/null; then
|
||||
UnicosMachine=CrayXMP
|
||||
fi
|
||||
if [ -x /bin/crayymp ] && /bin/crayymp 2>/dev/null; then
|
||||
UnicosMachine=CrayYMP
|
||||
fi
|
||||
|
||||
if [ "$UnicosMachine" ]; then
|
||||
echo "#if !defined ($UnicosMachine)" >>$sysdefs
|
||||
echo "# define $UnicosMachine" >>$sysdefs
|
||||
echo "#endif /* !$UnicosMachine */" >>$sysdefs
|
||||
fi
|
||||
fi
|
||||
|
||||
# Is this (and what kind of) a HPUX system?
|
||||
if [ -f /hp-ux ]; then
|
||||
SYSDEF=HPUX_${RELEASE}
|
||||
if [ "$RELEASE" = 6 -a "$LEVEL" -lt 2 ]; then
|
||||
SYSDEF=HPUX_USG
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SYSDEF" = "" ]; then
|
||||
case "$UNAME_M" in
|
||||
ESA) SYSDEF=AIXESA ;;
|
||||
XD88*) SYSDEF=XD88 ;;
|
||||
M88100) SYSDEF=M88100 ;; # Motorola Delta 88K
|
||||
esac
|
||||
fi
|
||||
|
||||
# What release of SCO Unix is this?
|
||||
if [ "$SYSDEF" = "" -a -f /bin/uname ]; then
|
||||
case `/bin/uname -X 2>/dev/null | grep '^Release' 2>/dev/null` in
|
||||
*3.2v4.*) SYSDEF=SCOv4 ;;
|
||||
*) SYSDEF=SCO ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#
|
||||
# Default to cadmus for unknown SysVish systems
|
||||
#
|
||||
if [ -f /unix ] && [ "$SYSDEF" = "" ]; then
|
||||
SYSDEF="cadmus"
|
||||
fi
|
||||
|
||||
if [ "$SYSDEF" != "" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined ($SYSDEF)" >>$sysdefs
|
||||
echo "# define $SYSDEF" >>$sysdefs
|
||||
echo "#endif /* $SYSDEF */" >>$sysdefs
|
||||
fi
|
||||
|
||||
# Now look for certain include files in a list of directories
|
||||
# Poor substitute for autoconf
|
||||
|
||||
# Add any other directories where include files are found to this list or
|
||||
# create another case
|
||||
if [ -n "$incdir" ]; then
|
||||
dirlist="$incdir"
|
||||
else
|
||||
case "$SYSDEF" in
|
||||
RISCos*) dirlist="/bsd43/usr/include";;
|
||||
*) dirlist="/usr/include /usr/include/bsd /usr/include/ansi" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code fragment to be executed to find a particular include file. Make sure
|
||||
# to set `file' to the pathname of the file you want, relative to /usr/include,
|
||||
# before calling `eval $findf'.
|
||||
findf="
|
||||
found='';
|
||||
for d in \$dirlist;
|
||||
do
|
||||
if test -f \$d/\$file;
|
||||
then
|
||||
found=yes;
|
||||
break;
|
||||
fi;
|
||||
done
|
||||
"
|
||||
|
||||
file=sys/stream.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_SYS_STREAM_H)" >>$sysdefs
|
||||
echo "# define HAVE_SYS_STREAM_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_SYS_STREAM_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=sys/ptem.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_SYS_PTEM_H)" >>$sysdefs
|
||||
echo "# define HAVE_SYS_PTEM_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_SYS_PTEM_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=sys/pte.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_SYS_PTE_H)" >>$sysdefs
|
||||
echo "# define HAVE_SYS_PTE_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_SYS_PTE_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=sys/wait.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_SYS_WAIT_H)" >>$sysdefs
|
||||
echo "# define HAVE_SYS_WAIT_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_SYS_WAIT_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=sys/resource.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_RESOURCE)" >>$sysdefs
|
||||
echo "# define HAVE_RESOURCE" >>$sysdefs
|
||||
echo "#endif /* HAVE_RESOURCE */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=sys/param.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_SYS_PARAM_H)" >>$sysdefs
|
||||
echo "# define HAVE_SYS_PARAM_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_SYS_PARAM_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=unistd.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_UNISTD_H)" >>$sysdefs
|
||||
echo "# define HAVE_UNISTD_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_UNISTD_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=stdlib.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_STDLIB_H)" >>$sysdefs
|
||||
echo "# define HAVE_STDLIB_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_STDLIB_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=limits.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_LIMITS_H)" >>$sysdefs
|
||||
echo "# define HAVE_LIMITS_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_LIMITS_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=locale.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_LOCALE_H)" >>$sysdefs
|
||||
echo "# define HAVE_LOCALE_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_LOCALE_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=alloca.h
|
||||
eval $findf
|
||||
if [ -f /usr/include/alloca.h ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_ALLOCA_H)" >>$sysdefs
|
||||
echo "# define HAVE_ALLOCA_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_ALLOCA_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=dirent.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_DIRENT_H)" >>$sysdefs
|
||||
echo "# define HAVE_DIRENT_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_DIRENT_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=string.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_STRING_H)" >>$sysdefs
|
||||
echo "# define HAVE_STRING_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_STRING_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
file=varargs.h
|
||||
eval $findf
|
||||
if [ -n "$found" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_VARARGS_H)" >>$sysdefs
|
||||
echo "# define HAVE_VARARGS_H" >>$sysdefs
|
||||
echo "#endif /* HAVE_VARARGS_H */" >>$sysdefs
|
||||
fi
|
||||
|
||||
# Does the system have a /dev/fd directory?
|
||||
if [ -d /dev/fd ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (HAVE_DEV_FD)" >>$sysdefs
|
||||
echo "# define HAVE_DEV_FD" >>$sysdefs
|
||||
echo "#endif /* HAVE_DEV_FD */" >>$sysdefs
|
||||
fi
|
||||
|
||||
# Is this SVR4.2? It's subtly different from USGr4
|
||||
if [ "$UNAME" = "UNIX_SV" ] && [ "$UNAME_R" = "4.2" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (USGr4_2)" >>$sysdefs
|
||||
echo "# define USGr4_2" >>$sysdefs
|
||||
echo "#endif /* USGr4_2 */" >>$sysdefs
|
||||
fi
|
||||
|
||||
# Is this AIX PS/2 1.3? Yuck.
|
||||
if [ "$UNAME" = "AIX" ] && [ "$UNAME_V" = "1" ] && [ "$RELEASE" = "3" ]; then
|
||||
case "$UNAME_M" in
|
||||
i386|i486)
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (AIX_13)" >>$sysdefs
|
||||
echo "# define AIX_13" >>$sysdefs
|
||||
echo "#endif /* AIX_13 */" >>$sysdefs
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$YACC" ]; then
|
||||
echo "" >>$sysdefs
|
||||
echo "#if !defined (YACC_PROG)" >>$sysdefs
|
||||
echo "# define YACC_PROG $YACC" >>$sysdefs
|
||||
echo "#endif /* YACC_PROG */" >>$sysdefs
|
||||
fi
|
||||
|
||||
# Functions to test for a la autoconf
|
||||
# getwd
|
||||
# getcwd
|
||||
# strchr
|
||||
# strcasecmp
|
||||
# getgroups
|
||||
# setlinebuf
|
||||
# strerror
|
||||
# vfprintf
|
||||
# bcopy
|
||||
# getdtablesize
|
||||
# setdtablesize
|
||||
# alloca
|
||||
# gethostname
|
||||
# memmove (missing)
|
||||
# mkfifo (missing)
|
||||
#
|
||||
# Other things to test
|
||||
# opendir robustness
|
||||
# dup2 working
|
||||
# void sighandler
|
||||
# sys_siglist[]
|
||||
# uid_t, gid_t
|
||||
# have_getpw_decls
|
||||
# reversed setvbuf args
|
||||
# int getgroups
|
||||
|
||||
# If this system's cpp might not like `/**/#' in cpp-Makefile, make an
|
||||
# alternate ansi-style cpp-Makefile.
|
||||
if [ -n "$MAKE_ANSI" ]; then
|
||||
grep -v '/\*\*/' ${srcdir}/cpp-Makefile >ansi-Makefile
|
||||
fi
|
||||
|
||||
# These should be the last 2 lines in this file!
|
||||
echo "" >>$sysdefs
|
||||
echo "#endif /* _SYSDEFS_H_ */" >>$sysdefs
|
||||
@@ -1,13 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# srcdir - print out the absolute pathname of the top of the bash source
|
||||
# tree. Used for getting the right value to makes in subdirectories
|
||||
#
|
||||
|
||||
case "$1" in
|
||||
'.'|./) pwd ;;
|
||||
./*|..*) echo `pwd`/"$1" ;;
|
||||
*) echo "$1" ;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,136 +0,0 @@
|
||||
|
||||
This is a description of the changes made to bash for increased ksh
|
||||
compatibility.
|
||||
|
||||
1. $SECONDS
|
||||
|
||||
"Each time this parameter is referenced, the number of seconds
|
||||
since shell invocation is returned. If this parameter is assigned
|
||||
a value, then the value returned will be the value that was
|
||||
assigned plus the number of seconds since the assignment."
|
||||
|
||||
Files changed: variables.c
|
||||
variables.h
|
||||
subst.c
|
||||
general.c
|
||||
shell.c
|
||||
general.h
|
||||
|
||||
2. $TMOUT
|
||||
|
||||
"If set to a value greater than 0, the shell will terminate if a
|
||||
command is not entered within the prescribed number of seconds
|
||||
after issuing the PS1 prompt."
|
||||
|
||||
Files changed: shell.c (the implementation is not perfect)
|
||||
|
||||
3. $RANDOM
|
||||
|
||||
"Each time this parameter is referenced, a random integer is
|
||||
generated. The sequence of random numbers can be initialized
|
||||
by assigning a numeric value to RANDOM."
|
||||
|
||||
Files changed: subst.c
|
||||
variables.c
|
||||
|
||||
4. $REPLY
|
||||
|
||||
"This parameter is set by the `read' special command when no
|
||||
arguments are supplied."
|
||||
|
||||
Files changed: builtins.c
|
||||
|
||||
5. integer variables
|
||||
|
||||
`declare -i' (also export) makes a variable an integer (turns on
|
||||
the integer attribute). When assignment is made to a variable with
|
||||
the -i attribute, arithmetic expression evaluation is done on the
|
||||
value before it is assigned to the variable.
|
||||
|
||||
Files changed: variables.h
|
||||
variables.c
|
||||
builtins.c
|
||||
|
||||
6. Arithmetic expression evaluation.
|
||||
|
||||
Here is the comment at the beginning of the new file `expr.c':
|
||||
|
||||
|
||||
ksh-style expression evaluation.
|
||||
|
||||
All arithmetic is done as long integers with no checking for overflow
|
||||
(though division by 0 is caught and flagged as an error).
|
||||
|
||||
The following operators are handled, grouped into a set of levels in
|
||||
order of decreasing precedence.
|
||||
|
||||
"-" [level 0 (unary negation)]
|
||||
"!" [level 1]
|
||||
"*", "/", "%" [level 2]
|
||||
"+", "-" [level 3]
|
||||
"<=", ">=", "<", ">" [level 4]
|
||||
"==", "!=" [level 5]
|
||||
"=" [level 6 (assignment)]
|
||||
|
||||
(Note that most of these operators have special meaning to bash, and an
|
||||
entire expression should be quoted, e.g. "a=$a+1" or "a=a+1" to ensure
|
||||
that it is passed intact to the evaluator).
|
||||
|
||||
Sub-expressions within parentheses have a precedence level greater than
|
||||
all of the above levels and are evaluated first. Within a single prece-
|
||||
dence group, evaluation is left-to-right, except for the arithmetic
|
||||
assignment operator (`='), which is evaluated right-to-left (as in C).
|
||||
|
||||
The expression evaluator returns the value of the expression (assignment
|
||||
statements have as a value what is returned by the RHS). The `let'
|
||||
builtin, on the other hand, returns 0 if the last expression evaluates to
|
||||
a non-zero, and 1 otherwise.
|
||||
|
||||
Implementation is a recursive-descent parser.
|
||||
|
||||
Files added: expr.c
|
||||
|
||||
7. `let' builtin
|
||||
|
||||
Parameters may be assigned numeric values via the `let' builtin.
|
||||
Each of its arguments is an expression to be evaluated. `let'
|
||||
returns 0 if the value of the last expression is non-zero, and
|
||||
1 otherwise.
|
||||
|
||||
Note that the "((...))" form of this command has not yet been
|
||||
implemented; it requires changes to the parsing functions.
|
||||
|
||||
Files changed: builtins.c
|
||||
|
||||
8. $_
|
||||
|
||||
$_ is set to the last argument of the previous command line, after
|
||||
expansion. It is still used as before when checking for mail.
|
||||
Two new keybindings have been added to insert this into the current
|
||||
command line (M-_ and M-.).
|
||||
|
||||
Files changed: mailcheck.c
|
||||
execute_cmd.c
|
||||
bashline.c
|
||||
|
||||
9. `cd -'
|
||||
|
||||
Equivalent to 'cd $OLDPWD'
|
||||
|
||||
Files changed: builtins.c
|
||||
|
||||
10. "ulimit -a"
|
||||
|
||||
"List all of the current resource limits (BSD only)."
|
||||
|
||||
Files changed: builtins.c
|
||||
|
||||
11. ${#@} and ${#*}
|
||||
|
||||
These expand to the number of positional parameters.
|
||||
|
||||
Files changed: subst.c
|
||||
|
||||
Chet Ramey
|
||||
Information Network Services, Case Western Reserve University
|
||||
chet@ins.CWRU.Edu
|
||||
@@ -1,140 +0,0 @@
|
||||
This file details the changes between the previous release of CWRU bash
|
||||
(07/11/93) and this release.
|
||||
|
||||
1. Bugs Fixed
|
||||
|
||||
Readline's vi-mode once again has TAB bound to completion; entering `posix
|
||||
mode' changes it to self-insert
|
||||
|
||||
Bash now binds its special emacs-mode functions directly into
|
||||
emacs_meta_keymap so that eight-bit character handling does not interfere
|
||||
|
||||
Some source restructuring: more extern functions are defined in header files
|
||||
and not in C source files
|
||||
|
||||
The handling of `line number' inside functions is now more correct and
|
||||
closer to reality
|
||||
|
||||
Some functions of `general use' were moved to general.c (vfree,
|
||||
full_pathname)
|
||||
|
||||
A bug that caused some redirections to be applied twice was fixed in
|
||||
execute_command_internal (dispose of redirection_undo_list after copying it;
|
||||
ditto for exec_redirection_undo_list)
|
||||
|
||||
The exit status of a command that is not found is 126, as Posix.2 specifies
|
||||
|
||||
More speed improvements -- bash now runs as fast as the SunOS sh on
|
||||
Haertel's `shell benchmark'
|
||||
|
||||
Instead of returning pointers to -1, bash and the readline, history, and
|
||||
glob libraries now return pointers to special `error pointers', which the
|
||||
calling code checks for in place of -1
|
||||
|
||||
Fixed a problem with canonicalize_pathname which made it get
|
||||
confused with xxx/./yyy if yyy was `.' or `..'
|
||||
|
||||
Fixes to make bash recognize SVR4.2 and set USGr4_2 for SVR4.2 systems
|
||||
|
||||
Fixes to the HP/UX machine descriptions to make alloca work on HPUX_9
|
||||
and to avoid `M_MACHINE redefined' warnings
|
||||
|
||||
Fixes to the CRAY machine description
|
||||
|
||||
Fixes to the mailpath code to make it Posix.2-compliant -- backslash
|
||||
may now quote `%' and `?'
|
||||
|
||||
The namespace was further cleaned up, and more functions and variables
|
||||
were made static
|
||||
|
||||
On systems with S_IFSOCK or S_ISSOCK defined in sys/stat.h, bash checks
|
||||
whether fd 0 is a socket to decide whether or not it's being started by
|
||||
rshd and to run the startup files
|
||||
|
||||
Bash now gives the signal mask it inherits to its children -- previously,
|
||||
login shells cleared the signal mask
|
||||
|
||||
cpp-Makefile and subst.c both used the `USE_GLOB_LIBRARY' define, but
|
||||
with different meanings; subst.c now uses `USE_POSIX_GLOB_LIBRARY'
|
||||
|
||||
Fixed pattern substitution so that ${a%%$b}, where b was unset, no longer
|
||||
causes a core dump
|
||||
|
||||
Changed the `test_exit' define in test.c to no longer use `longjmp' as
|
||||
the rhs or a comma-ized expression; this causes core dumps on some
|
||||
optimizer/machine combinations
|
||||
|
||||
A speed hack in variables.c: if no local variables are defined for a level
|
||||
of shell context, kill_all_local_variables does not need to search the
|
||||
whole variable hash table when popping a context
|
||||
|
||||
Fixed the `bind' builtin so that -m now changes the keymap for all of the
|
||||
subsequent operations
|
||||
|
||||
Changed some more builtins to use internal_getopt: bind, command, export,
|
||||
readonly, declare, typeset
|
||||
|
||||
Fixed fc to use the Posix.2 format for listing commands in the
|
||||
history list
|
||||
|
||||
Changed bg to set `!', as Posix.2 specifies
|
||||
|
||||
Fixed ulimit.def to compile if RLIMIT_RSS is not defined,
|
||||
as some systems seem to have it
|
||||
|
||||
Replaced lib/malloc/alloca.c with the version from emacs 19. The old one
|
||||
lives in alloca.c.old
|
||||
|
||||
malloc.c now uses the ANSI C features to `stringize' macro arguments if
|
||||
__STDC__ is defined
|
||||
|
||||
Fixes to the GNU malloc library from glibc 1.06 and Mike Haertel
|
||||
|
||||
Fixes to readline key binding and lookup for Cray systems, which don't
|
||||
like the casting that readline does
|
||||
|
||||
Fixes to all readline library source files to clean up the code: make sure
|
||||
`int'-returning functions use `return x;' rather than `return;', declare all
|
||||
arguments, even the `int' ones, and make some functions void. Cleaned up
|
||||
the code formatting a little, too.
|
||||
|
||||
The readline completer now double-quotes filenames with special word-break
|
||||
characters, so that tilde expansion still works
|
||||
|
||||
^C now breaks out of keyboard macros
|
||||
|
||||
If being compiled as part of the shell, readline no longer attempts to
|
||||
handle SIGTTIN, SIGTTOU, or SIGTSTP
|
||||
|
||||
tilde_expansion_failure_hook is now a CPFunction rather than a Function,
|
||||
since that's how it's used
|
||||
|
||||
Readline vi-mode `change case' function now skips over characters which
|
||||
are neither upper nor lower case
|
||||
|
||||
Readline vi-mode now allows replacement to be redoable with `.'
|
||||
|
||||
2. New Features
|
||||
|
||||
A `strict Posix.2' mode, enabled with the -posix startup option or
|
||||
setting the POSIXLY_CORRECT variable (see CWRU/POSIX.NOTES for a
|
||||
description of the changed behavior)
|
||||
|
||||
`ONESHOT' is now an option in config.h
|
||||
|
||||
cpp-Makefile assumes that fixed header files are present if gcc is being
|
||||
used
|
||||
|
||||
The redirections attached to a function declaration are now part of that
|
||||
function, applied when the function is executed, as specified by Posix.2.
|
||||
This caused a change to parse.y that resulted in 66 shift/reduce
|
||||
conflicts(!)
|
||||
|
||||
All of the OP= functions that Posix.2 specifies are now implemented for
|
||||
both `let' and arithmetic substitution
|
||||
|
||||
The `command' builtin has acquired the Posix.2 `-v' and `-V' options
|
||||
(this shares code with the `type' builtin)
|
||||
|
||||
A new `bash_builtins' man page, like the `csh_builtins' page on some
|
||||
systems
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
This is a description of the changes made to bash to provide a `restricted'
|
||||
shell, `rbash', organized by changes to various source files.
|
||||
|
||||
1. shell.c
|
||||
|
||||
Moved the declaration of restricted to flags.c; it is now declared
|
||||
extern here. Changed the detection of a restricted shell; now, any
|
||||
instance of the shell for which *(basename(argv[0])) == 'r' (where
|
||||
basename returns either everything after the last '/' in its
|
||||
argument or its argument is restricted. Also, if SHELL is set on
|
||||
entry to the shell, and it's basename is "rbash", the shell is
|
||||
restricted.
|
||||
|
||||
This paragraph applies only to CWRU, or to those who have compiled
|
||||
the shell with "CWRU" defined. When a shell is determined to be
|
||||
restricted, and it is a login shell, the file "/etc/rprofile" (and
|
||||
only that file) is executed. There is no execution of ~/.profile
|
||||
or ~/.bash_profile. The .bashrc file is executed, but after the
|
||||
restrictions have been turned on (users may customize their instances
|
||||
of the shell in this file while not compromising any kind of security
|
||||
arrangements set up by the administrator).
|
||||
|
||||
2. builtins.c
|
||||
|
||||
cd_builtin was modified to return failure if bash is operating in
|
||||
`restricted mode', so changing directories is not allowed.
|
||||
|
||||
3. variables.c
|
||||
|
||||
initialize_shell_variables () was modified to make PATH and SHELL
|
||||
read-only when restricted == 1. These variables may not be unset
|
||||
in a restricted shell.
|
||||
|
||||
4. flags.c
|
||||
|
||||
The variable `restricted' is now declared here. A new flag `-r',
|
||||
to turn on restricted mode, has been added. `change_flag' has
|
||||
been modified to disallow `set +r' if restricted == 1.
|
||||
|
||||
5. execute_cmd.c
|
||||
|
||||
execute_simple_command () was modified to disallow commands and
|
||||
file names that contain a slash.
|
||||
|
||||
Code was added to do_redirections () and do_redirection() to
|
||||
disallow output file redirection specifications if restricted is
|
||||
1.
|
||||
|
||||
Chet Ramey
|
||||
Information Network Services, Case Western Reserve University
|
||||
chet@ins.CWRU.Edu
|
||||
|
||||
(I took almost all of this stuff out again after putting it in.)
|
||||
@@ -1,53 +0,0 @@
|
||||
This describes how bash users create, destroy, assign, and reference array
|
||||
variables. Array variables are variables whose values are arrays of strings,
|
||||
and whose elements may be referenced individually.
|
||||
|
||||
CREATING
|
||||
- any variable may be declared as an array using `typeset -a'
|
||||
- an ordinary variable may be converted to an array using
|
||||
`typeset -a'; the value becomes array[0]
|
||||
|
||||
- there is a question of notation used to simultaneously declare
|
||||
an array variable and populate it with values sequentially,
|
||||
like ksh does with `set -A'. `set -A' is a horrible choice;
|
||||
it should be discarded immediately.
|
||||
|
||||
- we can use `typeset -a array [values...]'
|
||||
|
||||
DESTROYING
|
||||
- `unset name' will destroy the array `name'
|
||||
- how to treat `typeset +a array'?
|
||||
- I think we should keep the variable, convert it from an
|
||||
array to an `ordinary' variable, and make the value at
|
||||
the smallest index of the array the value of the new
|
||||
variable
|
||||
|
||||
ASSIGNING
|
||||
- array[index]=value will serve to assign values to individual
|
||||
elements of the array
|
||||
- the subscript can be an arbitrary arithmetic expression; it
|
||||
will be run through the expression evaluator
|
||||
- this can create arrays, too
|
||||
- this is analogous to defining a variable by simply
|
||||
assigning to it
|
||||
|
||||
REFERENCING
|
||||
- $array will expand to all elements of the array, just like $*
|
||||
expands to all the positional parameters
|
||||
- "$array" is like "$@"
|
||||
- ${array[index]} is used to reference array element `index', where
|
||||
`index' can be an arbitrary arithmetic expression
|
||||
- two special values for `index': * and @ expand to all
|
||||
elements of the array, just like $* and $@. Quoting
|
||||
behavior is the same, too
|
||||
- using a subscript is an error if a variable has not been declared
|
||||
as an array (is this wise?)
|
||||
- ${#variable}, if `variable' is an array, expands to the number of
|
||||
elements in the array
|
||||
- ${#variable[n]} expands to the length of variable[n]. n
|
||||
may be an arbitrary arithmetic expression
|
||||
- ${#variable[*]} and ${#variable[@]} expand to the number of
|
||||
elements in the array
|
||||
|
||||
OPEN QUESTIONS
|
||||
- should we allow them to be exported? Ksh does not, but rc does
|
||||
@@ -1,87 +0,0 @@
|
||||
|
||||
# This script is for bash-maintainers only! It takes a freshly unpacked Bash,
|
||||
# and reorganizes it so that there is exactly one version of any given
|
||||
# source file.
|
||||
#
|
||||
|
||||
if [ "$0" != "./fixdist" ]; then
|
||||
echo "You must run 'fixdist' from the 'support' directory!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ../lib
|
||||
must_exist="posixheaders/posixstat.h posixheaders/ansi_stdlib.h"
|
||||
must_exist="$must_exist tilde/tilde.c tilde/tilde.h"
|
||||
must_exist="$must_exist malloc/xmalloc.c"
|
||||
|
||||
for filename in $must_exist; do
|
||||
if [ ! -f $filename ]; then
|
||||
echo "The file lib/$filename doesn't exist, but it must!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo -n "Relinking neccessary files in lib/readline..."
|
||||
cd readline
|
||||
for filename in tilde.c tilde.h; do
|
||||
rm $filename
|
||||
ln -s ../tilde/$filename .
|
||||
done
|
||||
|
||||
rm posixstat.h && ln -s ../posixheaders/posixstat.h .
|
||||
rm ansi_stdlib.h && ln -s ../posixheaders/ansi_stdlib.h .
|
||||
rm xmalloc.c && ln -s ../malloc/xmalloc.c .
|
||||
echo "done."
|
||||
|
||||
echo -n "Linking files in . ..."
|
||||
cd ../..
|
||||
rm posixstat.h && ln -s lib/posixheaders/posixstat.h .
|
||||
rm ansi_stdlib.h && ln -s lib/posixheaders/ansi_stdlib.h .
|
||||
echo "done."
|
||||
|
||||
echo "Should I move the \"lib\" directory to \"../lib\" if I wouldn't"
|
||||
echo -n "clobber anything by doing so (y/n)? "
|
||||
read reply
|
||||
if [ "$reply" != 'y' ]; then
|
||||
echo "You said no, so in that case I'm all done."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Try as hard as we can to move the lib directory to ../lib.
|
||||
#
|
||||
if [ -d ../lib ]; then
|
||||
echo "The directory $(cd ../lib; pwd) already exists. It looks like:"
|
||||
echo $(cd ../lib; ls -ldg .; ls -lF)
|
||||
echo "I can:"
|
||||
echo " 1) Move the directory to another name,"
|
||||
echo " 2) Delete matching directories from within it,"
|
||||
echo " 3) Copy files into existing directories, or"
|
||||
echo " 4) Quit now, while you are ahead."
|
||||
echo ""
|
||||
echo -n "Which will it be? "
|
||||
read reply
|
||||
case "$reply" in
|
||||
1)
|
||||
echo "I would be moving the directory to lib-old now"
|
||||
;;
|
||||
2)
|
||||
echo "I would be deleting the matching directories now"
|
||||
;;
|
||||
3)
|
||||
echo "I would just go ahead and copy the directories now"
|
||||
;;
|
||||
4)
|
||||
echo "Probably a good move. Look at the script support/mklinks."
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo -n "Moving lib to ../lib, and relinking lib in this directory..."
|
||||
mv lib ../lib
|
||||
mkdir lib
|
||||
cd lib
|
||||
../support/mklinks ../../lib
|
||||
echo "done."
|
||||
fi
|
||||
|
||||
echo "That concludes this fixing of the distribution."
|
||||
exit 0
|
||||
@@ -1,110 +0,0 @@
|
||||
This file is histctl.def, from which is created histctl.c.
|
||||
It implements the builtin "histctl" in Bash.
|
||||
|
||||
Copyright (C) 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$PRODUCES histctl.c
|
||||
|
||||
$BUILTIN histctl
|
||||
$FUNCTION histctl_builtin
|
||||
$DEPENDS_ON HISTORY
|
||||
$SHORT_DOC histctl [-cC] [-iI space|dups|both|none]
|
||||
Control how lines are saved into the command history. An option
|
||||
of -c enables command-oriented history, in which all lines of a
|
||||
compound command are saved as a single history entry. The -i
|
||||
option permits certain lines to be discarded without being stored
|
||||
in the history: SPACE means to ignore lines beginning with a space;
|
||||
DUPS means to ignore lines the same as the last command entered
|
||||
into the history; BOTH enables SPACE and DUPS; and NONE means to
|
||||
store all lines.
|
||||
$END
|
||||
|
||||
#include "../shell.h"
|
||||
|
||||
#if defined (HISTORY)
|
||||
#include "bashgetopt.h"
|
||||
#include "../bashhist.h"
|
||||
|
||||
#define HIGNORE_NONE 0x0
|
||||
#define HIGNORE_SPACE 0x01
|
||||
#define HIGNORE_DUPS 0x02
|
||||
#define HIGNORE_BOTH (HIGNORE_SPACE | HIGNORE_DUPS)
|
||||
|
||||
int
|
||||
histctl_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int opt;
|
||||
char *spec;
|
||||
|
||||
reset_internal_getopt ();
|
||||
while ((opt = internal_getopt (list, "CcI:i:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'c':
|
||||
command_oriented_history++;
|
||||
break;
|
||||
case 'C':
|
||||
command_oriented_history = 0;
|
||||
break;
|
||||
case 'i':
|
||||
spec = list_optarg;
|
||||
if (strcmp (spec, "none") == 0)
|
||||
history_control = HIGNORE_NONE;
|
||||
else if (strcmp (spec, "space") == 0)
|
||||
history_control |= HIGNORE_SPACE;
|
||||
else if (strcmp (spec, "dups") == 0)
|
||||
history_control |= HIGNORE_DUPS;
|
||||
else if (strcmp (spec, "both") == 0)
|
||||
history_control |= HIGNORE_BOTH;
|
||||
else
|
||||
{
|
||||
builtin_error ("invalid argument to -i: %s", spec);
|
||||
builtin_error ("usage: histctl [-cC] [-iI space|dups|both|none]");
|
||||
return (EX_USAGE);
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
spec = list_optarg;
|
||||
if (strcmp (spec, "none") == 0)
|
||||
history_control = HIGNORE_NONE;
|
||||
else if (strcmp (spec, "space") == 0)
|
||||
history_control &= ~HIGNORE_SPACE;
|
||||
else if (strcmp (spec, "dups") == 0)
|
||||
history_control &= ~HIGNORE_DUPS;
|
||||
else if (strcmp (spec, "both") == 0)
|
||||
history_control &= ~HIGNORE_BOTH;
|
||||
else
|
||||
{
|
||||
builtin_error ("invalid argument to -I: %s", spec);
|
||||
builtin_error ("usage: histctl [-cC] [-iI space|dups|both|none]");
|
||||
return (EX_USAGE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
report_bad_option ();
|
||||
builtin_error ("usage: histctl [-cC] [-iI space|dups|both|none]");
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
#endif /* HISTORY */
|
||||
@@ -1,50 +0,0 @@
|
||||
/* The answer to this question is 24. */
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include "siglist.h"
|
||||
|
||||
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int longest, length = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NSIG; i++)
|
||||
{
|
||||
printf ("%2d) %s\n", i, sys_siglist[i]);
|
||||
if (strlen (sys_siglist[i]) > length)
|
||||
{
|
||||
longest = i;
|
||||
length = strlen (sys_siglist[i]);
|
||||
}
|
||||
}
|
||||
|
||||
printf ("The longest name is %d:\"%s\", which is %d chars in length.\n",
|
||||
longest, sys_siglist[longest], length);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* compile-command: "cc -o longest_sig longest_sig.c"
|
||||
* end:
|
||||
*/
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
# Yet another script which requires an already built Bash.
|
||||
#
|
||||
# This makes links in the current directory to the directory specified as
|
||||
# the first argument.
|
||||
#
|
||||
|
||||
topdir=$1
|
||||
|
||||
if [ ! "$topdir" ]; then
|
||||
echo "No directory specified. Read the script $0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function clone_files ()
|
||||
{
|
||||
local dir=$1;
|
||||
local files;
|
||||
|
||||
files=$(cd $dir; echo *);
|
||||
|
||||
if [ ! "$files" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
for filename in $files; do
|
||||
if [ -d $dir/$filename ]; then
|
||||
# If the file to clone is this directory, then skip it.
|
||||
if [ $(cd $dir/$filename; pwd) = $(pwd) ]; then
|
||||
continue;
|
||||
fi
|
||||
mkdir $filename;
|
||||
(cd $filename; clone_files ../$dir/$filename)
|
||||
else
|
||||
ln -s $dir/$filename .;
|
||||
fi
|
||||
done
|
||||
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp *.o core a.out;
|
||||
}
|
||||
|
||||
clone_files $topdir
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/bin/sh
|
||||
# How to make a distribution tarfile.
|
||||
#
|
||||
# $1 is the name of the program.
|
||||
# $2 is the version number.
|
||||
# Remaining args are files to tar.
|
||||
# Optional argument of "~+notar" means don't create the actual tar file,
|
||||
# just create the symlinked directory.
|
||||
|
||||
tar_inhibited=""
|
||||
if [ "$1" = "+notar" ]; then
|
||||
tar_inhibited=yes
|
||||
shift
|
||||
fi
|
||||
|
||||
PROGRAM=$1
|
||||
VERSION=$2
|
||||
|
||||
if [ "$PROGRAM" = "" -o "$VERSION" = "" ]; then
|
||||
echo "Usage: mktarfile [+notar] <progname> <version> <file ...>"
|
||||
echo "Using the \`+notar' option causes a clone directory to be made."
|
||||
exit 2;
|
||||
fi
|
||||
|
||||
shift; shift
|
||||
|
||||
TARFILE=$PROGRAM.tar
|
||||
TARDIR=$PROGRAM-$VERSION
|
||||
|
||||
# Delete the tarfile if we are to create it.
|
||||
if [ ! "tar_inhibited" ]; then
|
||||
rm -rf $TARFILE
|
||||
fi
|
||||
|
||||
# Delete the destination directory if it already exists.
|
||||
rm -rf $TARDIR
|
||||
|
||||
# Make the destination directory.
|
||||
echo "Making directory $TARDIR..."
|
||||
mkdir $TARDIR
|
||||
|
||||
topdir=`pwd`
|
||||
where_I_am=$TARDIR
|
||||
|
||||
trap "cd $topdir" 3
|
||||
|
||||
for i in $*; do
|
||||
filename=$i
|
||||
while [ "$filename" ]; do
|
||||
remainder=`echo $filename | sed 's@[-_a-zA-Z~0-9.]*/@@'`
|
||||
dir=`echo $filename | sed "s@$remainder\\\$@@" | sed "s@/@@"`
|
||||
if [ "$dir" ]; then
|
||||
if [ ! -d $where_I_am/$dir ]; then
|
||||
echo "Making directory $where_I_am/$dir..."
|
||||
mkdir $where_I_am/$dir
|
||||
fi
|
||||
cd $where_I_am/$dir; where_I_am=`pwd`
|
||||
filename=$remainder
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
cd $topdir; where_I_am=$TARDIR
|
||||
ln -s $topdir/$i $TARDIR/$i
|
||||
done
|
||||
|
||||
if [ ! "$tar_inhibited" ]; then
|
||||
echo "tar -chf $TARFILE $TARDIR"
|
||||
tar -chf $TARFILE $TARDIR
|
||||
echo "rm -rf $TARDIR"
|
||||
rm -rf $TARDIR
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,305 +0,0 @@
|
||||
/* Simple program to make new version numbers for the shell.
|
||||
Big deal, but it was getting out of hand to do everything
|
||||
in the makefile. */
|
||||
|
||||
/* Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "posixstat.h"
|
||||
#include <stdio.h>
|
||||
#include "bashansi.h"
|
||||
|
||||
char *progname;
|
||||
char *dir;
|
||||
char *status;
|
||||
|
||||
FILE *must_open ();
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
FILE *file;
|
||||
float distver = 0.0;
|
||||
int buildver = 0, patchlevel = 0;
|
||||
int dist = 0, build = 0, patch = 0;
|
||||
int dist_inc = 0, build_inc = 0, patch_inc = 0;
|
||||
int dot_dist_needs_making = 0;
|
||||
int arg_index = 1;
|
||||
struct stat sb;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
status = dir = (char *)0;
|
||||
while (arg_index < argc && argv[arg_index][0] == '-')
|
||||
{
|
||||
if (strcmp (argv[arg_index], "-dist") == 0)
|
||||
{
|
||||
dist++;
|
||||
dist_inc++;
|
||||
}
|
||||
else if (strcmp (argv[arg_index], "-build") == 0)
|
||||
{
|
||||
build++;
|
||||
build_inc++;
|
||||
}
|
||||
else if (strcmp (argv[arg_index], "-patch") == 0)
|
||||
{
|
||||
patch++;
|
||||
patch_inc++;
|
||||
}
|
||||
else if (strcmp (argv[arg_index], "-dir") == 0)
|
||||
{
|
||||
dir = argv[++arg_index];
|
||||
if (dir == 0)
|
||||
{
|
||||
fprintf (stderr, "%s: `-dir' requires an argument\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
if (stat (dir, &sb) < 0)
|
||||
{
|
||||
fprintf (stderr, "%s: cannot stat %s\n", progname, dir);
|
||||
exit (1);
|
||||
}
|
||||
if ((sb.st_mode & S_IFMT) != S_IFDIR)
|
||||
{
|
||||
fprintf (stderr, "%s: not a directory\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
else if (strcmp (argv[arg_index], "-status") == 0)
|
||||
{
|
||||
status = argv[++arg_index];
|
||||
if (status == 0)
|
||||
{
|
||||
fprintf (stderr, "%s: `-status' requires an argument\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s: unknown option: %s\n", progname, argv[arg_index]);
|
||||
fprintf (stderr, "usage: %s [-dist|-patch|-build] [-dir directory]\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
arg_index++;
|
||||
}
|
||||
|
||||
if (get_float_from_file (".distribution", &distver, 1) == 0)
|
||||
dot_dist_needs_making++;
|
||||
|
||||
if (get_int_from_file (".patchlevel", &patchlevel, 1) == 0)
|
||||
{
|
||||
patchlevel = 0;
|
||||
patch_inc = 0;
|
||||
}
|
||||
|
||||
if (get_int_from_file (".build", &buildver, 0) == 0)
|
||||
buildver = 0;
|
||||
|
||||
/* Setting distribution version. */
|
||||
if (dist && arg_index < argc)
|
||||
if (sscanf (argv[arg_index], "%f", &distver) != 1)
|
||||
{
|
||||
fprintf (stderr, "%s: Bad input `%s'. Expected float value for -dist.\n",
|
||||
progname, argv[arg_index]);
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
arg_index++;
|
||||
dist_inc = 0;
|
||||
}
|
||||
|
||||
/* Setting patchlevel via argument. */
|
||||
if (patch && arg_index < argc)
|
||||
if (sscanf (argv[arg_index], "%d", &patchlevel) != 1)
|
||||
{
|
||||
fprintf (stderr, "%s: Bad input `%s'. Expected int value for -patch.\n",
|
||||
progname, argv[arg_index]);
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
arg_index++;
|
||||
patch_inc = 0;
|
||||
}
|
||||
|
||||
if (build && arg_index < argc)
|
||||
if (sscanf (argv[arg_index], "%d", &buildver) != 1)
|
||||
{
|
||||
fprintf (stderr, "%s: Bad input `%s'. Expected int value for -build.\n",
|
||||
progname, argv[arg_index]);
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
arg_index++;
|
||||
build_inc = 0;
|
||||
}
|
||||
|
||||
if (dot_dist_needs_making && !distver)
|
||||
{
|
||||
fprintf (stderr, "%s: There is no `.distribution' file to infer from.\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (dist_inc)
|
||||
distver = distver + 0.01;
|
||||
|
||||
if (patch_inc)
|
||||
patchlevel++;
|
||||
|
||||
if (build_inc)
|
||||
buildver++;
|
||||
|
||||
file = must_open ("newversion.h", "w");
|
||||
|
||||
/* Output the leading comment. */
|
||||
fprintf (file,
|
||||
"/* Version control for the shell. This file gets changed when you say\n\
|
||||
`make newversion' to the Makefile. It is created by mkversion. */\n");
|
||||
|
||||
fprintf (file, "\n/* The distribution version number of this shell. */\n");
|
||||
fprintf (file, "#define DISTVERSION \"%.2f\"\n", distver);
|
||||
|
||||
fprintf (file, "\n/* The patch level of this version of the shell. */\n");
|
||||
fprintf (file, "#define PATCHLEVEL %d\n", patchlevel);
|
||||
|
||||
fprintf (file, "\n/* The last built version of this shell. */\n");
|
||||
fprintf (file, "#define BUILDVERSION %d\n", buildver);
|
||||
|
||||
if (status)
|
||||
{
|
||||
fprintf (file, "\n/* The release status of this shell. */\n");
|
||||
fprintf (file, "#define RELSTATUS \"%s\"\n", status);
|
||||
}
|
||||
|
||||
fprintf (file, "\n/* A version string for use by sccs and the what command. */\n\n");
|
||||
if (status)
|
||||
fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) %s GNU\"\n\n",
|
||||
distver, patchlevel, buildver, status);
|
||||
else
|
||||
fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) GNU\"\n\n",
|
||||
distver, patchlevel, buildver);
|
||||
|
||||
fclose (file);
|
||||
|
||||
file = must_open (".build", "w");
|
||||
fprintf (file, "%d\n", buildver);
|
||||
fclose (file);
|
||||
|
||||
/* Making a new distribution. */
|
||||
if (dist)
|
||||
{
|
||||
file = must_open (".distribution", "w");
|
||||
fprintf (file, "%.2f\n", distver);
|
||||
fclose (file);
|
||||
}
|
||||
|
||||
/* Releasing a new patch level. */
|
||||
if (patch)
|
||||
{
|
||||
file = must_open (".patchlevel", "w");
|
||||
fprintf (file, "%d\n", patchlevel);
|
||||
fclose (file);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
char *
|
||||
makename (fn, from_srcdir)
|
||||
char *fn;
|
||||
{
|
||||
char *ret;
|
||||
int dlen;
|
||||
|
||||
dlen = (from_srcdir && dir) ? strlen (dir) + 1 : 0;
|
||||
ret = (char *)malloc (dlen + strlen (fn) + 1);
|
||||
if (ret == 0)
|
||||
{
|
||||
fprintf (stderr, "%s: malloc failed\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
if (from_srcdir && dir)
|
||||
sprintf (ret, "%s/%s", dir, fn);
|
||||
else
|
||||
(void)strcpy (ret, fn);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
get_float_from_file (filename, var, from_srcdir)
|
||||
char *filename;
|
||||
float *var;
|
||||
int from_srcdir;
|
||||
{
|
||||
FILE *stream;
|
||||
int result;
|
||||
char *name;
|
||||
|
||||
name = makename (filename, from_srcdir);
|
||||
stream = fopen (name, "r");
|
||||
free (name);
|
||||
if (stream == (FILE *)NULL)
|
||||
return (0);
|
||||
result = fscanf (stream, "%f\n", var);
|
||||
fclose (stream);
|
||||
return (result == 1);
|
||||
}
|
||||
|
||||
get_int_from_file (filename, var, from_srcdir)
|
||||
char *filename;
|
||||
int *var, from_srcdir;
|
||||
{
|
||||
FILE *stream;
|
||||
int result;
|
||||
char *name;
|
||||
|
||||
name = makename (filename, from_srcdir);
|
||||
stream = fopen (name, "r");
|
||||
free (name);
|
||||
if (stream == (FILE *)NULL)
|
||||
return (0);
|
||||
result = fscanf (stream, "%d\n", var);
|
||||
fclose (stream);
|
||||
return (result == 1);
|
||||
}
|
||||
|
||||
FILE *
|
||||
must_open (name, mode)
|
||||
char *name, *mode;
|
||||
{
|
||||
FILE *temp = fopen (name, mode);
|
||||
|
||||
if (!temp)
|
||||
{
|
||||
fprintf (stderr, "%s: Cannot open `%s' for mode `%s'.\n",
|
||||
progname, name, mode);
|
||||
fprintf
|
||||
(stderr,
|
||||
"Perhaps you don't have %s permission to the file or directory.\n",
|
||||
(strcmp (mode, "w") == 0) ? "write" : "read");
|
||||
exit (3);
|
||||
}
|
||||
return (temp);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* getpagesize - print the system pagesize
|
||||
*
|
||||
* Chet Ramey
|
||||
* chet@ins.cwru.edu
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* I know these systems have getpagesize(2)
|
||||
*/
|
||||
|
||||
#if defined (Bsd) || defined (Ultrix) || defined (sun)
|
||||
# define HAVE_GETPAGESIZE
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_GETPAGESIZE)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
# if defined (_SC_PAGESIZE)
|
||||
# define getpagesize() sysconf(_SC_PAGESIZE)
|
||||
# endif /* _SC_PAGESIZE */
|
||||
#endif
|
||||
|
||||
#if !defined (getpagesize)
|
||||
# include <sys/param.h>
|
||||
# if defined (PAGESIZE)
|
||||
# define getpagesize() PAGESIZE
|
||||
# else /* !PAGESIZE */
|
||||
# if defined (EXEC_PAGESIZE)
|
||||
# define getpagesize() EXEC_PAGESIZE
|
||||
# else /* !EXEC_PAGESIZE */
|
||||
# if defined (NBPG)
|
||||
# if !defined (CLSIZE)
|
||||
# define CLSIZE 1
|
||||
# endif /* !CLSIZE */
|
||||
# define getpagesize() (NBPG * CLSIZE)
|
||||
# else /* !NBPG */
|
||||
# if defined (NBPC)
|
||||
# define getpagesize() NBPC
|
||||
# endif /* NBPC */
|
||||
# endif /* !NBPG */
|
||||
# endif /* !EXEC_PAGESIZE */
|
||||
# endif /* !PAGESIZE */
|
||||
#endif /* !getpagesize */
|
||||
|
||||
#if !defined (getpagesize)
|
||||
# define getpagesize() 4096 /* Just punt and use reasonable value */
|
||||
#endif
|
||||
|
||||
#endif /* no EXEC_PAGESIZE */
|
||||
|
||||
#endif /* not HAVE_GETPAGESIZE */
|
||||
|
||||
main()
|
||||
{
|
||||
#if defined (HAVE_GETPAGESIZE) || defined (getpagesize)
|
||||
printf ("%ld\n", getpagesize ());
|
||||
#else
|
||||
puts ("1024");
|
||||
#endif
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# pagesize.sh -- determine this system's page size, and write a define to
|
||||
# lib/malloc/pagesize.h for the Gnu malloc's valloc().
|
||||
|
||||
echo "/*"
|
||||
echo " * pagesize.h"
|
||||
echo " *"
|
||||
echo " * This file is automatically generated by pagesize.sh"
|
||||
echo " * Do not edit!"
|
||||
echo " */"
|
||||
echo ""
|
||||
|
||||
if [ -x /bin/pagesize ]; then
|
||||
echo "#define getpagesize() `/bin/pagesize`"
|
||||
else
|
||||
echo "#define getpagesize() `./support/pagesize.aux`"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,293 +0,0 @@
|
||||
This file is read.def, from which is created read.c.
|
||||
It implements the builtin "read" in Bash.
|
||||
|
||||
Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$PRODUCES read.c
|
||||
|
||||
$BUILTIN read
|
||||
$FUNCTION read_builtin
|
||||
$SHORT_DOC read [-r] [-p prompt] [-a array] [name ...]
|
||||
One line is read from the standard input, and the first word is
|
||||
assigned to the first NAME, the second word to the second NAME, etc.
|
||||
with leftover words assigned to the last NAME. Only the characters
|
||||
found in $IFS are recognized as word delimiters. The return code is
|
||||
zero, unless end-of-file is encountered. If the -r option is given,
|
||||
this signifies `raw' input, and backslash processing is disabled. If
|
||||
the `-p' option is supplied, the string supplied as an argument is
|
||||
output without a trailing newline before attempting to read. If -a
|
||||
is supplied, the words read are assigned to sequential indices of ARRAY,
|
||||
starting at zero.
|
||||
$END
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../shell.h"
|
||||
#include "common.h"
|
||||
#include "bashgetopt.h"
|
||||
|
||||
static int stream_close ();
|
||||
|
||||
extern int interrupt_immediately;
|
||||
|
||||
/* Read the value of the shell variables whose names follow.
|
||||
The reading is done from the current input stream, whatever
|
||||
that may be. Successive words of the input line are assigned
|
||||
to the variables mentioned in LIST. The last variable in LIST
|
||||
gets the remainder of the words on the line. If no variables
|
||||
are mentioned in LIST, then the default variable is $REPLY. */
|
||||
read_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
register char *varname;
|
||||
int size, c, i, fildes, raw_mode, pass_next, saw_escape, opt, retval;
|
||||
char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
|
||||
FILE *input_stream;
|
||||
SHELL_VAR *ifs;
|
||||
#if defined (ARRAY_VARS)
|
||||
SHELL_VAR *v;
|
||||
WORD_LIST *alist;
|
||||
#endif
|
||||
|
||||
i = 0; /* Index into the string that we are reading. */
|
||||
raw_mode = 0; /* Not reading raw input be default. */
|
||||
arrayname = prompt = (char *)NULL;
|
||||
|
||||
reset_internal_getopt ();
|
||||
while ((opt = internal_getopt (list, "rp:a:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'r':
|
||||
raw_mode = 1;
|
||||
break;
|
||||
case 'p':
|
||||
prompt = list_optarg;
|
||||
break;
|
||||
#if defined (ARRAY_VARS)
|
||||
case 'a':
|
||||
arrayname = list_optarg;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
builtin_usage ();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
list = loptend;
|
||||
|
||||
/* We need unbuffered input from stdin. So we make a new stream with
|
||||
the same file descriptor as stdin, then unbuffer it. */
|
||||
fildes = dup (fileno (stdin));
|
||||
|
||||
if (fildes == -1)
|
||||
return (EXECUTION_FAILURE);
|
||||
|
||||
input_stream = fdopen (fildes, "r");
|
||||
|
||||
if (!input_stream)
|
||||
{
|
||||
close (fildes);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
ifs = find_variable ("IFS");
|
||||
if (ifs == 0)
|
||||
ifs_chars = " \t\n";
|
||||
else
|
||||
ifs_chars = value_cell (ifs);
|
||||
|
||||
input_string = xmalloc (size = 128);
|
||||
|
||||
setbuf (input_stream, (char *)NULL);
|
||||
|
||||
begin_unwind_frame ("read_builtin");
|
||||
add_unwind_protect (xfree, input_string);
|
||||
add_unwind_protect (stream_close, input_stream);
|
||||
interrupt_immediately++;
|
||||
|
||||
if (prompt && isatty (0))
|
||||
{
|
||||
fprintf (stderr, "%s", prompt);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
pass_next = 0; /* Non-zero signifies last char was backslash. */
|
||||
saw_escape = 0; /* Non-zero signifies that we saw an escape char */
|
||||
|
||||
while ((c = getc (input_stream)) != EOF)
|
||||
{
|
||||
if (i + 2 >= size)
|
||||
input_string = xrealloc (input_string, size += 128);
|
||||
|
||||
/* If the next character is to be accepted verbatim, a backslash
|
||||
newline pair still disappears from the input. */
|
||||
if (pass_next)
|
||||
{
|
||||
if (c == '\n')
|
||||
i--; /* back up over the CTLESC */
|
||||
else
|
||||
input_string[i++] = c;
|
||||
pass_next = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\\' && !raw_mode)
|
||||
{
|
||||
pass_next++;
|
||||
saw_escape++;
|
||||
input_string[i++] = CTLESC;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\n')
|
||||
break;
|
||||
|
||||
if (c == CTLESC || c == CTLNUL)
|
||||
input_string[i++] = CTLESC;
|
||||
|
||||
input_string[i++] = c;
|
||||
}
|
||||
input_string[i] = '\0';
|
||||
|
||||
interrupt_immediately--;
|
||||
discard_unwind_frame ("read_builtin");
|
||||
|
||||
fclose (input_stream);
|
||||
|
||||
if (c == EOF)
|
||||
{
|
||||
retval = EXECUTION_FAILURE;
|
||||
input_string[0] = '\0';
|
||||
}
|
||||
else
|
||||
retval = EXECUTION_SUCCESS;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
/* If -a was given, take the string read, break it into a list of words,
|
||||
an assign them to `arrayname' in turn. */
|
||||
if (arrayname)
|
||||
{
|
||||
v = find_variable (arrayname);
|
||||
if (v == 0)
|
||||
v = make_new_array_variable (arrayname);
|
||||
else if (array_p (v) == 0)
|
||||
v = convert_var_to_array (v);
|
||||
|
||||
alist = list_string (input_string, " \t\n", 0);
|
||||
if (alist)
|
||||
{
|
||||
assign_word_list (array_cell (v), alist);
|
||||
dispose_words (alist);
|
||||
}
|
||||
free (input_string);
|
||||
return (retval);
|
||||
}
|
||||
#endif /* ARRAY_VARS */
|
||||
|
||||
if (!list)
|
||||
{
|
||||
SHELL_VAR *var;
|
||||
char *t;
|
||||
|
||||
if (saw_escape)
|
||||
{
|
||||
t = dequote_string (input_string);
|
||||
var = bind_variable ("REPLY", t);
|
||||
free (t);
|
||||
}
|
||||
else
|
||||
var = bind_variable ("REPLY", input_string);
|
||||
var->attributes &= ~att_invisible;
|
||||
free (input_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHELL_VAR *var;
|
||||
char *t;
|
||||
/* This code implements the Posix.2 spec for splitting the words
|
||||
read and assigning them to variables. If $IFS is unset, we
|
||||
use the default value of " \t\n". */
|
||||
if (!ifs_chars)
|
||||
ifs_chars = "";
|
||||
|
||||
orig_input_string = input_string;
|
||||
while (list->next)
|
||||
{
|
||||
char *e, *t1;
|
||||
|
||||
varname = list->word->word;
|
||||
|
||||
/* If there are more variables than words read from the input,
|
||||
the remaining variables are set to the empty string. */
|
||||
if (*input_string)
|
||||
{
|
||||
/* This call updates INPUT_STRING. */
|
||||
t = get_word_from_string (&input_string, ifs_chars, &e);
|
||||
if (t)
|
||||
*e = '\0';
|
||||
/* Don't bother to remove the CTLESC unless we added one
|
||||
somewhere while reading the string. */
|
||||
if (t && saw_escape)
|
||||
{
|
||||
t1 = dequote_string (t);
|
||||
var = bind_variable (varname, t1);
|
||||
free (t1);
|
||||
}
|
||||
else
|
||||
var = bind_variable (varname, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (char *)0;
|
||||
var = bind_variable (varname, "");
|
||||
}
|
||||
|
||||
stupidly_hack_special_variables (varname);
|
||||
var->attributes &= ~att_invisible;
|
||||
|
||||
if (t)
|
||||
free (t);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
if (saw_escape)
|
||||
{
|
||||
t = dequote_string (input_string);
|
||||
var = bind_variable (list->word->word, t);
|
||||
free (t);
|
||||
}
|
||||
else
|
||||
var = bind_variable (list->word->word, input_string);
|
||||
stupidly_hack_special_variables (list->word->word);
|
||||
var->attributes &= ~att_invisible;
|
||||
free (orig_input_string);
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/* This way I don't have to know whether fclose () is a
|
||||
function or a macro. */
|
||||
static int
|
||||
stream_close (file)
|
||||
FILE *file;
|
||||
{
|
||||
return (fclose (file));
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
SRCS= main.c parse.y make.c copy.c aux.c
|
||||
OBJS= main.o parse.o make.o copy.o aux.o
|
||||
|
||||
PROG= parse
|
||||
|
||||
AUX= ../../../sun4/error.o
|
||||
|
||||
CFLAGS= -g -I. -I../.. -I. -DTEST -Dalloca=__builtin_alloca
|
||||
LDFLAGS= -g
|
||||
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(AUX) $(LIBS)
|
||||
|
||||
parse.o: parse.y
|
||||
@@ -1,231 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include "filecntl.h"
|
||||
|
||||
#include "shell.h"
|
||||
#include <strings.h>
|
||||
char *
|
||||
xmalloc (size)
|
||||
int size;
|
||||
{
|
||||
register char *temp = (char *)malloc (size);
|
||||
|
||||
if (!temp)
|
||||
fatal_error ("Out of virtual memory!");
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
char *
|
||||
xrealloc (pointer, size)
|
||||
register char *pointer;
|
||||
int size;
|
||||
{
|
||||
char *temp;
|
||||
|
||||
if (!pointer)
|
||||
temp = (char *)xmalloc (size);
|
||||
else
|
||||
temp = (char *)realloc (pointer, size);
|
||||
|
||||
if (!temp)
|
||||
fatal_error ("Out of virtual memory!");
|
||||
|
||||
return (temp);
|
||||
}
|
||||
/* Reverse the chain of structures in LIST. Output the new head
|
||||
of the chain. You should always assign the output value of this
|
||||
function to something, or you will lose the chain. */
|
||||
GENERIC_LIST *
|
||||
reverse_list (list)
|
||||
register GENERIC_LIST *list;
|
||||
{
|
||||
register GENERIC_LIST *next, *prev = (GENERIC_LIST *)NULL;
|
||||
|
||||
while (list) {
|
||||
next = list->next;
|
||||
list->next = prev;
|
||||
prev = list;
|
||||
list = next;
|
||||
}
|
||||
return (prev);
|
||||
}
|
||||
|
||||
/* Return the number of elements in LIST, a generic list. */
|
||||
int
|
||||
list_length (list)
|
||||
register GENERIC_LIST *list;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; list; list = list->next, i++);
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Delete the element of LIST which satisfies the predicate function COMPARER.
|
||||
Returns the element that was deleted, so you can dispose of it, or -1 if
|
||||
the element wasn't found. COMPARER is called with the list element and
|
||||
then ARG. Note that LIST contains the address of a variable which points
|
||||
to the list. You might call this function like this:
|
||||
|
||||
SHELL_VAR *elt = delete_element (&variable_list, check_var_has_name, "foo");
|
||||
dispose_variable (elt);
|
||||
*/
|
||||
GENERIC_LIST *
|
||||
delete_element (list, comparer, arg)
|
||||
GENERIC_LIST **list;
|
||||
Function *comparer;
|
||||
{
|
||||
register GENERIC_LIST *prev = (GENERIC_LIST *)NULL;
|
||||
register GENERIC_LIST *temp = *list;
|
||||
|
||||
while (temp) {
|
||||
if ((*comparer) (temp, arg)) {
|
||||
if (prev) prev->next = temp->next;
|
||||
else *list = temp->next;
|
||||
return (temp);
|
||||
}
|
||||
prev = temp;
|
||||
temp = temp->next;
|
||||
}
|
||||
return ((GENERIC_LIST *)-1);
|
||||
}
|
||||
|
||||
/* Find NAME in ARRAY. Return the index of NAME, or -1 if not present.
|
||||
ARRAY shoudl be NULL terminated. */
|
||||
int
|
||||
find_name_in_list (name, array)
|
||||
char *name, *array[];
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; array[i]; i++)
|
||||
if (strcmp (name, array[i]) == 0)
|
||||
return (i);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Return the length of ARRAY, a NULL terminated array of char *. */
|
||||
int
|
||||
array_len (array)
|
||||
register char **array;
|
||||
{
|
||||
register int i;
|
||||
for (i=0; array[i]; i++);
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Free the contents of ARRAY, a NULL terminated array of char *. */
|
||||
void
|
||||
free_array (array)
|
||||
register char **array;
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
if (!array) return;
|
||||
|
||||
while (array[i])
|
||||
free (array[i++]);
|
||||
free (array);
|
||||
}
|
||||
|
||||
/* Allocate and return a new copy of ARRAY and its contents. */
|
||||
char **
|
||||
copy_array (array)
|
||||
register char **array;
|
||||
{
|
||||
register int i;
|
||||
int len;
|
||||
char **new_array;
|
||||
|
||||
len = array_len (array);
|
||||
new_array = (char **)xmalloc ((len + 1) * sizeof (char *));
|
||||
for (i = 0; array[i]; i++)
|
||||
new_array[i] = savestring (array[i]);
|
||||
new_array[i] = (char *)NULL;
|
||||
return (new_array);
|
||||
}
|
||||
|
||||
/* Append LIST2 to LIST1. Return the header of the list. */
|
||||
GENERIC_LIST *
|
||||
list_append (head, tail)
|
||||
GENERIC_LIST *head, *tail;
|
||||
{
|
||||
register GENERIC_LIST *t_head = head;
|
||||
|
||||
if (!t_head)
|
||||
return (tail);
|
||||
|
||||
while (t_head->next) t_head = t_head->next;
|
||||
t_head->next = tail;
|
||||
return (head);
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0x0
|
||||
#endif
|
||||
|
||||
#if defined (ibm032)
|
||||
/*
|
||||
* Most vanilla 4.3 (not 4.3-tahoe) sites lack vfprintf.
|
||||
* Here is the one from 4.3-tahoe (it is freely redistributable).
|
||||
*
|
||||
* Beware! Don't trust the value returned by either of these functions; it
|
||||
* seems that pre-4.3-tahoe implementations of _doprnt () return the first
|
||||
* argument, i.e. a char *. Besides, _doprnt () is incorrectly documented
|
||||
* in the 4.3 BSD manuals, anyway (it's wrong in SunOS 3.5 also, but they
|
||||
* have the v*printf functions (incorrectly documented (vprintf), but they
|
||||
* are present)).
|
||||
*/
|
||||
#include <varargs.h>
|
||||
|
||||
int
|
||||
vfprintf (iop, fmt, ap)
|
||||
FILE *iop;
|
||||
char *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
int len;
|
||||
char localbuf[BUFSIZ];
|
||||
|
||||
if (iop->_flag & _IONBF)
|
||||
{
|
||||
iop->_flag &= ~_IONBF;
|
||||
iop->_ptr = iop->_base = localbuf;
|
||||
len = _doprnt (fmt, ap, iop);
|
||||
(void) fflush (iop);
|
||||
iop->_flag |= _IONBF;
|
||||
iop->_base = NULL;
|
||||
iop->_bufsiz = 0;
|
||||
iop->_cnt = 0;
|
||||
}
|
||||
else
|
||||
len = _doprnt (fmt, ap, iop);
|
||||
return (ferror (iop) ? EOF : len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ditto for vsprintf
|
||||
*/
|
||||
int
|
||||
vsprintf (str, fmt, ap)
|
||||
char *str, *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
FILE f;
|
||||
int len;
|
||||
|
||||
f._flag = _IOWRT+_IOSTRG;
|
||||
f._ptr = str;
|
||||
f._cnt = 32767;
|
||||
len = _doprnt (fmt, ap, &f);
|
||||
*f._ptr = 0;
|
||||
return (len);
|
||||
}
|
||||
|
||||
#endif /* ibm032 */
|
||||
@@ -1,179 +0,0 @@
|
||||
/* command.h -- The structures used internally to represent commands, and
|
||||
the extern declarations of the functions used to create them. */
|
||||
|
||||
#if !defined (_COMMAND_H)
|
||||
#define _COMMAND_H
|
||||
|
||||
/* Instructions describing what kind of thing to do for a redirection. */
|
||||
enum r_instruction {
|
||||
r_output_direction, r_input_direction, r_inputa_direction,
|
||||
r_appending_to, r_reading_until, r_duplicating_input,
|
||||
r_duplicating_output, r_deblank_reading_until, r_close_this,
|
||||
r_err_and_out, r_input_output, r_output_force,
|
||||
r_duplicating_input_word, r_duplicating_output_word
|
||||
};
|
||||
|
||||
/* Command Types: */
|
||||
enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple,
|
||||
cm_connection, cm_function_def, cm_until, cm_group };
|
||||
|
||||
/* A structure which represents a word. */
|
||||
typedef struct word_desc {
|
||||
char *word; /* Zero terminated string. */
|
||||
int dollar_present; /* Non-zero means dollar sign present. */
|
||||
int quoted; /* Non-zero means single, double, or back quote
|
||||
or backslash is present. */
|
||||
int assignment; /* Non-zero means that this word contains an
|
||||
assignment. */
|
||||
} WORD_DESC;
|
||||
|
||||
/* A linked list of words. */
|
||||
typedef struct word_list {
|
||||
struct word_list *next;
|
||||
WORD_DESC *word;
|
||||
} WORD_LIST;
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Shell Command Structs */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* What a redirection descriptor looks like. If FLAGS is IS_DESCRIPTOR,
|
||||
then we use REDIRECTEE.DEST, else we use the file specified. */
|
||||
typedef struct redirect {
|
||||
struct redirect *next; /* Next element, or NULL. */
|
||||
int redirector; /* Descriptor to be redirected. */
|
||||
int flags; /* Flag value for `open'. */
|
||||
enum r_instruction instruction; /* What to do with the information. */
|
||||
union {
|
||||
int dest; /* Place to redirect REDIRECTOR to, or ... */
|
||||
WORD_DESC *filename; /* filename to redirect to. */
|
||||
} redirectee;
|
||||
char *here_doc_eof; /* The word that appeared in <<foo. */
|
||||
} REDIRECT;
|
||||
|
||||
/* An element used in parsing. A single word or a single redirection.
|
||||
This is an ephemeral construct. */
|
||||
typedef struct element {
|
||||
WORD_DESC *word;
|
||||
REDIRECT *redirect;
|
||||
struct element *next;
|
||||
} ELEMENT;
|
||||
|
||||
/* Possible values for command->flags. */
|
||||
#define CMD_WANT_SUBSHELL 0x01 /* User wants a subshell: ( command ) */
|
||||
#define CMD_FORCE_SUBSHELL 0x02 /* Shell needs to force a subshell. */
|
||||
#define CMD_INVERT_RETURN 0x04 /* Invert the exit value. */
|
||||
#define CMD_IGNORE_RETURN 0x08 /* Ignore the exit value. For set -e. */
|
||||
#define CMD_NO_FUNCTIONS 0x10 /* Ignore functions during command lookup. */
|
||||
#define CMD_INHIBIT_EXPANSION 0x20 /* Do not expand the command words. */
|
||||
|
||||
/* What a command looks like. */
|
||||
typedef struct command {
|
||||
enum command_type type; /* FOR CASE WHILE IF CONNECTION or SIMPLE. */
|
||||
int flags; /* Flags controlling execution environment. */
|
||||
REDIRECT *redirects; /* Special redirects for FOR CASE, etc. */
|
||||
union {
|
||||
struct for_com *For;
|
||||
struct case_com *Case;
|
||||
struct while_com *While;
|
||||
struct if_com *If;
|
||||
struct connection *Connection;
|
||||
struct simple_com *Simple;
|
||||
struct function_def *Function_def;
|
||||
struct group_com *Group;
|
||||
} value;
|
||||
} COMMAND;
|
||||
|
||||
/* Structure used to represent the CONNECTION type. */
|
||||
typedef struct connection {
|
||||
int ignore; /* Unused; simplifies make_command (). */
|
||||
COMMAND *first; /* Pointer to the first command. */
|
||||
COMMAND *second; /* Pointer to the second command. */
|
||||
int connector; /* What separates this command from others. */
|
||||
} CONNECTION;
|
||||
|
||||
/* Structures used to represent the CASE command. */
|
||||
|
||||
/* Pattern/action structure for CASE_COM. */
|
||||
typedef struct pattern_list {
|
||||
struct pattern_list *next; /* Clause to try in case this one failed. */
|
||||
WORD_LIST *patterns; /* Linked list of patterns to test. */
|
||||
COMMAND *action; /* Thing to execute if a pattern matches. */
|
||||
} PATTERN_LIST;
|
||||
|
||||
/* The CASE command. */
|
||||
typedef struct case_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
WORD_DESC *word; /* The thing to test. */
|
||||
PATTERN_LIST *clauses; /* The clauses to test against, or NULL. */
|
||||
} CASE_COM;
|
||||
|
||||
/* FOR command. */
|
||||
typedef struct for_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
WORD_DESC *name; /* The variable name to get mapped over. */
|
||||
WORD_LIST *map_list; /* The things to map over. This is never NULL. */
|
||||
COMMAND *action; /* The action to execute.
|
||||
During execution, NAME is bound to successive
|
||||
members of MAP_LIST. */
|
||||
} FOR_COM;
|
||||
|
||||
/* IF command. */
|
||||
typedef struct if_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
COMMAND *test; /* Thing to test. */
|
||||
COMMAND *true_case; /* What to do if the test returned non-zero. */
|
||||
COMMAND *false_case; /* What to do if the test returned zero. */
|
||||
} IF_COM;
|
||||
|
||||
/* WHILE command. */
|
||||
typedef struct while_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
COMMAND *test; /* Thing to test. */
|
||||
COMMAND *action; /* Thing to do while test is non-zero. */
|
||||
} WHILE_COM;
|
||||
|
||||
/* The "simple" command. Just a collection of words and redirects. */
|
||||
typedef struct simple_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
WORD_LIST *words; /* The program name, the arguments,
|
||||
variable assignments, etc. */
|
||||
REDIRECT *redirects; /* Redirections to perform. */
|
||||
} SIMPLE_COM;
|
||||
|
||||
/* The "function_def" command. This isn't really a command, but it is
|
||||
represented as such for now. If the function def appears within
|
||||
`(' `)' the parser tries to set the SUBSHELL bit of the command. That
|
||||
means that FUNCTION_DEF has to be run through the executor. Maybe this
|
||||
command should be defined in a subshell. Who knows or cares. */
|
||||
typedef struct function_def {
|
||||
int ignore; /* See description of CMD flags. */
|
||||
WORD_DESC *name; /* The name of the function. */
|
||||
COMMAND *command; /* The parsed execution tree. */
|
||||
} FUNCTION_DEF;
|
||||
|
||||
/* A command that is `grouped' allows pipes to take effect over
|
||||
the entire command structure. */
|
||||
typedef struct group_com {
|
||||
int ignore; /* See description of CMD flags. */
|
||||
COMMAND *command;
|
||||
} GROUP_COM;
|
||||
|
||||
/* Forward declarations of functions called by the grammer. */
|
||||
extern REDIRECT *make_redirection ();
|
||||
extern WORD_LIST *make_word_list ();
|
||||
extern WORD_DESC *make_word ();
|
||||
|
||||
extern COMMAND
|
||||
*make_for_command (), *make_case_command (), *make_if_command (),
|
||||
*make_while_command (), *command_connect (), *make_simple_command (),
|
||||
*make_function_def (), *clean_simple_command (), *make_until_command (),
|
||||
*make_group_command ();
|
||||
|
||||
extern PATTERN_LIST *make_pattern_list ();
|
||||
extern COMMAND *global_command, *copy_command ();
|
||||
|
||||
#endif /* _COMMAND_H */
|
||||
@@ -1,279 +0,0 @@
|
||||
/* copy_command.c -- copy a COMMAND structure. This is needed
|
||||
primarily for making function definitions, but I'm not sure
|
||||
that anyone else will need it. */
|
||||
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "shell.h"
|
||||
|
||||
/* Forward declaration. */
|
||||
extern COMMAND *copy_command ();
|
||||
|
||||
WORD_DESC *
|
||||
copy_word (word)
|
||||
WORD_DESC *word;
|
||||
{
|
||||
WORD_DESC *new_word = (WORD_DESC *)xmalloc (sizeof (WORD_DESC));
|
||||
bcopy (word, new_word, sizeof (WORD_DESC));
|
||||
new_word->word = savestring (word->word);
|
||||
return (new_word);
|
||||
}
|
||||
|
||||
/* Copy the chain of words in LIST. Return a pointer to
|
||||
the new chain. */
|
||||
WORD_LIST *
|
||||
copy_word_list (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
WORD_LIST *new_list = NULL;
|
||||
|
||||
while (list)
|
||||
{
|
||||
WORD_LIST *temp = (WORD_LIST *)xmalloc (sizeof (WORD_LIST));
|
||||
temp->next = new_list;
|
||||
new_list = temp;
|
||||
new_list->word = copy_word (list->word);
|
||||
list = list->next;
|
||||
}
|
||||
return ((WORD_LIST *)reverse_list (new_list));
|
||||
}
|
||||
|
||||
PATTERN_LIST *
|
||||
copy_case_clause (clause)
|
||||
PATTERN_LIST *clause;
|
||||
{
|
||||
PATTERN_LIST *new_clause = (PATTERN_LIST *)xmalloc (sizeof (PATTERN_LIST));
|
||||
new_clause->patterns = copy_word_list (clause->patterns);
|
||||
new_clause->action = copy_command (clause->action);
|
||||
return (new_clause);
|
||||
}
|
||||
|
||||
PATTERN_LIST *
|
||||
copy_case_clauses (clauses)
|
||||
PATTERN_LIST *clauses;
|
||||
{
|
||||
PATTERN_LIST *new_list = (PATTERN_LIST *)NULL;
|
||||
|
||||
while (clauses)
|
||||
{
|
||||
PATTERN_LIST *new_clause = copy_case_clause (clauses);
|
||||
new_clause->next = new_list;
|
||||
new_list = new_clause;
|
||||
clauses = clauses->next;
|
||||
}
|
||||
return ((PATTERN_LIST *)reverse_list (new_list));
|
||||
}
|
||||
|
||||
/* Copy a single redirect. */
|
||||
REDIRECT *
|
||||
copy_redirect (redirect)
|
||||
REDIRECT *redirect;
|
||||
{
|
||||
REDIRECT *new_redirect = (REDIRECT *)xmalloc (sizeof (REDIRECT));
|
||||
bcopy (redirect, new_redirect, (sizeof (REDIRECT)));
|
||||
switch (redirect->instruction)
|
||||
{
|
||||
case r_reading_until:
|
||||
case r_deblank_reading_until:
|
||||
new_redirect->here_doc_eof = savestring (redirect->here_doc_eof);
|
||||
/* There is NO BREAK HERE ON PURPOSE!!!! */
|
||||
case r_appending_to:
|
||||
case r_output_direction:
|
||||
case r_input_direction:
|
||||
case r_inputa_direction:
|
||||
case r_err_and_out:
|
||||
case r_input_output:
|
||||
case r_output_force:
|
||||
case r_duplicating_input_word:
|
||||
case r_duplicating_output_word:
|
||||
new_redirect->redirectee.filename =
|
||||
copy_word (redirect->redirectee.filename);
|
||||
break;
|
||||
}
|
||||
return (new_redirect);
|
||||
}
|
||||
|
||||
REDIRECT *
|
||||
copy_redirects (list)
|
||||
REDIRECT *list;
|
||||
{
|
||||
REDIRECT *new_list = NULL;
|
||||
|
||||
while (list)
|
||||
{
|
||||
REDIRECT *temp = copy_redirect (list);
|
||||
temp->next = new_list;
|
||||
new_list = temp;
|
||||
list = list->next;
|
||||
}
|
||||
return ((REDIRECT *)reverse_list (new_list));
|
||||
}
|
||||
|
||||
FOR_COM *
|
||||
copy_for_command (com)
|
||||
FOR_COM *com;
|
||||
{
|
||||
FOR_COM *new_for = (FOR_COM *)xmalloc (sizeof (FOR_COM));
|
||||
new_for->flags = com->flags;
|
||||
new_for->name = copy_word (com->name);
|
||||
new_for->map_list = copy_word_list (com->map_list);
|
||||
new_for->action = copy_command (com->action);
|
||||
return (new_for);
|
||||
}
|
||||
|
||||
GROUP_COM *
|
||||
copy_group_command (com)
|
||||
GROUP_COM *com;
|
||||
{
|
||||
GROUP_COM *new_group = (GROUP_COM *)xmalloc (sizeof (GROUP_COM));
|
||||
|
||||
new_group->command = copy_command (com->command);
|
||||
return (new_group);
|
||||
}
|
||||
|
||||
CASE_COM *
|
||||
copy_case_command (com)
|
||||
CASE_COM *com;
|
||||
{
|
||||
CASE_COM *new_case = (CASE_COM *)xmalloc (sizeof (CASE_COM));
|
||||
|
||||
new_case->flags = com->flags;
|
||||
new_case->word = copy_word (com->word);
|
||||
new_case->clauses = copy_case_clauses (com->clauses);
|
||||
return (new_case);
|
||||
}
|
||||
|
||||
WHILE_COM *
|
||||
copy_while_command (com)
|
||||
WHILE_COM *com;
|
||||
{
|
||||
WHILE_COM *new_while = (WHILE_COM *)xmalloc (sizeof (WHILE_COM));
|
||||
|
||||
new_while->flags = com->flags;
|
||||
new_while->test = copy_command (com->test);
|
||||
new_while->action = copy_command (com->action);
|
||||
return (new_while);
|
||||
}
|
||||
|
||||
IF_COM *
|
||||
copy_if_command (com)
|
||||
IF_COM *com;
|
||||
{
|
||||
IF_COM *new_if = (IF_COM *)xmalloc (sizeof (IF_COM));
|
||||
|
||||
new_if->flags = com->flags;
|
||||
new_if->test = copy_command (com->test);
|
||||
new_if->true_case = copy_command (com->true_case);
|
||||
new_if->false_case = copy_command (com->false_case);
|
||||
return (new_if);
|
||||
}
|
||||
|
||||
SIMPLE_COM *
|
||||
copy_simple_command (com)
|
||||
SIMPLE_COM *com;
|
||||
{
|
||||
SIMPLE_COM *new_simple = (SIMPLE_COM *)xmalloc (sizeof (SIMPLE_COM));
|
||||
|
||||
new_simple->flags = com->flags;
|
||||
new_simple->words = copy_word_list (com->words);
|
||||
new_simple->redirects = copy_redirects (com->redirects);
|
||||
return (new_simple);
|
||||
}
|
||||
|
||||
FUNCTION_DEF *
|
||||
copy_function_def (com)
|
||||
FUNCTION_DEF *com;
|
||||
{
|
||||
FUNCTION_DEF *new_def = (FUNCTION_DEF *)xmalloc (sizeof (FUNCTION_DEF));
|
||||
|
||||
new_def->name = copy_word (com->name);
|
||||
new_def->command = copy_command (com->command);
|
||||
return (new_def);
|
||||
}
|
||||
|
||||
/* Copy the command structure in COMMAND. Return a pointer to the
|
||||
copy. Don't you forget to dispose_command () on this pointer
|
||||
later! */
|
||||
COMMAND *
|
||||
copy_command (command)
|
||||
COMMAND *command;
|
||||
{
|
||||
COMMAND *new_command = (COMMAND *)NULL;
|
||||
|
||||
if (command)
|
||||
{
|
||||
new_command = (COMMAND *)xmalloc (sizeof (COMMAND));
|
||||
bcopy (command, new_command, sizeof (COMMAND));
|
||||
new_command->flags = command->flags;
|
||||
|
||||
if (command->redirects)
|
||||
new_command->redirects = copy_redirects (command->redirects);
|
||||
|
||||
switch (command->type)
|
||||
{
|
||||
case cm_for:
|
||||
new_command->value.For = copy_for_command (command->value.For);
|
||||
break;
|
||||
|
||||
case cm_group:
|
||||
new_command->value.Group = copy_group_command (command->value.Group);
|
||||
break;
|
||||
|
||||
case cm_case:
|
||||
new_command->value.Case = copy_case_command (command->value.Case);
|
||||
break;
|
||||
|
||||
case cm_until:
|
||||
case cm_while:
|
||||
new_command->value.While = copy_while_command (command->value.While);
|
||||
break;
|
||||
|
||||
case cm_if:
|
||||
new_command->value.If = copy_if_command (command->value.If);
|
||||
break;
|
||||
|
||||
case cm_simple:
|
||||
new_command->value.Simple = copy_simple_command (command->value.Simple);
|
||||
break;
|
||||
|
||||
case cm_connection:
|
||||
{
|
||||
CONNECTION *new_connection;
|
||||
|
||||
new_connection = (CONNECTION *)xmalloc (sizeof (CONNECTION));
|
||||
new_connection->connector = command->value.Connection->connector;
|
||||
new_connection->first =
|
||||
copy_command (command->value.Connection->first);
|
||||
new_connection->second =
|
||||
copy_command (command->value.Connection->second);
|
||||
new_command->value.Connection = new_connection;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Pathological case. I'm not even sure that you can have a
|
||||
function definition as part of a function definition. */
|
||||
case cm_function_def:
|
||||
new_command->value.Function_def =
|
||||
copy_function_def (command->value.Function_def);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (new_command);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/* endian.h - Define BIG or LITTLE endian. */
|
||||
|
||||
/* This file was automatically created by `endian.aux'. You shouldn't
|
||||
edit this file, because your changes will be overwritten. Instead,
|
||||
edit the source code file `endian.c'. */
|
||||
|
||||
#if !defined (BIG_ENDIAN)
|
||||
# define BIG_ENDIAN
|
||||
#endif /* BIG_ENDIAN */
|
||||
@@ -1,97 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "shell.h"
|
||||
|
||||
COMMAND *global_command;
|
||||
int last_command_exit_value;
|
||||
int interrupt_state;
|
||||
int interactive = 1;
|
||||
int eof_encountered = 0;
|
||||
int exit_immediately_on_error = 1;
|
||||
|
||||
char *the_current_maintainer = "chet";
|
||||
|
||||
char *shell_name = "posix";
|
||||
|
||||
void
|
||||
throw_to_top_level()
|
||||
{
|
||||
}
|
||||
|
||||
char *
|
||||
base_pathname(s)
|
||||
char *s;
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
char *
|
||||
strerror(s)
|
||||
int s;
|
||||
{
|
||||
return ("error");
|
||||
}
|
||||
|
||||
parse_command ()
|
||||
{
|
||||
extern int need_here_doc, current_command_line_count;
|
||||
extern REDIRECT *redirection_needing_here_doc;
|
||||
int r;
|
||||
|
||||
need_here_doc = 0;
|
||||
redirection_needing_here_doc = (REDIRECT *)NULL;
|
||||
|
||||
current_command_line_count = 0;
|
||||
r = yyparse ();
|
||||
|
||||
if (need_here_doc)
|
||||
make_here_document (redirection_needing_here_doc);
|
||||
need_here_doc = 0;
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
with_input_from_stdin();
|
||||
|
||||
if (parse_command () == 0) {
|
||||
printf ("legal command in the Posix shell\n");
|
||||
exit (0);
|
||||
} else {
|
||||
printf ("illegal\n");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
string_quote_removal (s)
|
||||
{
|
||||
return (savestring (s));
|
||||
}
|
||||
|
||||
assignment (string)
|
||||
char *string;
|
||||
{
|
||||
register int c, index = 0;
|
||||
|
||||
c = string[index];
|
||||
|
||||
if (!isletter (c) && c != '_')
|
||||
return (0);
|
||||
|
||||
while (c = string[index])
|
||||
{
|
||||
/* The following is safe. Note that '=' at the start of a word
|
||||
is not an assignment statement. */
|
||||
if (c == '=')
|
||||
return (index);
|
||||
|
||||
if (!isletter (c) && !digit (c) && c != '_')
|
||||
return (0);
|
||||
|
||||
index++;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -1,596 +0,0 @@
|
||||
/* make_cmd.c --
|
||||
Functions for making instances of the various parser constructs. */
|
||||
|
||||
/* Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include "config.h"
|
||||
#include "general.h"
|
||||
#include "error.h"
|
||||
#include "command.h"
|
||||
#include "flags.h"
|
||||
#include "filecntl.h"
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
#include "jobs.h"
|
||||
#endif
|
||||
|
||||
extern GENERIC_LIST *reverse_list ();
|
||||
|
||||
WORD_DESC *
|
||||
make_word (string)
|
||||
char *string;
|
||||
{
|
||||
WORD_DESC *temp;
|
||||
|
||||
temp = (WORD_DESC *)xmalloc (sizeof (WORD_DESC));
|
||||
temp->word = savestring (string);
|
||||
temp->quoted = temp->dollar_present = temp->assignment = 0;
|
||||
|
||||
while (*string)
|
||||
{
|
||||
if (*string == '$') temp->dollar_present = 1;
|
||||
|
||||
if (member (*string, "'`\\\""))
|
||||
{
|
||||
temp->quoted = 1;
|
||||
if (*string == '\\')
|
||||
string++;
|
||||
}
|
||||
|
||||
if (*string)
|
||||
(string++);
|
||||
}
|
||||
return (temp);
|
||||
}
|
||||
|
||||
WORD_DESC *
|
||||
make_word_from_token (token)
|
||||
int token;
|
||||
{
|
||||
char tokenizer[2];
|
||||
|
||||
tokenizer[0] = token;
|
||||
tokenizer[1] = '\0';
|
||||
|
||||
return (make_word (tokenizer));
|
||||
}
|
||||
|
||||
WORD_LIST *
|
||||
make_word_list (word, link)
|
||||
WORD_DESC *word;
|
||||
WORD_LIST *link;
|
||||
{
|
||||
WORD_LIST *temp;
|
||||
|
||||
temp = (WORD_LIST *)xmalloc (sizeof (WORD_LIST));
|
||||
temp->word = word;
|
||||
temp->next = link;
|
||||
return (temp);
|
||||
}
|
||||
|
||||
WORD_LIST *
|
||||
add_string_to_list (string, list)
|
||||
char *string;
|
||||
WORD_LIST *list;
|
||||
{
|
||||
WORD_LIST *temp = (WORD_LIST *)xmalloc (sizeof (WORD_LIST));
|
||||
temp->word = make_word (string);
|
||||
temp->next = list;
|
||||
return (temp);
|
||||
}
|
||||
|
||||
WORD_DESC *
|
||||
coerce_to_word (number)
|
||||
int number;
|
||||
{
|
||||
char string[24];
|
||||
|
||||
sprintf (string, "%d", number);
|
||||
return (make_word (string));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_command (type, pointer)
|
||||
enum command_type type;
|
||||
SIMPLE_COM *pointer;
|
||||
{
|
||||
COMMAND *temp;
|
||||
|
||||
temp = (COMMAND *)xmalloc (sizeof (COMMAND));
|
||||
temp->type = type;
|
||||
temp->value.Simple = pointer;
|
||||
temp->value.Simple->flags = 0;
|
||||
temp->flags = 0;
|
||||
temp->redirects = (REDIRECT *)NULL;
|
||||
return (temp);
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
command_connect (com1, com2, connector)
|
||||
COMMAND *com1, *com2;
|
||||
int connector;
|
||||
{
|
||||
CONNECTION *temp;
|
||||
|
||||
temp = (CONNECTION *)xmalloc (sizeof (CONNECTION));
|
||||
temp->connector = connector;
|
||||
temp->first = com1;
|
||||
temp->second = com2;
|
||||
return (make_command (cm_connection, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_for_command (name, map_list, action)
|
||||
WORD_DESC *name;
|
||||
WORD_LIST *map_list;
|
||||
COMMAND *action;
|
||||
{
|
||||
FOR_COM *temp = (FOR_COM *)xmalloc (sizeof (FOR_COM));
|
||||
|
||||
temp->flags = 0;
|
||||
temp->name = name;
|
||||
temp->map_list = map_list;
|
||||
temp->action = action;
|
||||
return (make_command (cm_for, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_group_command (command)
|
||||
COMMAND *command;
|
||||
{
|
||||
GROUP_COM *temp = (GROUP_COM *)xmalloc (sizeof (GROUP_COM));
|
||||
|
||||
temp->command = command;
|
||||
return (make_command (cm_group, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_case_command (word, clauses)
|
||||
WORD_DESC *word;
|
||||
PATTERN_LIST *clauses;
|
||||
{
|
||||
CASE_COM *temp;
|
||||
|
||||
temp = (CASE_COM *)xmalloc (sizeof (CASE_COM));
|
||||
temp->flags = 0;
|
||||
temp->word = word;
|
||||
temp->clauses = (PATTERN_LIST *)reverse_list (clauses);
|
||||
return (make_command (cm_case, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
PATTERN_LIST *
|
||||
make_pattern_list (patterns, action)
|
||||
WORD_LIST *patterns;
|
||||
COMMAND *action;
|
||||
{
|
||||
PATTERN_LIST *temp;
|
||||
|
||||
temp = (PATTERN_LIST *)xmalloc (sizeof (PATTERN_LIST));
|
||||
temp->patterns = patterns;
|
||||
temp->action = action;
|
||||
temp->next = NULL;
|
||||
return (temp);
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_if_command (test, true_case, false_case)
|
||||
COMMAND *test, *true_case, *false_case;
|
||||
{
|
||||
IF_COM *temp;
|
||||
|
||||
temp = (IF_COM *)xmalloc (sizeof (IF_COM));
|
||||
temp->flags = 0;
|
||||
temp->test = test;
|
||||
temp->true_case = true_case;
|
||||
temp->false_case = false_case;
|
||||
return (make_command (cm_if, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_until_or_while (test, action, which)
|
||||
COMMAND *test, *action;
|
||||
enum command_type which;
|
||||
{
|
||||
WHILE_COM *temp;
|
||||
|
||||
temp = (WHILE_COM *)xmalloc (sizeof (WHILE_COM));
|
||||
temp->flags = 0;
|
||||
temp->test = test;
|
||||
temp->action = action;
|
||||
return (make_command (which, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_while_command (test, action)
|
||||
COMMAND *test, *action;
|
||||
{
|
||||
return (make_until_or_while (test, action, cm_while));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_until_command (test, action)
|
||||
COMMAND *test, *action;
|
||||
{
|
||||
return (make_until_or_while (test, action, cm_until));
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_bare_simple_command ()
|
||||
{
|
||||
COMMAND *command;
|
||||
SIMPLE_COM *temp = (SIMPLE_COM *)xmalloc (sizeof (SIMPLE_COM));
|
||||
|
||||
temp->flags = 0;
|
||||
temp->words = (WORD_LIST *)NULL;
|
||||
temp->redirects = (REDIRECT *)NULL;
|
||||
command = (COMMAND *)xmalloc (sizeof (COMMAND));
|
||||
command->type = cm_simple;
|
||||
command->redirects = (REDIRECT *)NULL;
|
||||
command->flags = 0;
|
||||
command->value.Simple = temp;
|
||||
return (command);
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
new_make_simple_command (word, prefix, suffix)
|
||||
WORD_DESC *word;
|
||||
ELEMENT *prefix;
|
||||
ELEMENT *suffix;
|
||||
{
|
||||
/* Make a list of words and redirects from WORD, PREFIX, and SUFFIX. */
|
||||
WORD_LIST *w = (WORD_LIST *)NULL;
|
||||
REDIRECT *r = (REDIRECT *)NULL;
|
||||
COMMAND *ret;
|
||||
SIMPLE_COM *sc;
|
||||
register ELEMENT *te;
|
||||
|
||||
ret = make_bare_simple_command ();
|
||||
sc = ret->value.Simple;
|
||||
|
||||
te = prefix;
|
||||
while (te)
|
||||
{
|
||||
ELEMENT *t2;
|
||||
if (te->redirect)
|
||||
{
|
||||
te->redirect->next = r;
|
||||
r->next = te->redirect;
|
||||
}
|
||||
else if (te->word)
|
||||
{
|
||||
WORD_LIST *twl = make_word_list (te->word, (WORD_LIST *)NULL);
|
||||
twl->next = w;
|
||||
w = twl;
|
||||
}
|
||||
t2 = te;
|
||||
te = te->next;
|
||||
free (t2);
|
||||
}
|
||||
|
||||
if (word)
|
||||
{
|
||||
WORD_LIST *twl = make_word_list (word, (WORD_LIST *)NULL);
|
||||
twl->next = w;
|
||||
w = twl;
|
||||
}
|
||||
|
||||
te = suffix;
|
||||
while (te)
|
||||
{
|
||||
ELEMENT *t2;
|
||||
if (te->redirect)
|
||||
{
|
||||
te->redirect->next = r;
|
||||
r->next = te->redirect;
|
||||
}
|
||||
else if (te->word)
|
||||
{
|
||||
WORD_LIST *twl = make_word_list (te->word, (WORD_LIST *)NULL);
|
||||
twl->next = w;
|
||||
w = twl;
|
||||
}
|
||||
t2 = te;
|
||||
te = te->next;
|
||||
free (t2);
|
||||
}
|
||||
|
||||
sc->words = (WORD_LIST *)reverse_list (w);
|
||||
sc->redirects = (REDIRECT *)reverse_list (r);
|
||||
sc->flags = 0;
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* Return a command which is the connection of the word or redirection
|
||||
in ELEMENT, and the command * or NULL in COMMAND. */
|
||||
COMMAND *
|
||||
make_simple_command (element, command)
|
||||
ELEMENT element;
|
||||
COMMAND *command;
|
||||
{
|
||||
/* If we are starting from scratch, then make the initial command
|
||||
structure. Also note that we have to fill in all the slots, since
|
||||
malloc doesn't return zeroed space. */
|
||||
if (!command)
|
||||
command = make_bare_simple_command ();
|
||||
|
||||
if (element.word)
|
||||
{
|
||||
WORD_LIST *tw = (WORD_LIST *)xmalloc (sizeof (WORD_LIST));
|
||||
tw->word = element.word;
|
||||
tw->next = command->value.Simple->words;
|
||||
command->value.Simple->words = tw;
|
||||
}
|
||||
else
|
||||
{
|
||||
REDIRECT *r = element.redirect;
|
||||
/* Due to the way <> is implemented, there may be more than a single
|
||||
redirection in element.redirect. We just follow the chain as far
|
||||
as it goes, and hook onto the end. */
|
||||
while (r->next)
|
||||
r = r->next;
|
||||
r->next = command->value.Simple->redirects;
|
||||
command->value.Simple->redirects = element.redirect;
|
||||
}
|
||||
return (command);
|
||||
}
|
||||
|
||||
#define POSIX_HERE_DOCUMENTS
|
||||
make_here_document (temp)
|
||||
REDIRECT *temp;
|
||||
{
|
||||
int kill_leading = 0;
|
||||
|
||||
switch (temp->instruction)
|
||||
{
|
||||
/* Because we are Bourne compatible, we read the input for this
|
||||
<< or <<- redirection now, from wherever input is coming from.
|
||||
We store the input read into a WORD_DESC. Replace the text of
|
||||
the redirectee.word with the new input text. If <<- is on,
|
||||
then remove leading TABS from each line. */
|
||||
|
||||
case r_deblank_reading_until: /* <<-foo */
|
||||
kill_leading++;
|
||||
/* ... */
|
||||
case r_reading_until: /* <<foo */
|
||||
{
|
||||
extern char *redirection_expand ();
|
||||
extern char *string_quote_removal ();
|
||||
char *redirectee_word;
|
||||
int len;
|
||||
|
||||
char *document = (char *)NULL;
|
||||
int document_index = 0, document_size = 0;
|
||||
|
||||
#if !defined (POSIX_HERE_DOCUMENTS)
|
||||
/* Because of Bourne shell semantics, we turn off globbing, but
|
||||
only for this style of redirection. I feel a little ill. */
|
||||
{
|
||||
extern int disallow_filename_globbing;
|
||||
int old_value = disallow_filename_globbing;
|
||||
disallow_filename_globbing = 1;
|
||||
|
||||
redirectee_word = redirection_expand (temp->redirectee.filename);
|
||||
|
||||
disallow_filename_globbing = old_value;
|
||||
}
|
||||
#else /* POSIX_HERE_DOCUMENTS */
|
||||
/* Quote removal is the only expansion performed on the delimiter
|
||||
for here documents, making it an extremely special case. I
|
||||
still feel ill. */
|
||||
redirectee_word =
|
||||
string_quote_removal (temp->redirectee.filename->word, 0);
|
||||
#endif /* POSIX_HERE_DOCUMENTS */
|
||||
|
||||
/* redirection_expand will return NULL if the expansion results in
|
||||
multiple words or no words. Check for that here, and just abort
|
||||
this here document if it does. */
|
||||
if (redirectee_word)
|
||||
len = strlen (redirectee_word);
|
||||
else
|
||||
{
|
||||
temp->here_doc_eof = savestring ("");
|
||||
goto document_done;
|
||||
}
|
||||
|
||||
free (temp->redirectee.filename->word);
|
||||
temp->here_doc_eof = redirectee_word;
|
||||
|
||||
/* Read lines from wherever lines are coming from.
|
||||
For each line read, if kill_leading, then kill the
|
||||
leading tab characters.
|
||||
If the line matches redirectee_word exactly, then we have
|
||||
manufactured the document. Otherwise, add the line to the
|
||||
list of lines in the document. */
|
||||
{
|
||||
extern char *read_secondary_line ();
|
||||
char *line;
|
||||
int l;
|
||||
|
||||
while (line = read_secondary_line ())
|
||||
{
|
||||
if (!line)
|
||||
goto document_done;
|
||||
|
||||
if (kill_leading)
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* Hack: To be compatible with some Bourne shells, we
|
||||
check the word before stripping the whitespace. This
|
||||
is a hack, though. */
|
||||
if ((strncmp (line, redirectee_word, len) == 0) &&
|
||||
line[len] == '\n')
|
||||
goto document_done;
|
||||
|
||||
for (i = 0; line[i] == '\t'; i++)
|
||||
;
|
||||
|
||||
if (i)
|
||||
strcpy (&line[0], &line[i]);
|
||||
}
|
||||
|
||||
if ((strncmp (line, redirectee_word, len) == 0) &&
|
||||
line[len] == '\n')
|
||||
goto document_done;
|
||||
|
||||
l = strlen (line);
|
||||
if (l + document_index >= document_size)
|
||||
{
|
||||
document = (char *)
|
||||
xrealloc (document, (document_size += (10 * l)));
|
||||
}
|
||||
|
||||
if (l != 0)
|
||||
{
|
||||
strcpy (&document[document_index], line);
|
||||
free (line);
|
||||
document_index += l;
|
||||
}
|
||||
}
|
||||
document_done:
|
||||
if (!document)
|
||||
document = savestring ("");
|
||||
temp->redirectee.filename->word = document;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate a REDIRECT from SOURCE, DEST, and INSTRUCTION.
|
||||
INSTRUCTION is the instruction type, SOURCE is an INT,
|
||||
and DEST is an INT or a WORD_DESC *. */
|
||||
REDIRECT *
|
||||
make_redirection (source, instruction, dest)
|
||||
enum r_instruction instruction;
|
||||
{
|
||||
REDIRECT *temp = (REDIRECT *)xmalloc (sizeof (REDIRECT));
|
||||
|
||||
/* First do the common cases. */
|
||||
temp->redirector = source;
|
||||
temp->redirectee.dest = dest;
|
||||
temp->instruction = instruction;
|
||||
temp->next = (REDIRECT *)NULL;
|
||||
|
||||
switch (instruction)
|
||||
{
|
||||
|
||||
case r_output_direction: /* >foo */
|
||||
case r_output_force: /* >| foo */
|
||||
temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
|
||||
break;
|
||||
|
||||
case r_input_direction: /* <foo */
|
||||
case r_inputa_direction: /* foo & makes this. */
|
||||
temp->flags = O_RDONLY;
|
||||
break;
|
||||
|
||||
case r_appending_to: /* >>foo */
|
||||
temp->flags = O_APPEND | O_WRONLY | O_CREAT;
|
||||
break;
|
||||
|
||||
case r_deblank_reading_until: /* <<-foo */
|
||||
case r_reading_until: /* << foo */
|
||||
break;
|
||||
|
||||
case r_duplicating_input: /* 1<&2 */
|
||||
case r_duplicating_output: /* 1>&2 */
|
||||
case r_close_this: /* <&- */
|
||||
case r_duplicating_input_word: /* 1<&$foo */
|
||||
case r_duplicating_output_word: /* 1>&$foo */
|
||||
break;
|
||||
|
||||
case r_err_and_out: /* command &>filename */
|
||||
temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
|
||||
break;
|
||||
|
||||
case r_input_output:
|
||||
temp->flags = O_RDWR;
|
||||
break;
|
||||
|
||||
default:
|
||||
programming_error ("Redirection instruction from yyparse () '%d' is\n\
|
||||
out of range in make_redirection ().", instruction);
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
return (temp);
|
||||
}
|
||||
|
||||
COMMAND *
|
||||
make_function_def (name, command)
|
||||
WORD_DESC *name;
|
||||
COMMAND *command;
|
||||
{
|
||||
FUNCTION_DEF *temp;
|
||||
|
||||
temp = (FUNCTION_DEF *)xmalloc (sizeof (FUNCTION_DEF));
|
||||
temp->command = command;
|
||||
temp->name = name;
|
||||
return (make_command (cm_function_def, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
/* Reverse the word list and redirection list in the simple command
|
||||
has just been parsed. It seems simpler to do this here the one
|
||||
time then by any other method that I can think of. */
|
||||
COMMAND *
|
||||
clean_simple_command (command)
|
||||
COMMAND *command;
|
||||
{
|
||||
extern GENERIC_LIST *reverse_list ();
|
||||
|
||||
if (command->type != cm_simple)
|
||||
{
|
||||
programming_error
|
||||
("clean_simple_command () got a command with type %d.", command->type);
|
||||
}
|
||||
else
|
||||
{
|
||||
command->value.Simple->words =
|
||||
(WORD_LIST *)reverse_list (command->value.Simple->words);
|
||||
command->value.Simple->redirects =
|
||||
(REDIRECT *)reverse_list (command->value.Simple->redirects);
|
||||
}
|
||||
|
||||
return (command);
|
||||
}
|
||||
|
||||
/* Cons up a new array of words. The words are taken from LIST,
|
||||
which is a WORD_LIST *. Absolutely everything is malloc'ed,
|
||||
so you should free everything in this array when you are done.
|
||||
The array is NULL terminated. */
|
||||
char **
|
||||
make_word_array (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int count = list_length (list);
|
||||
char **array = (char **)xmalloc ((1 + count) * sizeof (char *));
|
||||
|
||||
for (count = 0; list; count++)
|
||||
{
|
||||
array[count] = (char *)xmalloc (1 + strlen (list->word->word));
|
||||
strcpy (array[count], list->word->word);
|
||||
list = list->next;
|
||||
}
|
||||
array[count] = (char *)NULL;
|
||||
return (array);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,71 +0,0 @@
|
||||
/* shell.h -- The data structures used by the shell */
|
||||
|
||||
#include "config.h"
|
||||
#include "general.h"
|
||||
#include "error.h"
|
||||
#include "variables.h"
|
||||
#include "quit.h"
|
||||
#include "maxpath.h"
|
||||
#include "unwind_prot.h"
|
||||
#include "command.h"
|
||||
|
||||
extern int EOF_Reached;
|
||||
|
||||
#define NO_PIPE -1
|
||||
#define REDIRECT_BOTH -2
|
||||
#define IS_DESCRIPTOR -1
|
||||
|
||||
#define NO_VARIABLE -1
|
||||
|
||||
/* A bunch of stuff for flow of control using setjmp () and longjmp (). */
|
||||
#include <setjmp.h>
|
||||
extern jmp_buf top_level, catch;
|
||||
|
||||
#define NOT_JUMPED 0 /* Not returning from a longjmp. */
|
||||
#define FORCE_EOF 1 /* We want to stop parsing. */
|
||||
#define DISCARD 2 /* Discard current command. */
|
||||
#define EXITPROG 3 /* Unconditionally exit the program now. */
|
||||
|
||||
/* Values that can be returned by execute_command (). */
|
||||
#define EXECUTION_FAILURE 1
|
||||
#define EXECUTION_SUCCESS 0
|
||||
|
||||
/* Special exit status used when the shell is asked to execute a
|
||||
binary file as a shell script. */
|
||||
#define EX_BINARY_FILE 126
|
||||
|
||||
/* The list of characters that are quoted in double-quotes with a
|
||||
backslash. Other characters following a backslash cause nothing
|
||||
special to happen. */
|
||||
#define slashify_in_quotes "\\`$\""
|
||||
#define slashify_in_here_document "\\`$"
|
||||
|
||||
/* Constants which specify how to handle backslashes and quoting in
|
||||
expand_word_internal (). Q_DOUBLE_QUOTES means to use the function
|
||||
slashify_in_quotes () to decide whether the backslash should be
|
||||
retained. Q_HERE_DOCUMENT means slashify_in_here_document () to
|
||||
decide whether to retain the backslash. Q_KEEP_BACKSLASH means
|
||||
to unconditionally retain the backslash. */
|
||||
#define Q_DOUBLE_QUOTES 0x1
|
||||
#define Q_HERE_DOCUMENT 0x2
|
||||
#define Q_KEEP_BACKSLASH 0x4
|
||||
|
||||
extern char **shell_environment;
|
||||
extern WORD_LIST *rest_of_args;
|
||||
|
||||
/* Generalized global variables. */
|
||||
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. */
|
||||
struct fd_bitmap {
|
||||
long size;
|
||||
char *bitmap;
|
||||
};
|
||||
|
||||
#define FD_BITMAP_SIZE 32
|
||||
|
||||
#if defined (EIGHT_BIT)
|
||||
# define CTLESC '\001'
|
||||
# define CTLNUL '\002'
|
||||
#endif /* EIGHT_BIT */
|
||||
@@ -1,294 +0,0 @@
|
||||
/* I can't stand it anymore! Please can't we just write the
|
||||
whole Unix system in lisp or something? */
|
||||
|
||||
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Unwind Protection Scheme for Bash */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include "config.h"
|
||||
#include "general.h"
|
||||
#include "unwind_prot.h"
|
||||
|
||||
/* If CLEANUP is null, then ARG contains a tag to throw back to. */
|
||||
typedef struct _uwp {
|
||||
struct _uwp *next;
|
||||
Function *cleanup;
|
||||
char *arg;
|
||||
} UNWIND_ELT;
|
||||
|
||||
static void
|
||||
unwind_frame_discard_internal (), unwind_frame_run_internal (),
|
||||
add_unwind_protect_internal (), remove_unwind_protect_internal (),
|
||||
run_unwind_protects_internal ();
|
||||
|
||||
static UNWIND_ELT *unwind_protect_list = (UNWIND_ELT *)NULL;
|
||||
|
||||
/* Run a function without interrupts. */
|
||||
void
|
||||
without_interrupts (function, arg1, arg2)
|
||||
VFunction *function;
|
||||
char *arg1, *arg2;
|
||||
{
|
||||
#if defined (_POSIX_VERSION)
|
||||
static int sets_done = 0;
|
||||
static sigset_t set;
|
||||
sigset_t oset;
|
||||
|
||||
/* SET needs to be initialized only once. */
|
||||
if (sets_done == 0)
|
||||
{
|
||||
sigemptyset (&set);
|
||||
sigaddset (&set, SIGINT);
|
||||
sets_done = 1;
|
||||
}
|
||||
sigemptyset (&oset);
|
||||
|
||||
sigprocmask (SIG_BLOCK, &set, &oset);
|
||||
#else
|
||||
# if defined (USG)
|
||||
SigHandler *old_int;
|
||||
|
||||
old_int = (SigHandler *)signal (SIGINT, SIG_IGN);
|
||||
# else
|
||||
int oldmask = sigblock (SIGINT);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
(*function)(arg1, arg2);
|
||||
|
||||
#if defined (_POSIX_VERSION)
|
||||
sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
|
||||
#else
|
||||
# if defined (USG)
|
||||
signal (SIGINT, old_int);
|
||||
# else
|
||||
sigsetmask (oldmask);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Start the beginning of a region. */
|
||||
void
|
||||
begin_unwind_frame (tag)
|
||||
char *tag;
|
||||
{
|
||||
add_unwind_protect ((Function *)NULL, tag);
|
||||
}
|
||||
|
||||
/* Discard the unwind protects back to TAG. */
|
||||
void
|
||||
discard_unwind_frame (tag)
|
||||
char *tag;
|
||||
{
|
||||
if (unwind_protect_list)
|
||||
without_interrupts (unwind_frame_discard_internal, tag, (char *)NULL);
|
||||
}
|
||||
|
||||
/* Run the unwind protects back to TAG. */
|
||||
void
|
||||
run_unwind_frame (tag)
|
||||
char *tag;
|
||||
{
|
||||
if (unwind_protect_list)
|
||||
without_interrupts (unwind_frame_run_internal, tag, (char *)NULL);
|
||||
}
|
||||
|
||||
/* Add the function CLEANUP with ARG to the list of unwindable things. */
|
||||
void
|
||||
add_unwind_protect (cleanup, arg)
|
||||
Function *cleanup;
|
||||
char *arg;
|
||||
{
|
||||
without_interrupts (add_unwind_protect_internal, (char *)cleanup, arg);
|
||||
}
|
||||
|
||||
/* Remove the top unwind protect from the list. */
|
||||
void
|
||||
remove_unwind_protect ()
|
||||
{
|
||||
if (unwind_protect_list)
|
||||
without_interrupts
|
||||
(remove_unwind_protect_internal, (char *)NULL, (char *)NULL);
|
||||
}
|
||||
|
||||
/* Run the list of cleanup functions in unwind_protect_list. */
|
||||
void
|
||||
run_unwind_protects ()
|
||||
{
|
||||
if (unwind_protect_list)
|
||||
without_interrupts
|
||||
(run_unwind_protects_internal, (char *)NULL, (char *)NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* The Actual Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static void
|
||||
add_unwind_protect_internal (cleanup, arg)
|
||||
Function *cleanup;
|
||||
char *arg;
|
||||
{
|
||||
UNWIND_ELT *elt;
|
||||
|
||||
elt = (UNWIND_ELT *)xmalloc (sizeof (UNWIND_ELT));
|
||||
elt->cleanup = cleanup;
|
||||
elt->arg = arg;
|
||||
elt->next = unwind_protect_list;
|
||||
unwind_protect_list = elt;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_unwind_protect_internal ()
|
||||
{
|
||||
UNWIND_ELT *elt = unwind_protect_list;
|
||||
|
||||
if (elt)
|
||||
{
|
||||
unwind_protect_list = unwind_protect_list->next;
|
||||
free (elt);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
run_unwind_protects_internal ()
|
||||
{
|
||||
UNWIND_ELT *t, *elt = unwind_protect_list;
|
||||
|
||||
while (elt)
|
||||
{
|
||||
/* This function can be run at strange times, like when unwinding
|
||||
the entire world of unwind protects. Thus, we may come across
|
||||
an element which is simply a label for a catch frame. Don't call
|
||||
the non-existant function. */
|
||||
if (elt->cleanup)
|
||||
(*(elt->cleanup)) (elt->arg);
|
||||
|
||||
t = elt;
|
||||
elt = elt->next;
|
||||
free (t);
|
||||
}
|
||||
unwind_protect_list = elt;
|
||||
}
|
||||
|
||||
static void
|
||||
unwind_frame_discard_internal (tag)
|
||||
char *tag;
|
||||
{
|
||||
UNWIND_ELT *elt;
|
||||
|
||||
while (elt = unwind_protect_list)
|
||||
{
|
||||
unwind_protect_list = unwind_protect_list->next;
|
||||
if (!elt->cleanup && (STREQ (elt->arg, tag)))
|
||||
{
|
||||
free (elt);
|
||||
break;
|
||||
}
|
||||
else
|
||||
free (elt);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unwind_frame_run_internal (tag)
|
||||
char *tag;
|
||||
{
|
||||
UNWIND_ELT *elt;
|
||||
|
||||
while (elt = unwind_protect_list)
|
||||
{
|
||||
unwind_protect_list = elt->next;
|
||||
|
||||
/* If tag, then compare. */
|
||||
if (!elt->cleanup)
|
||||
{
|
||||
if (STREQ (elt->arg, tag))
|
||||
{
|
||||
free (elt);
|
||||
break;
|
||||
}
|
||||
free (elt);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*(elt->cleanup)) (elt->arg);
|
||||
free (elt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Structure describing a saved variable and the value to restore it to. */
|
||||
typedef struct {
|
||||
int *variable;
|
||||
char *desired_setting;
|
||||
int size;
|
||||
} SAVED_VAR;
|
||||
|
||||
/* Restore the value of a variable, based on the contents of SV. If
|
||||
sv->size is greater than sizeof (int), sv->desired_setting points to
|
||||
a block of memory SIZE bytes long holding the value, rather than the
|
||||
value itself. This block of memory is copied back into the variable. */
|
||||
static void
|
||||
restore_variable (sv)
|
||||
SAVED_VAR *sv;
|
||||
{
|
||||
if (sv->size > sizeof (int))
|
||||
{
|
||||
bcopy ((char *)sv->desired_setting, (char *)sv->variable, sv->size);
|
||||
free (sv->desired_setting);
|
||||
}
|
||||
else
|
||||
*(sv->variable) = (int)sv->desired_setting;
|
||||
|
||||
free (sv);
|
||||
}
|
||||
|
||||
/* Save the value of a variable so it will be restored when unwind-protects
|
||||
are run. VAR is a pointer to the variable. VALUE is the value to be
|
||||
saved. SIZE is the size in bytes of VALUE. If SIZE is bigger than what
|
||||
can be saved in an int, memory will be allocated and the value saved
|
||||
into that using bcopy (). */
|
||||
void
|
||||
unwind_protect_var (var, value, size)
|
||||
int *var;
|
||||
char *value;
|
||||
int size;
|
||||
{
|
||||
SAVED_VAR *s = (SAVED_VAR *)xmalloc (sizeof (SAVED_VAR));
|
||||
|
||||
s->variable = var;
|
||||
if (size > sizeof (int))
|
||||
{
|
||||
s->desired_setting = (char *)xmalloc (size);
|
||||
bcopy (value, (char *)s->desired_setting, size);
|
||||
}
|
||||
else
|
||||
s->desired_setting = value;
|
||||
s->size = size;
|
||||
add_unwind_protect ((Function *)restore_variable, (char *)s);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
char *progname;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
unsigned long int length;
|
||||
|
||||
length = 0;
|
||||
progname = argv[0];
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "%s: must be given a duration\n", progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
length = strtol(argv[1], NULL, 10);
|
||||
if (length == LONG_MAX) {
|
||||
fprintf(stderr, "%s: number is too large: %s\n", progname, argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
usleep(length);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user