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
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
tjr
b19972e699
Implement the -u (-o nounset) option, which gives an error message if
...
an unset variable is expanded.
Obtained from: NetBSD (bjh21, christos)
2002-05-19 08:30:16 +00:00
tjr
b72e0fae17
Make the fg and bg commands give the output required by SUSv3.
...
fg outputs the name of the command, bg outputs the name of the command
and the job id.
2002-05-19 07:27:26 +00:00
tjr
ada2f900a3
Implement the -C (-o noclobber) option, which prevents existing regular
...
files from being overwritten by shell redirection.
2002-05-19 06:03:05 +00:00
trhodes
56036d2623
Consistancy check s/file system/filesystem/
...
Reviewed by: brian
2002-05-16 01:57:20 +00:00
des
4d6b787d2d
Usage style sweep: spell "usage" with a small 'u'.
...
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
charnier
79b89ed363
Use `The .Nm utility'
2002-04-16 20:08:06 +00:00
greid
5486a1c99e
Stop a null pointer dereference in the builtin hash function.
...
PR: 36141
Approved by: cracauer
MFC after: 1 week
2002-04-15 15:49:30 +00:00
imp
d4f0b8fef8
Remove now-obsolete __STDC__ ifdefs, remove redundant NULL definition and
...
include stdlib.h for NULL.
2002-02-18 06:08:23 +00:00
kris
bb3058824a
Lock down with WFORMAT=1 except those directories with unfixed warnings.
...
Tested on i386 and alpha.
2002-02-04 02:49:19 +00:00
imp
c4d9fbc331
%.* takes an int, not a size_t.
2002-02-02 07:06:58 +00:00
imp
5ef5088ac4
o __P has been reoved
...
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...
2002-02-02 06:50:57 +00:00
babkin
6f66434b4f
The fix for >/dev/stdout, including Tor Egge's fix for the bug in the
...
original attempt of the fix. And yes, this time I've tried to build
world with it and it succeeded.
Submitted by: Tor Egge
MFC after: 1 week
2002-01-13 14:37:40 +00:00
alfred
39b93da10a
backout rev 1.14, it's breaking things.
2001-12-24 22:27:04 +00:00
babkin
a0dab54592
Added ability to do ">/dev/stdout". The apsfilter people are anxious
...
to get it MFCed in time for release 4.5.
MFC after: 2 weeks
2001-12-22 02:40:58 +00:00
obrien
099f8ecbe9
Default to WARNS=2. Binary builds that cannot handle this must explicitly
...
set WARNS=0.
Reviewed by: mike
2001-12-04 01:57:47 +00:00
knu
96265e088e
Remove the printf builtin command from sh(1), which command is not
...
used so often that it's worth keeping it as a builtin.
Now that all the printf invocations from within the system startup
scripts, we can safely remove it.
Urged by: sheldonh :)
No MFC is planned so far because it may break compatibility and
violate POLA.
2001-11-20 18:33:59 +00:00
knu
b58a3e4078
Make test(1) a builtin command of our sh(1) for efficiency. The
...
binary size increase is 3,784 bytes (about 0.6%).
I don't drop the printf builtin while I'm here because some /etc/rc.*
scripts seem to use it before mounting /usr where printf(1) resides.
Reviewed by: arch (sheldonh)
Inspired by: NetBSD, ksh
Clued by: ume (on how the printf builtin is used)
2001-11-17 19:10:11 +00:00
tegge
c98a8251e8
Don't call setvar() with the VTEXTFIXED flag. A copy is created by
...
setvar() and passed to setvareq(). When the VTEXTFIXED flag is set,
that copy is never freed, causing a memory leak.
PR: 31533
Submitted by: maxim@macomnet.ru
2001-11-07 23:00:05 +00:00
tegge
e6528784cf
Repair normally unused is_digit() macro.
2001-10-14 21:11:33 +00:00
obrien
d9494059c0
*** empty log message ***
2001-10-01 08:43:58 +00:00
tegge
b0e7279ba2
Don't check uninitialized memory for having the shell control character
...
value CTLARI since this might break expansion of arithmetic expressions.
Don't access memory below start of stackblock.
Problem analyzed by hunt@iprg.nokia.com , slightly different patch applied.
PR: 24443
Submitted by: hunt@iprg.nokia.com
2001-09-19 20:16:38 +00:00
tegge
0c39138a0b
BASESYNTAX, DQSYNTAX, SQSYNTAX and ARISYNTAX handles negative indexes.
...
Allow those to be used to properly quote characters in the shell
control character range.
2001-09-19 20:07:47 +00:00
tegge
221fff6437
Adjust some type checks to include CTLQUOTEMARK in the range of
...
shell control characters.
2001-09-19 19:58:09 +00:00
peter
a28e7a866a
Initialize infp at main()
2001-08-13 21:55:04 +00:00
ru
95ce4d2cdc
Removed duplicate VCS ID tags, as per style(9).
2001-08-13 14:06:34 +00:00
sheldonh
7950d85ec2
can not -> cannot
2001-08-08 18:32:06 +00:00
ru
4345758876
mdoc(7) police:
...
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
sheldonh
9bfb9eedcd
Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The
...
definitions are more readable, and it's possible that they're
more portable to pathalogical platforms.
Submitted by: David Hill <david@phobia.ms>
2001-07-26 11:02:39 +00:00
sheldonh
8eba0410f0
Break the list of parameter expansions into two lists so that
...
the paragraph introducing the prefix and suffix pattern expansions
does not appear as part of the explanation for the string length
expansion.
2001-07-23 10:18:05 +00:00
dd
a145482cf6
Remove whitespace at EOL.
2001-07-15 07:53:42 +00:00