Commit Graph

2149 Commits

Author SHA1 Message Date
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
Stefan Farfeleder
adecfb8dfc Declare echocmd() and testcmd(). 2005-08-13 15:04:30 +00:00
Stefan Farfeleder
8d99957008 Use assignment rather than comparison. 2005-08-13 15:00:54 +00:00
Stefan Farfeleder
b37630e3a6 - Provide all initialisers for a struct event.
- Include init.h in the generated init.c.
- Generate prototypes and put the brace on the next line.
2005-08-13 08:38:02 +00:00
Stefan Farfeleder
79ea0bd9f3 First declare the functions to pacify -Wmissing-prototypes. 2005-08-13 08:31:37 +00:00
Stefan Farfeleder
955e9f68da Include missing headers. 2005-08-13 08:26:58 +00:00
Stefan Farfeleder
c789373981 Use prototypes in the MKINIT lines collected by mkinit. 2005-08-13 08:12:18 +00:00
Stefan Farfeleder
bfce4fe8c5 Use prototypes in the generated builtins.{c,h} files. 2005-08-13 08:09:22 +00:00
Stefan Farfeleder
643c91f9ee cvs -d stefanf@ncvs.FreeBSD.org:/home/ncvs 2005-08-13 07:54:23 +00:00
Stefan Farfeleder
7bdc89d779 El_parse's third parameter is now const-qualified, add a cast. 2005-08-11 20:28:26 +00:00
Stefan Farfeleder
5d3e07d4ac Fix a comment.
Submitted by:	Liam J. Foy
2005-08-07 09:11:38 +00:00
Poul-Henning Kamp
670f8414ea Don't install examples of NO_EXAMPLES 2005-08-03 09:22:03 +00:00
Giorgos Keramidas
9358c0e397 Spell "protections" correctly. 2005-07-28 18:28:11 +00:00
Giorgos Keramidas
5b5b96582a Spell "background" correctly. 2005-07-28 12:40:23 +00:00
Xin LI
0e3e87bd43 Fix a bug when shell expansion is done against dangling symlinks, by
converting the stat() call to a lstat() call, which will cover the
situation.  One can exercise this bug by referring a dangling link with
something like */the-link.

Approved by:	re (scottl)
Submitted by:	Simon 'corecode' Schubert [corecode fs ei tum de]
Obtained from:	NetBSD via DragonFlyBSD (NetBSD rev. 1.51 and DragonFly
		rev. 1.6)
MFC After:	3 days
2005-07-07 18:10:33 +00:00
Ruslan Ermilov
7b020a2f1e Sort sections.
Approved by:	re (blanket)
2005-06-14 08:25:54 +00:00
Ruslan Ermilov
fb039b55dc Sorted sections and fixed prompt (PS[12]) strings.
Approved by:	re (blanket)
2005-06-14 08:25:00 +00:00
Ruslan Ermilov
fd50df303c Put the description of the -c option in the right place, as
promised by the Argument List Processing section introduction.
What follows the option in the options list is its long name,
not its argument (as is the case for the -c option).  Also
sort references in the SEE ALSO section.

Approved by:	re (blanket)
2005-06-14 07:50:44 +00:00
Dag-Erling Smørgrav
ee66677a7a Remove kludges intended to support src trees with partial obj trees.
Discussed with:	ru
2005-06-10 06:12:53 +00:00
Dima Dorfman
24b0280f8c Remove the EXAMPLES section that describes how to sort by size using
sort(1). This functionality is provided by the -S option now, and it
is useful even though a similar effect is achievable with sort(1),
since the latter doesn't work in combination with -h. This option is
also present in NetBSD, OpenBSD, and GNU fileutils, so there's clearly
a demand for it.

Noticed by:	asmodai
2005-06-03 11:38:35 +00:00
Dima Dorfman
77a15272e7 Improve wording: A sort is "in" a particular order, not "by" a
particular order.
2005-06-03 11:22:06 +00:00
Dima Dorfman
71b8b74887 Add the -S option to sort files by size. NetBSD and OpenBSD already
have this option with identical semantics (sorting large files first).
-r can be used to reverse the sort if that is desired.

PR:		81625
Submitted by:	Kostas Blekos <mplekos@physics.upatras.gr>, keramida
2005-06-03 11:05:58 +00:00
Tim J. Robbins
500b4917ab The new name for the DIAGNOSTICS section is EXIT STATUS.
Noticed by:	ru
2005-05-31 12:57:44 +00:00
Tim J. Robbins
4129539639 Move information about exit status into a DIAGNOSTICS section. 2005-05-29 08:18:48 +00:00
Andrey A. Chernov
aaf9c3b784 Fix: printed output flags (onocr) and (onlret) same as oxtabs
PR:             81256
Submitted by:   Arseny Nasokin <tarc@tarc.po.cs.msu.su>
2005-05-26 06:57:57 +00:00
Maxime Henrion
8835fa2759 Correct a few places where we called warn() when warnx() should have
been used.

Submitted by:	"Liam J. Foy" <liamfoy@sepulcrum.org>
Obtained from:	DragonFlyBSD
2005-05-19 21:33:48 +00:00
Garance A Drosehn
01c7bd5378 A second attempt to adjust option-parsing on a shell command, for the
benefit of scripts start out as:     #!/bin/sh -- # -*- perl -*-
With this fix in place, we can commit a change to kern/imgact_shell.c
so FreeBSD will process the `#!' line in shell-scripts in a more
standard fashion.

PR:		16393
Mentioned on:	freebsd-arch
2005-05-16 04:32:41 +00:00
Dima Dorfman
7e81a15205 Add an interface to the lchflags(2) syscall. The new -h option is
analogous to chmod(1)'s -h. It allows setting flags on symbolic links,
which *do* exist in 5.x+ despite a claim to the contrary in the
chflags(1) man page.

Suggested by:	Chris Dillon
2005-05-14 23:23:10 +00:00
Mark Peek
6048f2e121 Define HAVE_STRUCT_UTMP_UT_HOST in order for the REMOTEHOST environment
variable to show up correctly.

Note: This is really a bug with the stock tcsh configure.in script not
including <sys/types.h> before <utmp.h>. But, since config.h is maintained
separate from the contrib sources, this is the correct fix.

Noticed by: ache
2005-05-04 20:21:57 +00:00
Maxim Konovalov
fa6c8d89c9 o Typo: s/teminal/terminal/.
Submitted by:	Michal Varga
2005-04-29 11:10:27 +00:00
Mark Peek
90d5800df2 Add in FreeBSD specific options for tcsh 6.14. 2005-04-24 19:51:57 +00:00
Mark Peek
ced7a1fd5b Add the config.h resulting from running the configure script.
Note: the contents of this file has changed between 6.13 and 6.14.
The old contents of this file has been repocopied to config_p.h.
2005-04-24 19:50:22 +00:00
Mark Peek
099f08ce6e Add new file (tc.nls.c) to the build. 2005-04-24 19:44:43 +00:00
Giorgos Keramidas
f1caa99d54 There is no /etc/rc.network anymore.
Submitted by:	Benjamin Rossen <b.rossen@onsnet.nu>
MFC after:	2 weeks
2005-04-17 23:22:22 +00:00
Giorgos Keramidas
38afdcbc3c Various sh(1) enhancements:
- Move the description of the ``-c string'' option closer to the option itself.
- Add an ENVIRONMENT section (1)
- Add more .Xr cross references to the SEE ALSO section.

Obtained from:  NetBSD (1)
2005-04-15 14:53:29 +00:00
Scott Long
fd525b85a7 Document problems with writing to disks under GEOM. 2005-04-07 20:50:38 +00:00
Pawel Jakub Dawidek
a990344f7e Add and document the 'jid' keyword for the '-o' option.
Reviewed by:	gad
MFC after:	3 days
2005-03-20 10:40:36 +00:00
David E. O'Brien
5f44e053cc Fix bin/pax doesn't wait for compress/gzip before exiting.
Submitted by:	Joerg Sonnenberger <joerg@britannica.bec.de>
Obtained from:	OpenBSD (commited fix to PR 3455)
2005-03-12 06:38:01 +00:00
Giorgos Keramidas
a762afe578 Use `.Pq Ql'' to quote single characters, instead of `.Pq Li''.
This makes the resulting output more aesthetically pleasing in
text-only terminals:

Reviewed by:	ru
2005-03-04 13:16:50 +00:00
Giorgos Keramidas
91ee1c5df6 Add a section describing the exit status of the shell.
Obtained from:	NetBSD
2005-03-04 12:40:07 +00:00
Tom Rhodes
c71158d453 Wrap BSD r* commands in NO_RCMDS.
Change NO_RCMDNS to NO_RCMDS and do the switch in bsd.compat.mk.

Discussed with: ru, nectar
2005-03-02 11:53:22 +00:00
David E. O'Brien
f0c73601c1 Support \H, \h, \w, \W, \$ string expansion in the prompt.
Submitted by:	mini
2005-03-01 03:35:58 +00:00
Alexey Zelkin
bed602166f Fix typo 2005-02-27 18:18:32 +00:00
Tom Rhodes
61001d7506 Fix a few markup nits in previous commit.
Noticed by:	ru, who else? :)
2005-02-25 00:40:46 +00:00
Tom Rhodes
a5e1813654 Note how cp(1) handles directories ending in "/."
PR:		75774
Submitted by:	Mike Meyer <mwm@mired.org> (original version)
2005-02-24 00:06:22 +00:00
Tom Rhodes
51cf632946 Add information on utilities which may or may not be aware of file flags.
PR:		55653
Submitted by:	Tony Maher <tonymaher@optushome.com.au> (original version)
2005-02-23 23:07:45 +00:00
Garance A Drosehn
5cc540d471 Change /bin/sh so *it* implements the processing needed for scripts to
work as expected when they have a "shebang line" of:

     #!/bin/sh -- # -*- perl -*- -p

This specific line is recommended in some perl documentation, and I think
I've seen similar lines in documentation for ruby and python.  Those
write-ups expect `sh' to ignore everything after the '--' if the first
thing after the '--' is a '#'.  See chapter 19, "The Command-Line Interface"
in 3rd edition of "Programming Perl", for some discussion of why perl
recommends using this line in some circumstances.

The above line does work on solaris, irix and aix (as three data points),
and it used to work on FreeBSD by means of a similar patch to execve().
However, that change to execve() effected *all* shells (which caused
other problems), and that processing was recently removed.

PR:		16393  (the original request to fix the same issue)
Reviewed by:	freebsd-current (looking at a slightly different patch)
MFC after:	1 week
2005-02-16 05:17:58 +00:00
Xin LI
6aac4c27da Several improvements to ps.1:
- Document the fact that empty heading text suppresses the
	  heading line (e.g. 'ps -o pid='), as this is very useful
	  in scripts.
	- Describe logname keyword more completely.
	- Describe the printing of arguments more completely.
	- Put lockname in the correct alphabetical order in the list
	  of all keywords.
	- Correct sentence in standards section.

Submitted by:	Jilles Tjoelker <jilles at stack nl>
PR:		docs/73618
MFC After:	1 week
2005-02-14 16:56:15 +00:00
Ruslan Ermilov
36a142c455 Expand contractions. 2005-02-13 23:45:54 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
Ruslan Ermilov
a89237ae95 Sync program's usage() with manpage's SYNOPSIS. 2005-02-09 17:37:39 +00:00
Christian S.J. Peron
237d4cef65 Since it is not un-common for a process's resident set size (rss)
to exceed 10 megabytes in size (especially in X), bump the max
column width from 4 bytes to 5. This will make the ps auxw output
uniform again when a process's rss exceeds 10 megs.

It should be noted that when 5 digits becomes to small, other
solutions should be explored such as displaying them in megabytes
or having ps automatically re-size column widths.

Discussed with:	gad
MFC after:	1 week
2005-02-06 16:34:49 +00:00
Alexey Zelkin
2b40ba25cc Use LC_MESSAGES locale category instead of value of LANG environment variable
while opening of tcsh's message catalog.  It gives us more flexibility, and
do not change current behaviour (since we call setlocale() here)

Submitted by:	Rostislav Krasny <rosti_bsd@yahoo.com>
PR:		bin/76773
MFC After:	3 days
2005-02-01 08:48:15 +00:00
Xin LI
c49d3c9bac Remove unnecessary SRCS= where could be guessed directly by our
bsd.*.mk infrasture.

Obtained from:	ru
2005-01-27 14:52:47 +00:00
Xin LI
cc7045ec4c ps(1) is WARNS=6 on all Tier-1 platforms as far as I can test,
so use default WARNS level from bin/Makefile.inc
2005-01-27 13:42:40 +00:00
Xin LI
6984496e54 Don't specify SRCS= when it can be obtained from PROGS= 2005-01-27 13:25:09 +00:00
Xin LI
18ec63de27 WARNS?=6 is already in bin/Makefile.inc, so remove this one. 2005-01-27 13:23:05 +00:00
Suleiman Souhlal
c591aa7413 Remove useless errno.h include.
Approved by:	grehan (mentor)
Obtained from:	DragonFlyBSD
2005-01-26 06:51:28 +00:00
Suleiman Souhlal
3118731323 Remove WARNS?= 6 from Makefile, since it is already in src/bin/Makefile.inc
Requested by:	ru
Approved by:	grehan (mentor)
2005-01-26 06:48:17 +00:00
Suleiman Souhlal
3ac2b17742 - The first argument of getmode() is a void *
- Add WARNS?= 6

Approved by:	stefanf, grehan (mentor)
Obtained from:	DragonFlyBSD
2005-01-25 14:31:19 +00:00
Ruslan Ermilov
462fbe1ec0 De-kerberize the manpage. 2005-01-21 09:31:38 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov
6fca4c7c3f Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
Philippe Charnier
34af7a1a38 no need to have break; after return; 2005-01-16 11:10:21 +00:00
Ruslan Ermilov
6a5796e734 Eliminate macro calls inside literal displays. 2005-01-15 12:28:01 +00:00
Ruslan Ermilov
5f05dfac32 Removed harmful empty lines that crept in during the copyright
header update.
2005-01-13 08:46:19 +00:00
Brian Somers
0e32d64e56 Don't decend into directories when -d is set and the directory itself doesn't
match.

PR:		28095
Submitted by:	bill at twwells dot com
MFC after:	7 days
2005-01-12 03:25:55 +00:00
Joerg Wunsch
1c7adc9b77 The total sum of blocks for the -l and -s option is printed always,
regardless whether the output is to a terminal or not.  As this is
consistent with the SUSPv2 specification (even though we do not
otherwise fully implement SUSPv2's ls(1) options), document this as it
is now, rather than trying to change the behaviour itself.

PR:		docs/76072
Submitted by:	Sebastian Rey <Sebastian.rey@gmx.net>
MFC after:	1 week
2005-01-11 08:51:21 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Warner Losh
130d846d9b Remove the clause 3, per berkeley and mail from rwatson representing
that nai was OK with all third clause removals.
2005-01-10 08:21:45 +00:00
Ruslan Ermilov
6fa13ec06f Scheduled mdoc(7) sweep. 2005-01-09 19:54:23 +00:00
Ceri Davies
6b4bbd8a2c Correct typo. 2005-01-04 12:44:25 +00:00
Robert Watson
85c5243c1d Remove single line containing the word "KLD" ommitted in ps.1:1.80.
Pointed out by:	ru (some time ago)
2004-12-22 09:04:47 +00:00
Ruslan Ermilov
a216173556 NOCRYPT -> NO_CRYPT 2004-12-21 10:16:04 +00:00
Ruslan Ermilov
83c7ade90a NOSHARED -> NO_SHARED 2004-12-21 09:59:45 +00:00
Maxim Konovalov
af5eb6fcc5 o Add a missed "." .
Reviewed by:	ru
MFC after:	3 weeks
2004-12-02 13:13:27 +00:00
Maxim Konovalov
0c77b3c9c1 o Terminate an endless loop sh -T goes into in dowait() around waitproc().
XXX from Tor: "The shell can also go into a similar loop if the child was
killed by signal 127, since the shell would believe the child to have
only stopped (WIFSTOPPED() macro returns nonzero value).  Disallowing
signals 127 and 128 will fix that problem."  See kern/19402 for details.

PR:				bin/66242
Submitted by:			tegge
Analysis and testcase by:	demon
MFC after:			3 weeks
2004-12-02 13:12:43 +00:00
Robert Watson
ac06cb0ad3 Point at the mac(4) man page when describing the -Z option.
Remove reference to /dev/lomac, which is no longer used by mac_lomac(4).

MFC after:	3 days
2004-11-29 12:00:24 +00:00
Ruslan Ermilov
0fba60818b Do not emit a spurious warning when "directory" argument
to "rmdir -p" is absolute, with one or more leading slash.
2004-11-20 00:41:08 +00:00
Ruslan Ermilov
d4af5f3250 Fixed "rmdir -p" that got broken by rev. 1.15.
(This also fixes "rmdir -v /nonexistent".)
2004-11-20 00:12:08 +00:00
Christian S.J. Peron
d8654c644a Use statfs instead of getmntinfo(). This will make the procfs checks
play nicer in prisons. It also simplifies things.

Reviewed by:	rwatson
Bumped into by:	Jilles Tjoelker
2004-11-19 16:11:54 +00:00
Christian S.J. Peron
a951d1f83b Currently if the user specifies -e and procfs is not mounted on /proc,
printing of the process environment will fail silently.

-define a function which will check to see if procfs is mounted on /proc
-Implement this test if the user specified -e
-If procfs is not mounted on /proc and -e was specified, print a warning.
 informing the user that procfs(5) is required.

Reviewed by:	wes, rwatson
2004-11-14 19:30:02 +00:00
Ruslan Ermilov
832b0b55ac Removed bitrot. 2004-11-13 17:12:22 +00:00
Yaroslav Tykhiy
5512dc5460 Fix off-by-one errors and potential buffer overruns
WRT handling file and link names that reach the allowed
maximum for old tar and ustar archive formats.

PR:		bin/40466
Submitted by:	Cyrille Lefevre <email in the PR> (portions)
Reviewed by:	freebsd-arch (silence)
MFC after:	1 month
2004-11-13 10:56:35 +00:00
Jordan K. Hubbard
de3abdfaf4 UNIX conformance: If -r -f on non-existent directory, don't emit error. 2004-11-13 04:07:01 +00:00
Andrey A. Chernov
b56bffc41b Back out recent TTYDEF_LFLAG_ECHO invention.
This change is NOP, because TTYDEF_LFLAG = TTYDEF_LFLAG_ECHO now,
but to minimize diffs with other BSDs.
2004-11-06 13:56:18 +00:00
Ruslan Ermilov
dee651eb15 Introduce the PRECIOUSPROG knob in bsd.prog.mk, similar
to PRECIOUSLIB from bsd.lib.mk.  The side effect of this
is making installing the world under jail(8) possible by
using another knob, NOFSCHG.

Reviewed by:	oliver
2004-11-03 18:01:21 +00:00
Poul-Henning Kamp
9372ddf0d1 stty sane should set the echo bits.
PR:	73423
Submitted by:	Michiel Boland <michiel@boland.org>
Overlooked by:	phk
2004-11-02 18:10:01 +00:00
Alfred Perlstein
43d6677ba1 When listing the special $ variables, ($!, $#, etc) list them as $!
instead of just !, this allows one to more easily locate/understand
the section of the manpage in question.

Additional wording correction by: keramida
Reviewed by: keramida
2004-11-01 19:05:04 +00:00
Xin LI
164d3f0bdc Correct a typo and make the documentation more mdoc(7) complaint.
Pointed out by:	dd
Approved by:	murray (mentor)
2004-11-01 16:52:34 +00:00
Xin LI
24c0f7385b Add -I, an option that asks for confirmation once if recursively
removing directories or if more than 3 files are listed in the
command line.

This feature is intended to provide a safe net but not being too
annoying like having "rm -i" for every deleting operations, and
is generally good for both newbies and power users, preventing
them from being so easily run into ``rm -rf /'', ``rm -rf *''
and so forth.

Originally implemented by Matthew Dillon for DragonFly, plus
some improvements done by various DragonFly contributors.

Approved by:	murray (mentor; the original dillon's version)
Discussed with:	des
Obtained from:	DragonFly's bin/rm/
		rm.c rev. 1.4 - 1.8
		rm.1 rev. 1.3 - 1.4
MFC After:	1 month
2004-10-28 08:25:30 +00:00
Dag-Erling Smørgrav
3f91ab9262 The previous commit added code to rm(1) to warn about and remove any
occurrences of "/" in the argument list.  This corresponds to Enhancement
Request Number 5 in the Austin Group TC2 Aardvark's XCU Defects Report
(<URL:http://www.opengroup.org/austin/aardvark/finaltext/xcubug.txt>).
Further discussion is available in the Austin Group mailing list archives
(<URL:http://www.opengroup.org/austin/mailarchives/>, "Defect in XCU rm")
and for Austin Group members, in the Austin Group Interpretations archive
(<URL:http://www.opengroup.org/austin/interps/>, AI-019)

This commit makes that check conditional on !POSIXLY_CORRECT, since it
is not strictly correct according to the current version of the standard
(but is expected to be correct according to the next version, and has
already been adopted by Solaris).
2004-10-04 19:24:28 +00:00
Dag-Erling Smørgrav
3a667dafcc Markup fixes.
Pointed out by:	ru
2004-10-04 19:03:44 +00:00
Dag-Erling Smørgrav
68ef5f71b0 Find out how flame-proof my underwear really is. 2004-10-04 11:26:01 +00:00
Dag-Erling Smørgrav
c335b1ecdb Whitespace cleanup. 2004-10-04 11:14:12 +00:00
Stefan Farfeleder
363d31466e chflags compiles with WARNS?=6. 2004-10-03 15:03:15 +00:00
Stefan Farfeleder
26663dcbd5 Garbage collect a variable whose value was never read. 2004-10-03 14:55:36 +00:00
Dag-Erling Smørgrav
bd7667733f Attempting to unset an undefined variable or function should not be
considered an error according to the Open Group Base Specification.

PR:		standards/45738
Submitted by:	Matthias Andree <matthias.andree@web.de>
MFC after:	3 days
2004-09-27 18:43:18 +00:00
David Schultz
7f5685bb49 Don't read the byte at *argv[strlen(*argv) + 1].
PR:		71743
2004-09-24 06:57:26 +00:00
Giorgos Keramidas
fc6db5e37c Group equivalent flags together and delete the `aliases' section.
PR:		docs/70856
Submitted by:	Rostislav Krasny <rosti_bsd@yahoo.com>
2004-09-21 10:13:34 +00:00
Robert Watson
e3edab4a91 Add a "fillchar" command line argument to dd(1) that permits the user
to specify an alternative padding character when using a conversion
mode, or when using noerror with sync and an input error occurs.  This
facilities reading old and error-prone media by allowing the user to
more effectively mark error blocks in the output stream.
2004-08-15 19:10:05 +00:00