Tim J. Robbins
728b72c237
Avoid accidentally making "-h" a synonym for "fc".
...
Obtained from: NetBSD
2002-10-18 10:33:32 +00:00
Tim J. Robbins
c121fd80b8
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
Tim J. Robbins
427748f7df
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
Tim J. Robbins
54beeb39c2
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
Tim J. Robbins
658a755b6a
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
Tim J. Robbins
7e73d40ee5
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
Maxime Henrion
ca5434bae6
It is now safe to remove WARNS=0 and WFORMAT=0.
...
Tested on: alpha, i386, sparc64
2002-10-01 12:12:45 +00:00
Tim J. Robbins
8c39572997
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
Maxime Henrion
0c1661b754
- 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
Tim J. Robbins
fce40e6ec6
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
Maxime Henrion
ec65e9977a
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
Tim J. Robbins
b7f23f5be5
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
Tim J. Robbins
c515abc535
Remove some kind of profiling support that required the 4.2BSD monitor()
...
function in libc.
2002-10-01 01:30:33 +00:00
Tim J. Robbins
b1a667509b
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
Tim J. Robbins
abe2dc6158
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
Tim J. Robbins
f7a9b7fe3a
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
Tim J. Robbins
e00e16ad7f
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
Tim J. Robbins
9a7cafd9b8
Remove dead code which supported systems without O_APPEND, O_CREAT or SIGTSTP.
2002-09-29 12:38:25 +00:00
Tim J. Robbins
1c59560de9
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
Jacques Vidrine
dde97b32ff
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
Giorgos Keramidas
d1d578b2cd
Add <stdlib.h> to get a prototype for exit().
...
Reviewed by: tjr
2002-08-29 14:26:49 +00:00
Philippe Charnier
0d9f1a69d8
Replace various spellings with FALLTHROUGH which is lint()able
2002-08-25 13:01:47 +00:00
Tim J. Robbins
df9e587beb
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
Tim J. Robbins
488edd5bd3
Don't show the process ID of background jobs that have terminated,
...
for consistency with ksh.
2002-08-24 07:19:01 +00:00
Tom Rhodes
7d971bbf29
s/filesystem/file system/ as discussed on -developers
2002-08-21 17:32:44 +00:00
Jens Schweikhardt
8eed22b1a6
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
Tim J. Robbins
4f8fa749f0
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
Tim J. Robbins
6c56d93528
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
Tim J. Robbins
d8d737d751
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
Ruslan Ermilov
9ba31ca074
mdoc(7) police: tidying.
2002-08-09 10:59:20 +00:00
Tim J. Robbins
7e1975c2b2
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
Tim J. Robbins
050f7913c9
Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown
...
options.
2002-07-25 10:47:38 +00:00
Tim J. Robbins
93c0dc5ea6
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
Tim J. Robbins
b5ae692823
pwdcmd()'s argc and argv arguments are no longer unused, remove __unused.
...
Pointed out by: fanf
2002-07-25 09:46:31 +00:00
Tim J. Robbins
be58cc483e
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
Tim J. Robbins
9de7305e58
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
Tim J. Robbins
ecd807fb6d
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
Tim J. Robbins
088acf9001
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
Tim J. Robbins
776600e6de
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
Tim J. Robbins
2babaf74b5
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
Tim J. Robbins
558175ca15
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
Tim J. Robbins
2628ebdbd1
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
Tim J. Robbins
5b99fa0514
Don't assume file descriptors fit in a short, use an int instead.
2002-07-18 12:24:35 +00:00
Tim J. Robbins
b80be28218
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
Tim J. Robbins
f1ae2c66c8
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
Tim J. Robbins
6c8bbe749e
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
Tim J. Robbins
17f08ec1bc
Remove support for the "old" tty driver by unifdef -UOLD_TTY_DRIVER;
...
many other parts of the shell are no longer compatible with this, and it
makes jobs.c quite cluttered with #ifdef's.
2002-07-11 06:26:48 +00:00
Tim J. Robbins
0d3d4c12c3
When growing the job table, don't relocate the jobmru pointer if it's NULL.
2002-07-11 04:22:41 +00:00
Tim J. Robbins
ce80ed021f
Close file descriptors when [n]>&- and [n]<&- redirections are used.
...
This was broken by rev. 1.16.
PR: 40334
MFC after: 1 week
2002-07-09 08:55:46 +00:00
Tim J. Robbins
907354479f
Print out commands with NTOFD/NFROMFD redirections that close the
...
descriptors (">&-" or similar) correctly in the jobs(1) command.
2002-07-09 03:26:47 +00:00