Commit Graph

2706 Commits

Author SHA1 Message Date
Marcel Moolenaar
937b0a997b Work better with how make/bmake works:
1.  Avoid a cd back into ${.CURDIR} to run mkbuiltins when we know make
    will first cd into ${.OBJDIR}. Keep the cwd to what make sets it to.
2.  Don't tell mkbuiltins where to write to (= ${.OBJDIR}), but where to
    get sources from (= ${.CURDIR}). This to compensate for point 1.

This fixes a problem with bmake's mk files that optimize ${.OBJDIR} to
expand to "." after changing cwd, not taking into account that the
target is pretty much undoing that and not getting the full path to the
object tree anymore.
2012-05-24 19:48:15 +00:00
Konstantin Belousov
4f1e1f86a1 Add 'cow' keyword to show per-process cow count.
Submitted by:	Andrey Zonov <andrey zonov org>
MFC after:	1 week
2012-05-23 18:11:36 +00:00
Warren Block
7b9da80729 Mention the upper hard limit for -n option. Patch slightly modified
from PR version.

PR:		168255
Submitted by:	Andy Kosela
Approved by:	gjb
MFC after:	3 days
2012-05-23 16:19:19 +00:00
Kevin Lo
fcae0e3887 Remove redundant declaration of yyparse
Reported by:	tinderbox
2012-05-22 03:01:54 +00:00
Marcel Moolenaar
6663ff446e Add build opton MK_LS_COLORS to control whether ls(1) supports colors
(and thus needs to depend on libtermcap). Embedded systems may not
want or need colors.

Obtained from:	Juniper Networks, Inc.
2012-05-19 18:05:00 +00:00
Marcel Moolenaar
aa39c44746 Add build option MK_ED_CRYPTO to control whether ed(1) is to have the
ability to encrypt/decrypt files. Embedded systems can typically have
OpenSSL, but not for ed(1) to use it.

Obtained from:	Juniper Networks, Inc.
2012-05-19 17:55:49 +00:00
Marcel Moolenaar
e7b903bf3d Remove unused header (libutil.h) 2012-05-17 20:29:15 +00:00
Jilles Tjoelker
ad859ed8cf sh: Remove an unused header.
The read builtin no longer does things with termios.
2012-05-15 22:50:47 +00:00
Joel Dahl
35471bf8ef Minor mdoc nits. 2012-05-13 14:16:04 +00:00
Matthew D Fleming
64afb51ccd I forgot to bump the manpage date.
Reminded by:	Garrett Cooper
MFC after:	3 days
X-MFC-with:	r235297
2012-05-12 02:49:40 +00:00
Matthew D Fleming
af68c71a5e Add a -v and -N option to kenv(1), so it can be more easily used in
scripts the way sysctl(8) is.  The -N option, like in sysctl(8),
displays only the kenv names, not their values.  The -v option prints an
individual kenv variable name with its value as name="value".  This is
the inverse of sysctl(8)'s -n flag, since the default behaviour of
kenv(1) is already like sysctl(8) -n.

Submitted by:	Garrett Cooper < yanegomi AT gmail DOT com >
MFC after:	1 week
2012-05-11 23:05:14 +00:00
Joel Dahl
748611c9c0 mdoc: fix column names, indentation, column separation within each row, and
quotation. Also make sure we have the same amount of columns in each row as
the number of columns we specify in the head arguments.

Reviewed by:	brueffer
2012-04-07 09:05:30 +00:00
Jilles Tjoelker
b95fca474d sh: Fix build with -DDEBUG=2.
Reported by:	Kristof Provost
MFC after:	1 week
2012-04-02 17:16:24 +00:00
Joel Dahl
288eac5aed mandoc complains loudly when <TAB>s are misused in columnated lists. Fix
this syntax violation and while I'm here also convert <TAB> to Ta and adjust
quotation marks in order to prevent this problem in the future.
2012-03-29 16:02:40 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Joel Dahl
904d0726c8 Remove superfluous paragraph macro. 2012-03-25 09:20:14 +00:00
Eitan Adler
8c3bbba824 rm[0].rm_so must be zero (an explicit check is made for zero in the
outer if condition)

Reviewed by:	se
Approved by:	cperciva
2012-03-19 00:45:01 +00:00
Konstantin Belousov
28c84226e8 Document P_ORPHAN.
MFC after:	3 days
2012-03-08 13:00:49 +00:00
Eitan Adler
45b586acc4 Bump date to today (since I modified it)
PR:		bin/165321
Approved by:	gjb
MFC after:	3 days
2012-03-03 17:52:19 +00:00
Eitan Adler
2561992179 Direct users to swapinfo and pstat from df
PR:		bin/165321
Submitted by:	jhs
Approved by:	bcr
MFC after:	3 days
2012-03-03 15:38:01 +00:00
Glen Barber
9d496f5ab6 Whitespace cleanup:
o Wrap sentences on to new lines
 o Cleanup trailing whitespace

Found with:	textproc/igor
MFC after:	1 week
X-MFC-With:	r232157
2012-02-25 15:21:43 +00:00
Glen Barber
3102cfe2e2 Fix various typos in manual pages.
Submitted by:	amdmi3
PR:		165431
MFC after:	1 week
2012-02-25 14:31:25 +00:00
Mark Peek
9ccc37e320 Update to tcsh 6.18.01. 2012-02-22 03:36:15 +00:00
Jilles Tjoelker
c0b3cf0676 sh: Make 'hash' return 1 if at least one utility is not found.
Reported by:	lme
2012-02-11 21:06:45 +00:00
Jilles Tjoelker
33233ec76e sh: Fix swapped INTON/INTOFF.
A possible consequence of this bug was a memory leak if SIGINT arrived
during a 'set' command (listing variables).

MFC after:	1 week
2012-02-04 23:29:07 +00:00
Jilles Tjoelker
caf29fab8c sh: Use vfork in a few common cases.
This uses vfork() for simple commands and command substitutions containing a
single simple command, invoking an external program under certain conditions
(no redirections or variable assignments, non-interactive shell, no job
control). These restrictions limit the amount of code executed in a vforked
child.

There is a large speedup (for example 35%) in microbenchmarks. The
difference in buildkernel is smaller (for example 0.5%) but still
statistically significant. See
http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html
for some numbers.

The use of vfork() can be disabled by setting a variable named
SH_DISABLE_VFORK.
2012-02-04 23:12:14 +00:00
Philippe Charnier
2fae4c3d95 Add prototypes, ANSIfy functions definitions to reduce WARNS=6 output. 2012-01-25 08:42:19 +00:00
Jilles Tjoelker
6eff4a75d5 sh: Fix $? in the first command of a 'for'.
In the first command of a 'for', $? should be the exit status of the last
pipeline (command substitution in the word list or command before 'for'),
not always 0.
2012-01-22 14:00:33 +00:00
Jilles Tjoelker
0105d7224d sh: Remove "kill" example function, which is superseded by the kill builtin
MFC after:	1 week
2012-01-21 20:39:17 +00:00
Ed Schouten
6aed20fe1a Remove unused variables.
Simply annotate the function parameters with __unused, instead of adding
the ve-variables. This makes the code build with GCC 4.7 and -Werror.
2012-01-17 22:17:10 +00:00
Jean-Sébastien Pédron
01a43bcf7b sh: Fix execution of multiple statements in a trap when evalskip is set
Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
    o  "-e" is set for this shell
    o  a trap is set on EXIT
    o  a function returns 1 and causes the script to abort

Reviewed by:	jilles
MFC after:	2 weeks
2012-01-16 11:07:46 +00:00
Jilles Tjoelker
93fcb2511b sh: Fix some bugs with exit status from case containing ;&.
Also, rework evalcase() to not evaluate any tree. Instead, return the
NCLISTFALLTHRU node and handle it in evaltree().

Fixed bugs:

* If a ;& list with non-zero exit status is followed by an empty ;; or final
  list, the exit status of the case command should be equal to the exit
  status of the ;& list, not 0.

* An empty ;& case should not reset $?.
2012-01-15 21:39:38 +00:00
Jilles Tjoelker
92371efca2 sh: Fix two bugs with case and exit status:
* If no pattern is matched, POSIX says the exit status shall be 0 (even if
  there are command substitutions).
* If a pattern is matched and there are no command substitutions, the first
  command should see the $? from before the case command, not always 0.
2012-01-15 20:04:05 +00:00
Jilles Tjoelker
7f40c1f876 sh: Change input buffer size from 1023 to 1024.
PR:		bin/161756
2012-01-14 22:46:18 +00:00
Jilles Tjoelker
52c450395a sh: Fix out of bounds array access when trap is used with an invalid signal.
MFC after:	1 week
2012-01-14 21:54:12 +00:00
Jilles Tjoelker
e94e3511bd sh: Properly show "Not a directory" error in cd builtin.
The errno message display added in r222292 did not take attempting to
cd to a non-directory or something that cannot be stat()ed into account.

PR:		bin/164070
MFC after:	10 days
2012-01-13 23:32:27 +00:00
Ulrich Spörlein
38494eff98 Spelling fixes for bin/ 2012-01-07 16:10:23 +00:00
Jilles Tjoelker
260fc3f4d2 sh: Make various functions static. 2012-01-01 22:17:12 +00:00
Jilles Tjoelker
f6d3a9b03f sh: Remove unused function scopyn(). 2012-01-01 22:15:38 +00:00
Jilles Tjoelker
820491f824 sh: Make patmatch() non-recursive. 2012-01-01 20:50:19 +00:00
Jilles Tjoelker
3a1b9c9e82 sh: Allow quoting ^ and ] in bracket expressions. 2011-12-28 23:51:17 +00:00
Jilles Tjoelker
6e8db49a44 sh: Use dirent.d_type in pathname generation.
This improves performance for globs where a slash or another component
follows a component with metacharacters by eliminating unnecessary attempts
to open directories that are not.
2011-12-28 23:40:46 +00:00
Jilles Tjoelker
7a2b9d4b38 sh: Cache de->d_namlen in a local variable. 2011-12-28 23:30:17 +00:00
Jilles Tjoelker
a82f5687bf sh: Do not force special builtins non-special in optimized command subst.
This is not necessary: errors are already caught in evalbackcmd() and
forcelocal handles changes to variables.

Note that this depends on r223024.

MFC after:	4 weeks
2011-12-28 22:10:12 +00:00
Dimitry Andric
4bfc2007ab Fix some obtuse fprintf tricks in bin/ed.
MFC after:	1 week
2011-12-16 21:12:23 +00:00
Ed Schouten
469743871e Add static keywords to chio(1).
All other global variables are already marked static, so for consistency
sake, add them to these three arrays as well.
2011-12-11 20:53:12 +00:00
Ed Schouten
7b44b80961 Move 3.5 KB from the data segment to the text segment.
The `struct modes' are only used by the getter-functions in the same
file, so we can safely mark them static and const.
2011-12-11 09:56:48 +00:00
Jilles Tjoelker
03f33e912d sh: Remove impossible evalskip check in 'for'. 2011-11-27 00:09:59 +00:00
Jilles Tjoelker
a157dc4d90 sh: Reduce one level of evaltree() recursion when executing 'case'.
Free expanded case text before executing commands.
Remove impossible evalskip checks (expanding an argument cannot set
evalskip anymore since $(break) and the like are properly executed in a
subshell environment).
2011-11-26 23:28:31 +00:00
Jilles Tjoelker
ba22f6c693 test: Reduce code size of ops table. 2011-11-25 23:45:29 +00:00