Commit Graph

294 Commits

Author SHA1 Message Date
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
tjr
b6bd829347 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
tjr
0087ce2988 When growing the job table, don't relocate the jobmru pointer if it's NULL. 2002-07-11 04:22:41 +00:00
tjr
df20e19b27 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
tjr
284f7b1851 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
dillon
7340de44e8 Fix type-o in last commit in preparation for MFC. 2002-07-02 19:06:33 +00:00
obrien
f6f518b207 Consistently use FBSDID 2002-06-30 05:15:05 +00:00
sheldonh
8e1ca9d76c Document addition of RLIMIT_VMEM support, added in rev 1.26 of miscbltin.c. 2002-06-27 16:56:45 +00:00
dillon
8e4f3ae5f1 Add support for RLIMIT_VMEM. The #ifdef's were already there but getopt()
needed to be adjusted.
2002-06-26 00:29:53 +00:00
jmallett
0c56b95c32 Remove two unused variables. 2002-06-20 05:21:43 +00:00
jmallett
2b674f32f6 Minor const cleanup.
Don't discard qualifiers we don't need to discard.
2002-06-20 05:20:50 +00:00
tjr
6b197bb764 Bring documentation on CDPATH and its effects on cd(1) back into sync with
reality (and POSIX): current directory isn't searched unless CDPATH has
a "." element or is unset.

PR:		38442
Submitted by:	oleg dashevskii <be9@be9.ru>
MFC after:	1 week
2002-06-19 12:04:22 +00:00
tjr
08e98db385 Don't list shell builtins when the hash command is used (SUSv3) 2002-06-13 07:50:50 +00:00
tjr
8b3a40cd3f Document the -f and -v options of the unset builtin. 2002-06-06 04:12:50 +00:00
tjr
70c6f806e0 Quote the output of the no-argument form of the `set' builtin for re-input
to the shell.
2002-06-06 04:02:50 +00:00
tjr
c74ee6d523 Add the SUSv3 -p ("portable") option to both the export and readonly
builtins. This makes export/readonly print lines in the form
"export name=value".
2002-06-06 03:57:22 +00:00
tjr
d658a1e5c7 Don't modify output that is to be quoted if it contains no IFS characters
or shell metacharacters.
2002-06-06 03:29:23 +00:00
tjr
71a01dad7b Display job status correctly when a pipeline is suspended. 2002-06-04 15:26:00 +00:00
tjr
da1177ce1d Describe finished jobs as "Done", not "Exit" (SUSv3) 2002-06-04 14:40:33 +00:00
tjr
ec349498c5 Don't output state' and current' fields for processes that aren't
leaders in -l option to jobs(1).
2002-06-04 14:37:13 +00:00
tjr
ba4116c514 Missing prototypes from previous commit. 2002-06-04 13:13:54 +00:00
tjr
de63da4c55 Correct minor spacing problem in output of jobs -l for pipelines. 2002-06-04 13:01:51 +00:00
tjr
33d27dd210 Quote alias values in the output of the alias(1) builtin so they are
suitable for re-input to the shell (SUSv3)
2002-06-04 12:59:12 +00:00
tjr
0930ee47eb Fix typo causing ``fc -e'' to not work correctly. getopt() sets optarg,
not shoptarg.
2002-06-02 08:34:09 +00:00
tjr
0a9f255d03 Adding an entry to the history with H_ENTER moves libedit's internal
history cursor. Reset the cursor after adding the entry to the history
when doing ``fc -s'' so the output is correct.
2002-06-02 08:27:04 +00:00
tjr
d3a1f7d912 Implement $PPID, the parent process ID of the shell. 2002-06-01 02:14:48 +00:00
tjr
fff7a36566 Support the remaining job ID formats required by SUSv3:
%+ (current job, same as %%),
%- (previous job),
%?str (job with "str" in its command name).
2002-06-01 01:51:42 +00:00
tjr
1f8bb8d729 Add -s (output PID's only) and -l (show PID's) options to the jobs(1)
builtin. Modify the output format to match what SUSv3 requires.
2002-05-31 14:04:23 +00:00
tjr
c828fbddc6 #if JOBS around a job control-related statement to allow compilation with
job control disabled.
2002-05-31 13:10:38 +00:00
tjr
5250eaebac Break the code to display status info for one job out from showjobs() into
showjob(), use it inside dowait() to display status info for consistency,
and in a format closer to what the standard requires.
2002-05-31 13:07:05 +00:00
tjr
952d847c40 Move job to front of most recently used job list when bg'd or fg'd. 2002-05-31 12:35:34 +00:00
tjr
7e9561b97a Instead of keeping just the jobid of the most recently bg'd or fg'd job,
keep a linked list of the jobs, most recently used first. This is required
to support the idea of `previous job', and to allow the jobs fg and bg
default to be correct according to POSIX.
2002-05-31 12:31:23 +00:00
ru
76631b8618 mdoc(7) police: tidy up the markup a bit. 2002-05-29 15:38:59 +00:00
tjr
9ce8567e45 sh appeared in Version 1, not System V.1. 2002-05-25 12:18:27 +00:00
tjr
290ce9e466 Implement `set +o', which displays the currently set options in a format
suitable for re-input into the shell.
2002-05-25 12:11:58 +00:00
tjr
e6fbc84685 Bring back the cd -L and -P options from revision 1.24, but try harder not
to fail when the logical current directory no longer exists. Allow changes
to absolute paths when logical cwd is invalid, fall back to physical cd
if logical cd fails.
2002-05-22 05:15:53 +00:00
tjr
fff7331065 Temporarily back out revision 1.24; it seems to handle the case where the
current directory no longer exists incorrectly and breaks `make cleandir'.
2002-05-22 03:29:20 +00:00
tjr
bc86a28ef9 Add the SUSv3 -L and -P options to the cd and pwd builtin utilities. `Logical'
handling of .. is now the default.
2002-05-20 07:54:39 +00:00
jmallett
4205c9f55a Remove a small, annoying, nit I ran in to editing this file, a lone tab
on a line by itself.
2002-05-19 17:50:23 +00:00