Commit Graph

332 Commits

Author SHA1 Message Date
fanf
3a97bafeeb Document trap EXIT and trap SIGNAME. 2002-12-17 17:31:44 +00:00
tjr
0423e8e003 When job control is disabled, never show the job id when reporting the
status of a background process that has terminated because of a signal.
2002-12-14 01:08:04 +00:00
ru
4b97577172 Capitalize ASCII code names.
Approved by:	re
2002-12-05 08:50:00 +00:00
tjr
496051977b Delete worthless comments. 2002-10-30 06:34:52 +00:00
tjr
a96c7569e1 Avoid accidentally making "-h" a synonym for "fc".
Obtained from:	NetBSD
2002-10-18 10:33:32 +00:00
tjr
33d1a8b9c2 Do not strip CTL* escapes from redirection filenames in argstr(); they
are later stripped with rmescapes() in expandarg(). If the filename has
already been unescaped, doing it again in rmescapes() can walk off the
end of the string, leading to memory corruption and eventually SIGSEGV.

Noticed by:	kris
2002-10-08 11:22:49 +00:00
tjr
742de9da6c Disallow empty condition parts of "if", "while" and "until" compound
commands. Commands like "if then ... fi" and "while do ... done" are no
longer accepted. Bodies of compound commands are still allowed to be
empty, because even though POSIX does not allow them, most shells do.
2002-10-06 06:35:51 +00:00
tjr
aef5d44ac2 Use %d in a printf() format string and cast the argument to int instead of
using %td when we know that the number is between 0 and 9; mksyntax is a
build tool and needs to work on -stable.
2002-10-02 09:57:54 +00:00
tjr
d1745bcd0c Back out experimental changes to fmtstr() that I didn't mean to include
in the previous commit.
2002-10-01 13:41:13 +00:00
tjr
4ea24b7f73 Replace a home-grown printf() clone with a fwopen() wrapper around
libc's vfprintf() that writes to a `struct output' instead of a file.
Inspired by NetBSD's similar changes (they used asprintf() instead).
2002-10-01 13:22:12 +00:00
mux
a7fdee892c It is now safe to remove WARNS=0 and WFORMAT=0.
Tested on:	alpha, i386, sparc64
2002-10-01 12:12:45 +00:00
tjr
2b33063d01 Restore "not found" error message when searching for (or executing)
a program fails because the file or a path component does not exist.

Suggested by:	bde
2002-10-01 11:48:18 +00:00
mux
bad1a9d852 - Don't use quad_t when we really mean rlim_t.
- Cast rlim_t to intmax_t when printing it.

This should fix the last format errors in sh(1).

Tested on:	i386, sparc64
2002-10-01 11:44:38 +00:00
tjr
508be2d558 Add back WARNS=0 and WFORMAT=0; gcc is finding nonexistent format string
errors with %qd formats.
2002-10-01 08:55:28 +00:00
mux
b07890219d Use the %t format modifier to print differences between
pointers.  This fixes two format warnings on 64 bits
archs which are fatal now that WFORMAT=0 has been removed.

It doesn't fully fix the sh(1) build on 64 bits platforms
though, there is still some quad_t issues that need to be
fixed.

Tested on:	i386, sparc64
2002-10-01 08:40:07 +00:00
tjr
abffc58780 Remove WARNS=0 and WFORMAT=0. The shell compiles cleanly at WARNS=2
on at least i386. If there are warnings on other archs, I'd rather hear
about them than pretend they didn't exist.
2002-10-01 07:26:35 +00:00
tjr
25b2946cef Remove some kind of profiling support that required the 4.2BSD monitor()
function in libc.
2002-10-01 01:30:33 +00:00
tjr
a04b479aee Remove bits and pieces of support for atty, which was made obsolete by
adding history and vi/emacs-style line editing to the shell itself.
Atty was a user-mode terminal emulator (like screen and window) that did
line editing and history.
2002-10-01 00:54:14 +00:00
tjr
de4d764c3c Callers of error() don't need to supply a program name prefix in the
error message. Stops ulimit giving error messages like "ulimit: ulimit: xyz".
2002-09-30 13:29:32 +00:00
tjr
be381197cd Allow a left parenthesis before patterns in case blocks. POSIX requires
us to accept this, but I've never seen a script that uses it.
2002-09-30 13:25:00 +00:00
tjr
f162697f7c Allow empty case/esac statements; POSIX requires this, and recent versions
of autoconf are generating scripts that use this feature.

PR:		43275 35879
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
2002-09-30 10:57:44 +00:00
tjr
8435c561b3 Remove dead code which supported systems without O_APPEND, O_CREAT or SIGTSTP. 2002-09-29 12:38:25 +00:00
tjr
6307190b53 Convert the remaining callers of errmsg() to use strerror(), and remove
errmsg() and its table of error messages.
2002-09-29 11:37:39 +00:00
nectar
927cfce43e Correct a usage of fnctl that could not be right and results in a
no-op.  I assume it was meant that the close-on-exec flag be set here.
2002-09-11 16:38:33 +00:00
keramida
0eae474cc2 Add <stdlib.h> to get a prototype for exit().
Reviewed by:	tjr
2002-08-29 14:26:49 +00:00
charnier
c88222c6c0 Replace various spellings with FALLTHROUGH which is lint()able 2002-08-25 13:01:47 +00:00
tjr
2eb0d94f37 There is a built-in command called "builtin"; spell its name correctly
after rev. 1.77 called it "built-in".
2002-08-24 12:41:23 +00:00
tjr
7ffc3ae91a Don't show the process ID of background jobs that have terminated,
for consistency with ksh.
2002-08-24 07:19:01 +00:00
trhodes
9618da3e35 s/filesystem/file system/ as discussed on -developers 2002-08-21 17:32:44 +00:00
schweikh
842f45255d Fix a few typos, among them s/builtin/built-in/ (except for the ref
to the builtin(1) man page.) This is for consistency with the spelling
both proposed by ispell as well as IEEE Std 1003.1-2001.

MFC after:	3 days
2002-08-21 15:05:55 +00:00
tjr
2f2bf8ffc0 Avoid accessing the current job's process table in the child part of
forkshell() after it has been freed. This caused mysterious behaviour
when anything but the first command in a pipeline tried to access the
terminal when the `junk' malloc() option was enabled (which is the default).
2002-08-18 06:43:44 +00:00
tjr
aa14f489f2 Show job control ID, command text, etc. when foreground processes are
suspended. This is a followup to rev. 1.51.

MFC after:	1 week
2002-08-17 13:57:47 +00:00
tjr
717dc062a8 Allow redirections by themselves between "&&" and "||" operators.
For example, >/dev/null && echo foo

Pointed out by:	FUJISHIMA Satsuki
MFC after:	1 week
2002-08-11 03:04:23 +00:00
ru
e185ee0111 mdoc(7) police: tidying. 2002-08-09 10:59:20 +00:00
tjr
43d6a14678 Add a -P/-o physical option which behaves similarly to bash/ksh's options
by the same name. This option makes the cd and pwd builtins behave physically
(as opposed to logically) by default.

Submitted by:	fanf
2002-07-25 10:57:39 +00:00
tjr
ca8e9f2edf Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown
options.
2002-07-25 10:47:38 +00:00
tjr
cb0dfaa9bd Use PATH_MAX instead of a local guess at it, which happened to be incorrect.
Suggested by:	fanf
2002-07-25 09:56:08 +00:00
tjr
077941cfae pwdcmd()'s argc and argv arguments are no longer unused, remove __unused.
Pointed out by:	fanf
2002-07-25 09:46:31 +00:00
tjr
9c6ea7014e Avoid calling el_resize() from a signal handler, even though libedit
itself does that if you set EL_SIGNAL. Instead, set a flag and check it
before calling el_gets(). This is safer, but slower to respond to changes.

Pointed out by:	mp
2002-07-24 02:06:07 +00:00
tjr
8be25d316f Catch SIGWINCH in interactive shells and call el_resize() to update
libedit's idea of the window size.
2002-07-23 15:05:00 +00:00
tjr
12e699af89 Call el_source() to read the contents of .editrc when line editing is enabled.
Obtained from:	NetBSD
MFC after:	2 weeks
2002-07-23 12:26:34 +00:00
tjr
f9fd5faa32 Add a `bind' builtin command, which is simply a wrapper around libedit's
builtin command of the same name. This allows the key bindings for the
shell's line editor to be changed.

MFC after:	2 weeks
2002-07-23 11:50:53 +00:00
tjr
e73489bbe4 Don't allow "||" or "&&" to be the first tokens of a command.
PR:		40386
MFC after:	2 weeks
2002-07-22 05:50:12 +00:00
tjr
bd9024b4d7 Implement the P1003.2 `command' builtin command, which is used to suppress
shell function and alias lookup. The -p option has been implemented, the
UPE -v and -V options have not. The old `command' command has been renamed
to `builtin'.
2002-07-21 06:49:14 +00:00
tjr
28039a3e13 Document that only one of the -n and -e options may be specified for
sh(1)'s echo(1) builtin command.

PR:		32935, 40747
MFC after:	1 week
2002-07-20 04:39:23 +00:00
tjr
6f7073eccf Remove broken and incomplete support for old releases of System V,
don't support system that implement getcwd(3) with a pipe to /bin/pwd.
2002-07-19 08:09:04 +00:00
tjr
74e419398d Don't assume file descriptors fit in a short, use an int instead. 2002-07-18 12:24:35 +00:00
tjr
9e3506ab60 Avoid using ints or shorts to store process id's, use pid_t instead.
The pgrp member of struct job was declared as a short and could not store
every possible process group ID value, the rest of them were benign because
pid_t happens to be an int.
2002-07-18 10:22:42 +00:00
tjr
60af0dcffa Make the message that is printed when the foreground process is terminated
by a signal the same as pdksh/bash/sh before rev. 1.34.
2002-07-18 09:37:51 +00:00
tjr
b8a53fb638 Don't assume the shell's controlling terminal is attached to file descriptor
2. Instead, open /dev/tty. This problem stopped commands in subshells from
being executed correctly if standard error was redirected.

PR:		36671
Obtained from:	NetBSD (but simplified)
2002-07-11 06:42:11 +00:00