Commit Graph

89 Commits

Author SHA1 Message Date
steve
f781548b1d Reorder declarations slightly. 1997-04-28 03:17:51 +00:00
steve
1da8ca45aa Avoid a possible NULL pointer dereference, nuke register usage,
and remove an unnecessary reset.

Obtained from: NetBSD
1997-04-28 03:16:12 +00:00
steve
a503bbc21f Nuke register keyword usage, #if -> #ifdef, and avoid void *
arithmetic.

Obtained from: NetBSD
1997-04-28 03:14:04 +00:00
steve
6ce1ec6c04 Nuke register keyword usage, rename pread to preadfd, and open
input files FD_CLOEXEC.

Obtained from: NetBSD
1997-04-28 03:11:52 +00:00
steve
101652d621 When NO_HISTORY is defined and the history command is used
show an error message.

Inspired by: NetBSD
1997-04-28 03:10:31 +00:00
steve
d13866ebb9 Add a type builtin and nuke register keyword usage.
Obtained from: NetBSD
1997-04-28 03:08:38 +00:00
steve
2b784fa564 Nuke register keyword usage and #if -> #ifdef.
Obtained from: NetBSD
1997-04-28 03:06:52 +00:00
steve
9c7a4e1848 Shamelessly pilfer most of NetBSD's Makefile so that the
problem with 'make -j n' and no .depend file goes away.
I think Bruce mentioned this somewhere on one of the
mailing lists.

Obtained from: NetBSD
1997-04-28 03:03:23 +00:00
imp
054f35c222 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-28 15:24:41 +00:00
peter
83b3c2c161 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
steve
45d17b0093 Fix a expansion bug that caused the result of echo $((1 << 30))
to get truncated.

Submitted by: bde
1997-02-16 01:54:19 +00:00
jkh
808a36ef65 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
steve
774419801b Fix a problem that caused some foreground pipelines to die with:
tcsetpgrp failed, errno=1

Discovered and Reviewed by: joerg
1997-01-06 01:26:44 +00:00
steve
5936b56fef Make sh(1) think and be in the same place at the same time. This closes
PR#2331: strange output of sh's pwd on symlinked directories.
1997-01-04 19:14:29 +00:00
steve
3d5f13bf93 With these changes sh(1)'s trap command should be POSIX-compliant,
while remaining (becoming :) compatible with other popular shells.
Specifically these changes include:

1) Implement 'trap -l' to get a list of valid signals names.  This
   is useful if you wanted to do something like reset all signal
   handlers to there defaults values, in which case something like
   this will do the trick.

	trap `trap -l`

2) Reformat the output of 'trap' so it can be saved and later eval'd
   to restore the saved settings.

3) Allow the use of signal names as well as signal numbers.

4) Fix trap handling of SIGCHLD so that commands like the following
   (albeit, contrived) won't cause sh(1) to recurse ad infinitum.

	trap uname 0 20

5) Make variables static that are used only in trap.c.

6) Minor 'style(9) police' mods.
1996-12-24 23:59:53 +00:00
steve
dfe5d3d364 Oops, it needs little more caulk to get it right. 1996-12-23 22:29:03 +00:00
steve
6da76fc1dd Apply a little dab of bit caulk to keep those beggars
from leaking out.

Noticed by: bde
1996-12-23 22:16:35 +00:00
steve
c9faf62a80 Don't use _POSIX_PATH_MAX to limit the size of the path, instead
use 'getcwd(NULL, 0)' just as pwd(1) does.

Suggested by: bde
1996-12-23 05:31:48 +00:00
steve
cd89de39c0 Make sh(1) a little braver in the face of adversity. sh(1)
now handles the getpwd() init problem the same way as bash
and ksh do.  Also while I was in here, I cleaned up the format
a little, removed some unnnecessary #if SYMLINKS cruft, and
changed the pwd builtin to use getcwd(3) as Joerg suggested.
1996-12-21 22:09:40 +00:00
steve
705d04d9c4 This doesn't change any behavior, but may be a slight
optimization.  (num-- > 0) --> (--num >= 0).

Obtained from: NetBSD
1996-12-21 15:16:32 +00:00
steve
1b5cb4ee0a Remove extra #undef. 1996-12-21 14:57:38 +00:00
steve
f831af1d64 Fix a problem caused by finger failure on my part. The builtin
getopts should now work as expected.  This fix was in the NetBSD
code that I was merging from but missed getting into FreeBSD's
version because of 'drain bamage' on my part.

Submitted by:	NetBSD, joerg
1996-12-21 13:21:57 +00:00
steve
c58aca035e Merge in NetBSD mods and -Wall cleaning.
Obtained from: NetBSD, me
1996-12-14 06:20:03 +00:00
peter
5ec5b27841 Back out rev 1.7 which was to fix PR#1206 (to be reopened).
This patch causes too many side effects, one of which bites hard is
when interrupting a 'make fetch' in the ports tree (PR#1990).
This whole area is a real can of worms....

This most definately should go into 2.2

Reviewed by: steve, bde
1996-11-12 18:35:06 +00:00
ache
3bd90e16be 1) define STATIC as static and not empty
2) replace collate_range_cmp call with its code
1996-10-31 07:15:57 +00:00
steve
ac82f35222 Add the -p (privileged) commandline switch
found in bash, zsh, and friends.

Reviewed by: joerg
1996-10-29 03:12:51 +00:00
bde
e638a9f05e Build intermediate object files for mkinit, mknodes and mksyntax
so that simple regresssion tests based on `cmp' work.  mkdep still
doesn't work right for these tools.  They should probably be in
separate directories.

Sorted dependencies.
1996-10-25 14:49:24 +00:00
steve
0fef6071c4 Close PR# 1206. sh(1) now ignores SIGINT and SIGQUIT
when a child is forked and the -c commandline switch
has been specified.

Reviewed by: joerg
1996-10-22 03:02:07 +00:00
steve
0b67136d65 Benign | --> || correction. 1996-10-16 02:30:39 +00:00
steve
b5b97925c5 Fix a problem with sh that conflicts with the -e
flag text in the man page.  Now this will work
correctly:

	/bin/sh -ec 'false && true; echo hi'

Obtained from: VaX#n8 <vax@linkdead.paranoia.com>
1996-10-06 15:17:19 +00:00
peter
943436c3c8 re-activate the printf builtin now that src/usr.bin/printf.c has been
tweaked to work as a builtin better (ie: calls the real printf formatting
code, not sh's cut-down out1fmt() function)
1996-10-01 04:59:13 +00:00
adam
ee00aff02c Mend 'exit' without breaking 'exit 1'
*blush* %-\

Pointed out by: bruce
1996-09-12 12:41:46 +00:00
bde
073456f615 Backed out last change. It broke even `exit 1'. 1996-09-12 02:23:33 +00:00
peter
614a655c28 Ok, lets try this again, shall we? It was definatly my mistake, not
Steve's.. :-]
1996-09-10 02:42:33 +00:00
peter
3d58e0bf86 ack! back these out so I can see what I did wrong. It looks like a
patch-by-hand botch, but it sig-11's during make world.
1996-09-10 02:07:27 +00:00
peter
aae29b5fef Fix for PR#1248, sh doesn't expand past ${9}
Submitted by: Steve Price <sprice@hiwaay.net>
1996-09-10 01:24:11 +00:00
adam
84c0874422 let the "exit" command return status when it is implicit 1996-09-08 03:12:22 +00:00
peter
ad9b91037f eek, how did that happen? I must have committed something left over from
when I was experimenting looking for an alternate format.  *blush*
1996-09-03 14:24:44 +00:00
peter
0475c084c2 Fix for PR#1287. This makes sh behave sensibly in case statements in the
face of aliases.  Note, bash doesn't do aliases while running scripts, but
"real" ksh does..

Also:
  Reduce redundant .Nm macros in (unused) bltin/echo.1
  nuke error2, it's hardly used.
  More -Wall cleanups
  dont do certain history operations if NO_HISTORY defined
  handle quad_t's from resource limits

Submitted by: Steve Price <sprice@hiwaay.net>  (minor tweaks by me)
1996-09-03 14:16:06 +00:00
peter
0692a293b6 Misc cleanups and fixes from Bruce:
- don't put \n on error() calls, error adds it already.
 - don't prepend "ulimit" on error() calls in miscbltin.c.
 - getopt typo on ulimit -p -> -u conversion
 - get/setrlimit() calls were not being error checked

ulimit formatting cleanup from me, use same wording as bash on Bruce's
suggestion.  Add ulimit arg to output on Joerg's suggestion.
1996-09-03 13:35:11 +00:00
peter
a0316ac070 oops, I didn't mean for the unconditional DEBUG code to go in, it's been
off in FreeBSD for some time.  I realised this a few seconds after the
commit started..
1996-09-01 10:27:49 +00:00
peter
5195be912e Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]

There are some changes to the build that are my fault...  mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do.  The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.

This closes a pile of /bin/sh PR's, but not all of them..

Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
1996-09-01 10:22:36 +00:00
wosch
ab0ebe585d [HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41
1996-08-29 18:06:19 +00:00
ache
17b8d9508a Take out 0201-0207 range - those characters abused by sh 1996-08-12 22:14:50 +00:00
ache
05aa8617cf Convert to newly added collate compare function 1996-08-12 19:31:11 +00:00
ache
3a66e92deb Simplify expression 1996-08-12 12:31:28 +00:00
ache
8affe69b98 Localize it 1996-08-11 22:51:00 +00:00
jkh
8eb37231d4 Bring in my changes for removing the pestilent obj links (unless you
really want them) from /usr/src.  This is the final version of the
patches, incorporating the feedback I've received from -current.
1996-06-24 04:26:21 +00:00
phk
9b71c2f42f Backup yacc changes. 1996-06-02 17:06:40 +00:00
phk
a81e9f20dc Use new yacc rules. (I'm fixing the tree as fast as I can :-) 1996-05-30 20:52:26 +00:00