Commit Graph

2050 Commits

Author SHA1 Message Date
Stefan Farfeleder
7d1a55fc97 Document that '#' starts a comment.
PR:		85103
Submitted by:	garys
Obtained from:	pdksh manual
Patch from:	Daniel Gerzo (with changes by me)
2006-01-01 16:02:12 +00:00
Maxim Konovalov
19d099fc86 o Now when SIG_IGN signal action for SIGCHLD reap zombies
automatically it is possible wait4(2) returns -1 and sets
errno = ECHILD if there were forked children.  A user can
set such signal handler e.g. via ``trap "" 20'', see a PR
for the test case.  Deal with this case and mark a job as
JOBDONE.

PR:		bin/90334
Submitted by:	bde
MFC after:	4 weeks
2005-12-14 17:26:29 +00:00
Ruslan Ermilov
a5b0d9050a [mdoc] add missing space before a punctuation type argument. 2005-12-13 17:07:52 +00:00
Stefan Farfeleder
0673e800e9 - Document trap's -l option and the behaviour of a missing action or a single
dash.
- Discourage the omission of the action.

PR:		70985 [1]
Submitted by:	Martin Kammerhofer
2005-12-08 21:18:59 +00:00
Stefan Farfeleder
3f0131f65b Print empty quotes ('') when an empty string is passed to outqstr().
This makes a difference for the trap builtin, where after "trap '' 0" we
printed "trap -- quit".  This is wrong, because an empty action means to reset
the action to the default.  A side effect of this commit is that empty
variables are now printed as "variable=''" instead of just "variable=".
2005-12-08 21:00:39 +00:00
Stefan Farfeleder
2a5e306d46 Correctly quote the output when showing the installed trap actions.
PR:		74043
Submitted by:	Jilles Tjoelker
2005-12-08 20:08:36 +00:00
Stefan Farfeleder
7331342177 Clarify that the echo builtin takes an arbitrary number of strings.
Mention that spaces are printed between the strings.
2005-12-08 17:59:54 +00:00
Stefan Farfeleder
7162e01ce9 Sort. 2005-12-04 20:01:48 +00:00
Stefan Farfeleder
435323ed25 Remove a few commented out builtins from the original ash. The files
implementing them were never part of FreeBSD.
2005-12-04 19:37:07 +00:00
Stefan Farfeleder
1974986a82 Add the times builtin. It reports the user and system time for the shell
itself and its children.  Instead of calling times() (as implied by POSIX) this
implementation directly calls getrusage() to get the times because this is more
convenient.
2005-12-04 18:44:21 +00:00
Ruslan Ermilov
8af1113166 -mdoc sweep. 2005-11-17 12:15:23 +00:00
Ruslan Ermilov
390a478eb0 Having three options (-a, -A, -I) controlling the output of dotted
files is too much and hard to follow.  Instead, make the -I option
just mean "do not automatically set -A for root".  That is, if -A
is explicitly set, -I is ignored.  Also, document -I in usage().
(The ls.c diff is better viewed relative to rev. 1.80.)

No objection:	mux
Silence from:	mnag
MFC after:	3 days
2005-11-16 07:13:37 +00:00
Maxime Henrion
86e79d090b Mention the non-standardness of the -I option in ls(1).
Spotted by:	ru
MFC after:	3 days
2005-11-10 14:26:50 +00:00
Maxime Henrion
7b7d153b21 Add a -I option to disable the automatic -A flag for the super-user.
PR:		bin/86710
Submitted by:	Marcus Alves Grando
MFC after:	3 days
2005-11-10 00:02:32 +00:00
Jesus R. Camou
d2f90294d4 Add local' and return' to the list of built-ins.
Submitted by:	garys
Approved by:	trhodes (mentor)
2005-11-03 00:15:19 +00:00
Tom Rhodes
b97fc83e47 Note which options are not part of the standards.
Xref locale(1) and bump document date.

Reviewed by:	keramida
No Objections:	-standards
2005-11-01 19:31:25 +00:00
Stefan Farfeleder
70293cc76a Include disabled options in the output of 'set +o'. POSIX says the output of
set +o can be used to reload previous settings, for this to work disabled
options must be printed as well or otherwise options that were set in the mean
time won't be turned off.

To avoid an excessively long output line I formatted the output to print only
six options per line.

Submitted by:	Jilles Tjoelker
PR:		73500
2005-10-29 18:41:35 +00:00
Stefan Farfeleder
33b222b992 Document command -v and -V.
Glanced at by:	simon
2005-10-29 13:08:35 +00:00
Stefan Farfeleder
1b16155934 Document that read -t timeout returns 1 if the timeout elapses. 2005-10-29 08:22:09 +00:00
Stefan Farfeleder
b2f153feaf Add the POSIX options -v and -V to the 'command' builtin. Both describe the
type of their argument, if it is a shell function, an alias, a builtin, etc.
-V is more verbose than -v.

PR:	77259, 84539
2005-10-28 18:37:09 +00:00
Stefan Farfeleder
670528cd78 Protect malloc, realloc and free calls with INT{ON,OFF} directly in chkalloc,
ckrealloc and ckfree (added), respectively.  sh jumps out of the signal handler
using longjmp which is obviously a bad idea during malloc calls.

Note: I think there is still a small race here because volatile sig_atomic_t
only guarantees atomic reads and writes while we're doing increments and
decrements.

Protect a setmode call with INT{ON,OFF} as it calls malloc internally.

PR:		45478
Patch from:	Nate Eldredge
2005-10-28 10:45:19 +00:00
Stefan Farfeleder
2110d9c31a Use the new name H_SETSIZE instead of the old H_EVENT to set the history
size.

PR:	86355
2005-10-19 15:37:43 +00:00
Doug Barton
0b5efa8ad4 Give .Dd a tummy rub, forgotten on my last commit. 2005-09-30 02:12:15 +00:00
Doug Barton
a5f6295013 Handle the case where the -P flag is specified for a read-only file
earlier, and more gracefully. Previously, this combination would be
ignored early in the code where permissions are tested and fail later
with a very unhelpful "permission denied" error.

Instead, test for this flag in the same block that generates the
"override?" messages for read-only files, but instead of trying
to guess what the user has in mind, generate an error and exit.

Update the man page to reflect this new behavior.

Not objected to by:	freebsd-hackers@
2005-09-29 20:40:29 +00:00
Mark Peek
4a9ddcdc52 Bump up BUFSIZE from 4k to 8k. This was requested by portmgr@ to allow
ports builds in the cluster to work correctly.

Tested by: kris
2005-09-22 18:32:53 +00:00
Robert Watson
af2b8e58cc Add a "-q" quiet flag to kenv so that warnings can be suppressed.
MFC after:	1 week
2005-09-13 19:01:53 +00:00
Stefan Farfeleder
7405365947 Elaborate on the behaviour of set -e. 2005-09-10 09:28:39 +00:00
Stefan Farfeleder
4ee9cb0e26 Pass the EV_TESTED flag to evalloop() and evalfor(). This fixes unwanted
termination with set -e if a command fails in a loop body inside a function
with an explicitely tested exit status, eg

	f() {
		for i in 1 2 3; do
			false
		done
	}
	f || true

Briefly reviewed by:	cracauer
2005-09-10 08:25:28 +00:00
Stefan Farfeleder
2340828b1e Pass the EV_TESTED flag to the left operand of NSEMI nodes. This fixes
two cases of unwanted termination with set -e:

* if-commands containing several commands separated by semicolons, eg

	if false; false; then [...]

* functions with an explicitely tested exit status that contain a failing
  command which is not the last one, eg

	f() {
		false
		false
	}
	f || true

PR:	77067, 85267
Briefly reviewed by:	cracauer
2005-09-10 08:19:58 +00:00
Stefan Farfeleder
457c463d8a Exit the shell if a pipeline that is not preceded by ! fails and set -e is
active.  Use a separate flag to avoid adding another condition to the
if-statement at the end of evaltree().

Briefly reviewed by:	cracauer
2005-09-10 07:41:36 +00:00
Stefan Farfeleder
ef9791a3cc Split the export synopsis into two lines as -p cannot be mixed with variable
names.
2005-09-09 21:06:03 +00:00
Stefan Farfeleder
3fda45eca8 - Provide a reasonable error message for `export -p var'.
- Use argv rather than argptr since getopt() is used here.
2005-09-09 21:03:34 +00:00
Stefan Farfeleder
e4c880af3f Fix the error message if the mask that is passed to umask -S contains
non-digits.
2005-09-09 19:59:41 +00:00
Ralf S. Engelschall
60fc1eb79c Mention that uuidgen(1) generates DCE version 1 UUIDs only 2005-09-07 07:49:21 +00:00
Ralf S. Engelschall
f93a0797e0 fix typos: decribed -> described, preceeded -> preceded 2005-09-06 20:14:39 +00:00
Ralf S. Engelschall
f7d95a075c Various small code cleanups resulting from a code reviewing
and linting procedure:

1. Remove useless sub-expression:

   - if (*start || (!ifsspc && start > string && (nulonly || 1))) {
   + if (*start || (!ifsspc && start > string)) {

   The sub-expression "(nulonly || 1)" always evaluates to true and
   according to CVS logs seems to be just a left-over from some
   debugging and introduced by accident. Removing the sub-expression
   doesn't change semantics and a code inspection showed that the
   variable "nulonly" is also not necessary here in any way (and the
   expression would require fixing instead of removing).

2. Remove dead code:

   -                if (backslash && c == '\\') {
   -                        if (read(STDIN_FILENO, &c, 1) != 1) {
   -                                status = 1;
   -                                break;
   -                        }
   -                        STPUTC(c, p);
   -                } else if (ap[1] != NULL && strchr(ifs, c) != NULL) {
   +                if (ap[1] != NULL && strchr(ifs, c) != NULL) {

   Inspection of the control and data flow showed that variable
   "backslash" is always false (0) when the "if"-expression is
   evaluated, hence the whole block is effectively dead code.
   Additionally, the skipping of characters after a backslash is already
   performed correctly a few lines above, so this code is also not
   needed at all. According to the CVS logs and the ASH 0.2 sources,
   this code existed in this way already since its early days.

3. Cleanup Style:

   - ! trap[signo][0] == '\0' &&
   + ! (trap[signo][0] == '\0') &&

   The expression wants to ensure the trap is not assigned the empty
   string. But the "!" operator has higher precedence than "==", so the
   comparison should be put into parenthesis to form the intended way of
   expression. Nevertheless the code was effectively not really broken
   as both particular NUL comparisons are semantically equal, of course.
   But the parenthesized version is a lot more intuitive.

4. Remove shadowing variable declaration:

   - char *q;

   The declaration of symbol "q" hides another identical declaration of
   "q" in the same context. As the other "q" is already reused multiple
   times and also can be reused again without negative side-effects,
   just remove the shadowing declaration.

5. Just small cosmetics:

   - if (ifsset() != 0)
   + if (ifsset())

   The ifsset() macro is already coded by returning the boolean result
   of a comparison operator, so no need to compare this boolean result
   again against a numerical value. This also aligns the macros usage to
   the remaining existing code.

Reviewed by: stefanf@
2005-09-06 19:30:00 +00:00
Ralf S. Engelschall
7b14d37fb1 fix typo: ommitted -> omitted 2005-09-06 16:08:37 +00:00
Stefan Farfeleder
9957cb23dd Print pointers with %p rather than casting them to long. 2005-09-05 17:57:19 +00:00
Christian S.J. Peron
9b4261c9b4 Attempt to complete the userspace integration of POSIX.1e extended ACLs.
This includes adding support for ACLs into cp(1) and mv(1) userspace
utilities.

For mv(1), if _PC_ACL_EXTENDED is in effect for the source AND destination
operands, the destination file's ACLs shall reflect the source.

For cp(1), if _PC_ACL_EXTENDED is in effect for both source and destination
operands, and -p has been specified, the ACLs from the source shall be
preserved on the destination.

MFC after:	1 month
2005-09-05 04:36:08 +00:00
Stefan Farfeleder
a01459df60 Document that `in word ...' is optional in the for command. 2005-09-03 16:06:04 +00:00
Stefan Farfeleder
dbf2e1c54f Return 1 from the unalias builtin if _any_ removal fails, not just the last
one.
2005-09-02 22:43:28 +00:00
Stefan Farfeleder
49bd99efdc Remove extra getenv() declaration. 2005-09-02 22:28:27 +00:00
Stefan Farfeleder
de4ad3826b Document that unalias can be used to remove several alias names. 2005-09-02 21:15:56 +00:00
Gary W. Swearingen
34602d8e7e Improved descriptions of block size handling.
PR:             docs/84765
Submitted by:   garys
Approved by:    keramida
MFC after:      3 days
2005-08-31 17:58:38 +00:00
Jesus R. Camou
19162ab914 Wrap a line due to a new sentence.
Noticed by:	simon
Approved by:	trhodes (mentor)
2005-08-29 21:28:12 +00:00
Jesus R. Camou
a886288efd o Discuss the ways to escape an alias.
o Fix the alias syntax lines.
o Refer to the Aliases subsection.

PR:		docs/84914
Submitted by:	garys
Approved by:	trhodes (mentor)
MFC after:	3 days
2005-08-29 06:47:43 +00:00
Stefan Farfeleder
faa1ed35ac Document umask's -S option. 2005-08-17 19:44:15 +00:00
Stefan Farfeleder
811beb4b88 Remove a hack for an ancient gdb. 2005-08-15 17:49:38 +00:00
Stefan Farfeleder
711dc65d01 Recent cleanups made it possible to bump WARNS to 3. 2005-08-14 07:46:56 +00:00
Stefan Farfeleder
716b138b4b Put the comparison with PEOF into a new macro is_eof(). Don't use it if the
character comes from a string.
2005-08-13 15:47:13 +00:00