Commit Graph

2280 Commits

Author SHA1 Message Date
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
Yaroslav Tykhiy
d3e240cb45 Change the behaviour of `-v' so that, e.g., stepping a month back
on March 31 won't take you to March 2 or 3 (now the result will
be the last day of February.)

In general, now stepping by months from the last days of the current
month A will take you to the very last day of the target month B if
B is shorter than A.

The previous version would just step to March 31 and rely on mktime(3)
to correct the date.  Despite its simplicity, such way was counter-intuitive
to users and caused pain to shell script writers.

Noticed by:	Igor Timkin <ivt at gamma dot ru>
Approved by:	brian
MFC after:	2 weeks
2004-08-09 13:43:39 +00:00
Colin Percival
d37df47d31 Join the 21st century: Cryptography is no longer an optional component
of releases.  The -DNOCRYPT build option still exists for anyone who
really wants to build non-cryptographic binaries, but the "crypto"
release distribution is now part of "base", and anyone installing from a
release will get cryptographic binaries.

Approved by:	re (scottl), markm
Discussed on:	freebsd-current, in late April 2004
2004-08-06 07:27:08 +00:00
Gordon Tetlow
5036802031 Now that we have gcc 3.4, we can flip ia64 to using a dynamically linked
/bin and /sbin.

Reviewed by:	marcel (via pluto1)
2004-08-06 00:07:26 +00:00
Pawel Jakub Dawidek
1e1d03d7fc Allow for capital letters as size suffixes.
Inspired by:	le
Approved by:	green (maintainer)
2004-07-31 15:13:08 +00:00
Christian S.J. Peron
239c9e601a Currently if a mount point is not accessible by the calling user,
invalid information will be printed if the -t flag is specified.

$ df -t ufs
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/ad0s1a    495726   139944   316124    31%    /
/dev/ad0s1e    253678     6438   226946     3%    /tmp
/dev/ad0s1f  56206340 13594248 38115586    26%    /usr
/dev/ad0s1d    694126    19812   618784     3%    /var
/dev/ad0s1d    694126    19812   618784     3%    /var
$

Note that the mount point which is not accessible shows
up as the previous file system that was printed. The reason
for this is that df -t will call statfs(2) on the pathname
supplied by getfsstat(2).

This is done to refresh the file system statistics in the
event that a previous file system had a long delay in
providing its stats.

This change affects the df utility in the following ways:
o Teach df has to deal with statfs(2) failing. If statfs(2)
  fails, fall back on the possibly stale stats provided by
  the initial call to getfsstat(2).
o Print a warning that the fs stats could possibly be stale
o Modify the man page and document this new behavior
  as a bug.

Approved by:	bmilekic (mentor)
PR:		68165
2004-07-20 18:24:47 +00:00
Tim J. Robbins
2c61418d05 Use warn() instead of perror(). 2004-07-20 05:52:00 +00:00
Alfred Perlstein
8a0f7000e6 Give the most awesome example of how to parse the output of date
back into epoch time.  Everytime I'm asked to do this by someone I
have to spend about ten minutes recreating the same command line.
So record it under examples.
2004-07-17 00:26:31 +00:00
Tim J. Robbins
5292d2aec0 Remove BUGS section that talked about missing multibyte character support.
We have support now that the regular expression routines do.
2004-07-12 10:46:55 +00:00
Mark Peek
e62468e489 KANJI and DSPMBYTE are now "on" by default in the tcsh 6.13.00 distribution. 2004-07-11 02:23:38 +00:00
Tim J. Robbins
128dc4a2e3 Document missing multibyte character handling in utilities specified
by POSIX.
2004-07-03 02:03:44 +00:00
Tim J. Robbins
ee70653ec9 Clarify: test compares strings by binary value, not "ASCII value". 2004-07-03 01:49:17 +00:00
Ruslan Ermilov
1171aedcdf Deal with double whitespace. 2004-07-03 00:06:28 +00:00
Ruslan Ermilov
eccea571a7 Mechanically kill hard sentence breaks. 2004-07-02 21:04:19 +00:00
Ruslan Ermilov
d37ea99837 Removed trailing whitespace. 2004-07-02 19:07:33 +00:00
Garance A Drosehn
70548f642a Change the "rtprio" format so it prints an informative string for
the PRI_ITHD case (instead of just printing the digit '1').

Submitted by:	Cyrille Lefevre
2004-06-27 23:59:38 +00:00
Garance A Drosehn
f2fbfae6b0 Improve checking for `ps -t <dev>', and give better error messages when
an invalid <dev> is specified.  Aside:  It turns out that the S_ISCHR()
check is true for almost every device that we have (not just tty's).
2004-06-27 22:56:58 +00:00
David E. O'Brien
c33c2570d3 Don't continue if the '-C' option (a-la GNUtar; commited in options.c
rev 1.18, but not documented in the man page) caused a failed chdir.
Otherwise, one can easily overwrite files.

Submitted by:	Robert Nagy <robert@openbsd.org>
Obtained from:	OpenBSD
2004-06-25 05:27:59 +00:00
Garance A Drosehn
bd6233fd5d Fix a bug I introduced by some last-minute changes in -r 1.102. I ended
up checking the wrong variable for NULL.

Submitted by:	bde
2004-06-24 03:15:18 +00:00
Garance A Drosehn
23b8efad7a Rework the logic for `-t <tty>', such that it accepts "ttyp0" and "console",
in addition to "/dev/ttyp0" or "p0"  and  "/dev/console" or "co".
2004-06-24 01:57:59 +00:00
Garance A Drosehn
bdf8ab4692 Change "struct varent" to use the standard queue(8) macros, instead of
using it's own version of the same basic algorithm.

Submitted by:	part by Cyrille Lefevre, part of it done by me
2004-06-23 23:48:09 +00:00
Garance A Drosehn
dd693acf27 Add a check for defunct processes in saveuser(), so the output for "args"
(aka "command") will display "<defunct>", as does the output from "comm"
for those processes.  Also do better checking for malloc() failures.

Submitted by:	Cyrille Lefevre
2004-06-23 21:17:25 +00:00
Garance A Drosehn
4e8a8d9f85 Avoid padding the value of "ucomm" when it is the last column in the line.
Submitted by:	Cyrille Lefevre
2004-06-23 12:18:36 +00:00
Garance A Drosehn
820434b27f Make sure the value of "upr" (scheduling priority on return from system call)
is scaled in the same way that "pri" (scheduling priority) is scaled.

Submitted by:	Cyrille Lefevre
2004-06-23 11:56:57 +00:00
Garance A Drosehn
31172f6e1b Include the `-c' option in the usage() message.
Submitted by:	Cyrille Lefevre
2004-06-23 11:40:56 +00:00
Garance A Drosehn
b4b243242b In the sorting routine, sort by thread-id if two processes have the same PID.
Submitted by:	Cyrille Lefevre
2004-06-23 11:28:17 +00:00
David Malone
f137c9c100 Fix some style bugs I introduced pointed out by bde. Also add a blank
line after the empty variable declarations.

Reviewed by:	md5
2004-06-23 08:26:31 +00:00
David Malone
60e52383e7 Use nanoseconds and then lexicographic ordering when the seconds of
the [acm]time are the same. I was going to use Scott's patch, but I
couldn't get the style quite right, so I used a patch of my own.

Submitted by:		Scott Mitchell <scott+freebsd at fishballoon.org>
MFC after:		3 weeks
2004-06-22 16:02:29 +00:00
Garance A Drosehn
29d2bd4314 Get rid of a cast to '(void) ' on the return of a call to strcpy. 2004-06-22 02:18:29 +00:00
Garance A Drosehn
bdbc9a5cb9 Oops. Undo that last 'const' change. It expects similar changes to some
other files that I am not ready to commit yet...
2004-06-22 02:15:58 +00:00
Garance A Drosehn
db6e0b8b03 Add 'const' to a few places.
PR:		bin/65803
Submitted by:	Cyrille Lefevre
2004-06-22 02:06:42 +00:00
Garance A Drosehn
e4b70e6697 When displaying the "COMMAND" field for system-processes and/or kernel
threads, put the command name in square brackets instead of parenthesis.
This matches NetBSD, and also seems to be what linux does.  The sentence
which is added to the man page is taken straight from NetBSD.

PR:		bin/65803
Submitted by:	Cyrille Lefevre
Obtained from:	NetBSD
2004-06-22 01:59:54 +00:00
Garance A Drosehn
16ac318df7 Have `ps' return the cputimes for zombies, with the assumption that
kvm_getprocs() will provide useful information if it can, or *it*
will provide a zero value if it can not find something appropriate.

Submitted by:	bde
2004-06-21 16:53:11 +00:00
Garance A Drosehn
15b87b531e Add the `-O emul' format option, which prints the name of the system-call
emulation environment the process is in.  "emul" as a keyword is picked
up from OpenBSD.

PR:		bin/65803
Submitted by:	Cyrille Lefevre
2004-06-20 23:40:54 +00:00
Garance A Drosehn
ce1affa2ac From SUSv3:
Any [standard output] field need not be meaningful in all
    implementations. In such a case a hyphen ('-') should be
    output in place of the field value

So have the `-O label' option print out the string "  -" if the
process has no label.

Approved by:	Silence from rwatson and green (when asked in March...)
2004-06-20 22:31:37 +00:00
Garance A Drosehn
76adc1fd42 Add new output-format keywords of LWP and NLWP, which show the thread-id
and number-of-threads tied to a process.  Result can be seen by typing,
e.g.:   ps -HO lwp,nlwp
These new options are not documented yet.  More options will be coming,
and I will update the man page after I get farther along.

PR:		bin/65803  (though adjusted to fit our present source)
Submitted by:	Cyrille Lefevre
2004-06-20 22:22:49 +00:00
Garance A Drosehn
4bac4483db Have the main() routine calculate %CPU and (if needed) memory information
when copying per-process info before starting to sort the list.  This way,
sort-by-CPU or sort-by-memory will only calculate values once-per-process,
instead of twice-per-comparison.  Also take advantage of this to simplify
the pscomp() routine.
2004-06-20 21:25:10 +00:00
Maxim Konovalov
96819f939c Typo: s/SunOP/SunOS/g. 2004-06-16 12:57:31 +00:00
David E. O'Brien
503d530bde style.Makefile(5) 2004-06-13 19:22:53 +00:00
David Schultz
70bad4f75b If we are asked to print the total number of blocks, do so even if we
have no entries to print (either due to an empty directory or an
error).  This makes the -l and -s options more consistent, like
Solaris and (Debian) Linux.  To make this happen, tweak two
optimizations on the second call to display():

- Don't skip display() altogether, even if list == NULL.
- Don't skip the call to the printfn in display() if we
  need to print the total.

PR:	45723
2004-06-08 09:30:10 +00:00
David Schultz
48a91b69b8 Remove from the printfns the assumption that dp->list != NULL. Even
if there are no entries, these functions may be called to print the
total number of blocks (0) for consistency's sake.
2004-06-08 09:27:42 +00:00
Yaroslav Tykhiy
37ad0f498f Remove a duplicated description of the test for the null string.
MFC after:	3 days
2004-06-07 12:47:31 +00:00
Yaroslav Tykhiy
593cc6f338 Describe how test(1) will evaluate its expressions for a symlink.
Inspired by:	SUSv3
MFC after:	1 week
2004-06-07 12:42:38 +00:00
Tim J. Robbins
7807cb2439 Plug file descriptor leak in implementation of -n option. 2004-06-05 02:32:21 +00:00
David Schultz
841fe8e83f Convert fsbtoblk() from a macro to a function. The redundant
instances of 64-bit arithmetic were costing 775 bytes, and the
inlining offered no benefit.  Moreover, ambiguity as to the argument
types led to the introduction of a bug (see rev 1.56).

Also, remove some casts that are now clearly redundant.

Inspired by:	67467
2004-06-04 09:30:51 +00:00
Lukas Ertl
7fcc4669d8 Plug small memory leak.
PR:             bin/67392
Submitted by:   Matthew Emmerton <matt@gsicomp.on.ca>
MFC in:         1 week
2004-06-03 15:04:00 +00:00
Garance A Drosehn
ecbb06f865 Try to change the isdigitch() macro to something that Bruce won't roll
his eyes at quite so much...  (actually someone else pointed this out
to me a long time ago, but apparently I never fixed it)
2004-06-01 23:27:11 +00:00
Garance A Drosehn
c23b00b7ca A few more style-fixes from Bruce. The only non-cosmetic change
is to drop a call to setuid() which has not been needed for years.

Noticed by:	bde
2004-06-01 22:19:16 +00:00
Garance A Drosehn
a9626fb3b4 Since I'm not ready to add the non-standard ADD_PS_LISTRESET feature,
remove the #ifdef for it for now.  I might add the feature for real at
some later date, there isn't much reason for the #ifdef for now.
2004-06-01 19:00:42 +00:00
Garance A Drosehn
251130839b Make a few style-istic improvements to the previous commits.
Noticed by:	bde
2004-06-01 18:12:04 +00:00
Garance A Drosehn
de1702f459 Fix so `ps' catches and complains about null-values specified for a
process id, instead of using pid==0.  Ie, `ps -p 12,' and `ps -p ,12'
are now errors (instead of being treated like `ps -p 0 -p 12').

Noticed by:	Cyrille Lefevre on freebsd-arch
2004-06-01 03:01:51 +00:00
Garance A Drosehn
bf46a3bf10 Additional tiny adjustment to kludge-option processing so `ps t p0'
is treated like `ps -t p0', instead of changing it to `ps -T p0'.
Note that `ps t' is still changed to `ps -T', since that is one of
the main reasons for this kludge processing...

Noticed by:	Jilles Tjoelker on freebsd-arch
2004-06-01 02:31:44 +00:00
Garance A Drosehn
c675340a5c Rewrite the kludge-option processing to improve how it handles a few
more special situations.  This is the code which process `ps blah',
when "blah" does not include a leading '-'.

This change also removes a long-undocumented BACKWARD_COMPATIBILITY
compile-time option, where:
     ps -options arg1 arg2
(with no '-' on "arg1" and "arg2") was treated as:
    ps -options -N arg1 -M arg2

This also changes `ps' to check for any additional arguments after
processing all the '-'-options, and attempt to use those arguments as
a pid or pidlist.  If an extra argument is not a valid pidlist, then
`ps' will print an error and exit.  This seems a more generally useful
extension of the kludge-option processing than the -N/-M behavior, and
has fewer confusing side-effects.

Reviewed by:	freebsd-arch
2004-06-01 02:03:21 +00:00
Pawel Jakub Dawidek
478aa80510 Use humanize_number(3).
Reminded by:	jhb
2004-05-25 14:53:47 +00:00
Garance A Drosehn
585bf55792 Add pgrep(1) and pkill(1) to the cross-reference section of ps(1). 2004-05-25 14:05:25 +00:00
Pawel Jakub Dawidek
7d3940bb67 Use humanize_number(3) to format sizes into a human readable form. 2004-05-24 22:22:29 +00:00
Stefan Farfeleder
e0cd241f8b Include <stdio.h> for a sprintf() prototype.
Approved by:	das (mentor)
2004-05-24 10:11:31 +00:00
Garance A Drosehn
259fcfacc4 Add the 'sid' info to the output of `ps -j', to make up for the 'sess'
(session-pointer) info which was dropped from `ps' earlier in 5.x.

PR:		bin/59423
Submitted by:	Jilles Tjoelker
2004-05-23 21:35:35 +00:00
Garance A Drosehn
2631c7774f Fix the kludge-old-options processing so `ps tpt' will be treated the
same as `ps -tpt', instead of being changed into `ps -tpT'.

PR:		bin/52489
Submitted by:	Jilles Tjoelker
MFC after:	1 week
2004-05-23 21:21:07 +00:00
Garance A Drosehn
7bd421650b Change `ps' to use the KERN_PROC_RGID and KERN_PROC_SESSION options
(if trying to match only one real-group or one session-id), now that
those options are implemented in src/sys/kern/kern_proc.c (v1.203).

PR:		bin/65803  (a very tiny piece of the PR)
Submitted by:	Cyrille Lefevre
2004-05-22 23:13:58 +00:00
Ruslan Ermilov
287d1861eb Assorted markup fixes. 2004-05-16 21:35:05 +00:00
Ruslan Ermilov
2d3640781e Punctuation. 2004-05-16 21:34:49 +00:00
Ruslan Ermilov
093be00a00 Fixed spelling of the document date. 2004-05-16 21:34:31 +00:00
Ruslan Ermilov
2360f509c5 Bump document date for the latest functional change.
Minor markup tweaks.
2004-05-16 21:34:15 +00:00
Ruslan Ermilov
b0cb98e238 DESCRIPTION was not updated for the new SYNOPSIS. 2004-05-16 21:33:48 +00:00
Ruslan Ermilov
6a50100135 Added -v to usage(). 2004-05-16 20:41:11 +00:00
Olivier Houchard
c1b2de5af0 Use WARNS?=3 for these in the arm case for now, due to toolchain issues. 2004-05-14 13:31:21 +00:00
Tim J. Robbins
6449b88bf1 Only add the widths together for printable characters in prn_normal();
unprintable characters have a "width" of -1.
2004-05-03 11:48:55 +00:00
Tim J. Robbins
107409f46e Treat filenames as multibyte character strings (according to the current
LC_CTYPE setting) when determining which characters are printable.
This is an often-requested feature.

Use wcwidth() to determine the number of column positions a character
takes up, although there are still a few places left where we assume
1 byte = 1 column position, e.g. line-wrapping when handling the -m option.

The error handling here is somewhat more complicated than usual: we do
our best to show what we can of a filename in the presence of conversion
errors, instead of simply aborting.
2004-05-02 11:25:37 +00:00
David Schultz
87a99f5ff2 Various quibbles:
- Print a diagnostic if kdumpenv() fails.  This can occur due to MAC
  restrictions or lack of memory.  Catch all kenv(2) failures as well.
- Just of the heck of it, DTRT if the kernel environment size changes
  at the wrong time.  The old code could fail silently or fail to
  null-terminate a buffer if you got exceptionally unlucky.
- Sort and GC the #includes.
2004-04-28 01:27:36 +00:00
David E. O'Brien
c6f13844f6 Fix some style issues in rev 1.58.
Use 64-bit integer math vs. mixed FP & integer.
Add -g to the usage().
2004-04-22 17:05:08 +00:00
David E. O'Brien
7fed1986d0 Add 'g' to SYNOPSIS. 2004-04-22 16:33:54 +00:00
David E. O'Brien
cca108e6a2 Fix printing of the "Mounted on" values for 'df -i'.
Fix spacing before "Mounted on" column in general.

Submitted by:	bde
2004-04-22 16:26:05 +00:00
David E. O'Brien
076419d207 Add -c option simular to du(1).
PR:		19635
Submitted by:	cyrille.lefevre@laposte.net
2004-04-18 20:56:31 +00:00
Brian Feldman
4ad8968a7f Document the "return" built-in better: it will exit . (sources) and
the top-level shell instance, too.
2004-04-14 15:58:50 +00:00
Nate Lawson
3066c4a4bd Style fixes and add gen to CLEANFILES.
Submitted by:	bde
2004-04-09 07:13:27 +00:00
Brian Feldman
640c4d40fb Give date(1) a much better SYNOPSIS section which is useful as more than
decoration.  Further improvements are welcome, but at least this
is a separate of the various modes of operation date has, as well as
sectioning off the two deprecated options for settimeofday(tz) that
don't even apply to actual operation of date as such, anyway.
2004-04-06 22:03:38 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Garance A Drosehn
b193355dc4 Drop the include of <stdint.h>, since r1.84 removed references of intmax_t. 2004-04-04 17:43:48 +00:00
Garance A Drosehn
9bf69950e1 Add back the `-e' option, which was mistakenly dropped when cleaning
up the PS_ARGS string in revision 1.69 (and which was apparently not
missed by anyone...).
2004-04-04 17:15:44 +00:00
Garance A Drosehn
d822163f3b Give a name of 'l' (list) to the union in struct listinfo. This is
because some compilers (such as gcc 2.95.4) do not support having an
unnamed union for a field in a struct.
2004-04-04 04:41:51 +00:00
Bosko Milekic
263377339c Stop iterating over ACLs if we've already determined we
will print them (i.e., number of successful calls to acl_get_entry()
exceeds 3).  This makes O(1) what was O(num_TYPE_ACCESS_ACLs).

This is a slightly modified version of submitter's patch.

PR: bin/65042
Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
2004-04-03 16:55:56 +00:00
Garance A Drosehn
396e20d19f Add spaces after flag names on .Fl macros.
Noticed by:	ru
MFC after:	4 days
2004-04-01 13:28:36 +00:00
Garance A Drosehn
8ed0d42fe4 Describe the sorting options in better and more complete detail.
Also improve the description of `-L' a little.

MFC after:	4 days
2004-03-31 23:51:12 +00:00
Garance A Drosehn
0b42be7cb7 Switch to using strtoul() for parsing a potential UID or GID, which gets
this to correctly handle UID's and GID's larger than 2147483647.

Noticed by:	bde
MFC after:	1 week
2004-03-30 04:20:33 +00:00
Garance A Drosehn
f35e071573 Bruce would really like the prototype for fmt() to be split across lines
this way (although I still think it "looks weird"...).

Requested by:	bde
MFC after:	1 week
2004-03-30 02:02:40 +00:00
Garance A Drosehn
ba50b0e03a Minor style fixes, mostly adding indent-protection on some comment-blocks.
Noticed by:	bde
MFC after:	1 week
2004-03-30 01:59:22 +00:00
Garance A Drosehn
5bd7b1f3c0 Replace pscomp() with a cleaner version, mostly written by bde (*).
This corrects a problem of lost-precision for `-r' (sort-by-CPU).  Also,
for sort-by-CPU and sort-by-memory, any processes which have the same
value CPU or MEMORY are now sorted by TTY and then (if needed) by pid.

(* - I just added the NODEV checks, after doing some testing of my own)

Submitted by:	bde
MFC after:	1 week
2004-03-30 01:45:23 +00:00
Garance A Drosehn
c46bb4b3ff Oops. Remove some ';'s in #defines added by a previous update.
Noticed by:	bde
2004-03-29 03:03:28 +00:00
Garance A Drosehn
c7910c3ae3 Have this source explicitly include <sys/proc.h>, since it references
values such as P_CONTROLT and PS_INMEM.  But this still won't define
PID_MAX for us, since that is hidden inside of '#ifdef _KERNEL'.

Noticed by:	bde
2004-03-29 01:27:13 +00:00
Garance A Drosehn
87e47750f2 Since "kp" is a pointer, I should be comparing against NULL not 0.
Noticed by:	bde
2004-03-29 01:18:13 +00:00
Garance A Drosehn
352b652398 Various style improvements, mostly in comments and indentation.
Suggested by:	bde (well, for most of them)
2004-03-29 01:15:27 +00:00
Garance A Drosehn
ca62e195dd In the routines I've been working on, sort the variable declartions
so that non-pointers are listed after pointer-type variables.

Noticed by:	bde
2004-03-29 00:25:09 +00:00
Garance A Drosehn
1d2324f442 Split two 'fmt' strings so they're easier to read on 80-char windows. 2004-03-29 00:16:19 +00:00
Garance A Drosehn
de800cd4f8 Sort the declarations of global variables. 2004-03-29 00:12:03 +00:00
Garance A Drosehn
4857f240e1 Sort the routine prototypes. 2004-03-28 23:44:29 +00:00
Garance A Drosehn
5dfd7724a3 If <x> is a process id that does not exist, then just print the header
(if any) and exit, thus matching the behavior on -stable and other OS's.
My earlier attempt to fix this (v1.65) only seemed to work because of a
lucky random value in nentries (which was not being initialized back
when I tested that earlier patch).
2004-03-28 03:00:56 +00:00
Garance A Drosehn
3998d22271 Fix `-o rtprio' so it prints the correct value.
PR:		bin/59417
Submitted by:	Jan Willem Knopper
This fix by:	bde (in the audit-trail of the PR)
2004-03-28 02:13:31 +00:00
Garance A Drosehn
e3c4e1dd77 If a non-existent user is given as part of `-U userlist', treat it as
a fatal error instead of a minor warning.  It is possible that a few
users are used to the previous behavior, but I'm claiming it was a bug.
2004-03-27 22:14:42 +00:00
Garance A Drosehn
29d58b106b Explicitly wrap two long-ish linesi of code, to make them easier to read. 2004-03-27 21:59:54 +00:00
Garance A Drosehn
b34f38ae9e Change the #if-ish logic which is used to add the -f' option when ps'
is compiled with LAZY_PS, so that there is only one PS_ARGS string to
modify when changing the option-list.  Also get `-f' to show up in the
usage() statement when compiled with LAZY_PS.
2004-03-27 21:56:49 +00:00
Garance A Drosehn
4a355d176d Move the 'f' case so it shows up in the right place, alphabetically. 2004-03-27 21:40:04 +00:00
Garance A Drosehn
3dc91da529 Update the date on the man page, since this the previous change added
a few new options.
2004-03-27 18:26:40 +00:00
Garance A Drosehn
a4c8a745a8 Support more POSIX/SUSv3 options:
- Change `-p' to allow a list of process IDs, and `-t' to allow a list
  of terminal names, instead of only a single value for each.
- Add the `-A' option of SUSv3, which is exactly the same as `-ax'.
- Add the `-G gidlist' (group id).
- Allow any of these "selector options" to be specified multiple times,
  and have `ps' keep adding to a given list -- instead of replacing the
  previously-specified values.
- Fix interactions between selector-options, so that: "If any are
  specified, ... ps shall select the processes represented by the
  inclusive OR of all the selection-criteria options." (from SUSv3)
- Add a `-X' option, which is the reverse of the `-x' option.

- various minor improvements in parsing and error handling.

This does not get us to match POSIX/SUSv3, but it gets us closer.  The
`-g pgidlist', `-R ruserlist' and `-s sidlist' options mentioned in
freebsd-standards are still under debate, so they skipped for now.
It should be true that this introduces no user-visible incompatible
changes, except to support "new stuff" that was not supported before.
2004-03-27 18:22:17 +00:00
Ruslan Ermilov
f9a480abb1 Avoid the manpage layering violation and low-level implementation
details of libkvm, and just tell what the getbootfile(3) function
will return, by using the text from netstat(1) and dmesg(8).
2004-03-26 08:54:27 +00:00
Ruslan Ermilov
cd31922f27 - Remove references to /dev/kmem -- ps(1) utilizes the
sysctl(3) interface in kvm(3).
- Document the correct default when no -N is specified.
- Remove stale reference to /var/db/kvm_kernel.db.
- Remove stale reference to /var/run/dev.db.
2004-03-26 08:29:38 +00:00
David E. O'Brien
2edbecc6db Remove WFORMAT, style.Makefile(5). 2004-03-22 03:17:36 +00:00
Pawel Jakub Dawidek
3184e92100 When symbolic link is pointed onto a mount point, it can't be moved
to a different file system.
Patch in PR was incorrect.

PR:		bin/64430
Submitted by:	Samuel Tardieu
MFC after:	3 days
2004-03-21 13:38:37 +00:00
Tim J. Robbins
b59ca66070 Document incorrect handling of multibyte characters. 2004-03-21 11:24:06 +00:00
Tim J. Robbins
f791df19bd Document incorrect handling of multibyte characters in filenames. 2004-03-21 11:16:24 +00:00
Tim J. Robbins
744e4bba0e Reduce redundancy in the description of the -u option. 2004-03-21 11:04:59 +00:00
Tim J. Robbins
f74d4353ce Document incorrect handling of multibyte characters when -t and -v options
are used.
2004-03-21 11:02:40 +00:00
Dag-Erling Smørgrav
1afaec9ae4 Add a -v (verbose) option. 2004-03-21 04:56:06 +00:00
Ruslan Ermilov
4995f06772 Install /bin/sh safely. This allows a shell script to be used
to strip binaries by specifying it in the STRIPBIN environment
variable honoured by install(1).

MFC after:	3 days
2004-03-18 10:55:47 +00:00
Garance A Drosehn
2e6c6ac4d7 Fix 'ps -p proclist' and 'ps -u userlist' so the command returns non-zero
if no processes were matched.  Also sorts the list of 'int's in main, as
long as I had to add another one...

Noticed by:	Nate Lawson
MFC after:	10 days
2004-03-18 01:28:23 +00:00
Garance A Drosehn
4e8b6a6fb0 Improvements to 'ps -p <x>'. If <x> is a process id that does not exist, then
just print the header (if any) and exit, thus matching the behavior on -stable
and other OS's.

Also adds support for <x> being a comma-separated list of processes, and does
a much better checking for invalid-values of <x>, such as 'ps -p someword'.

Reviewed by:	mentioned on freebsd-current
MFC after:	10 days
2004-03-17 22:46:58 +00:00
Colin Percival
3ed29c96cf Fix memory leak
PR:		bin/64321
Submitted by:	Rodney Ruddock <rodney@interopsystems.com>
MFOpenBSD:	rev 1.17
MFC after:	3 days
2004-03-16 08:33:33 +00:00
Juli Mallett
c83afe7be9 static and const. 2004-03-15 04:10:29 +00:00
Lukas Ertl
ae21f5ad2c And a bandaid so that the output of "available space" is correct when
using -m and -g switches and "available space" is negative (i.e. when
the file system is already using the root-reserved minimum free space).

Obtained from:   Stefan Farfeleder <stefan@fafoe.narf.at>
PR:              bin/62536
Submitted by:    Peter van Dijk <peter@dataloss.nl>
Approved by:     grog (mentor), bde
2004-03-09 10:02:44 +00:00
Andrey A. Chernov
c65eeb736e Remove a.out at the end of 'make test' 2004-03-08 18:09:33 +00:00
Bruce Evans
d493ed0f97 Fixed some style bugs (mainly unsorting and tab lossage in previous commit). 2004-03-06 08:21:32 +00:00
Andrey A. Chernov
c6f22660ff Add a.out to CLEANFILES 2004-03-06 06:54:58 +00:00
Andrey A. Chernov
adde319c62 Change locale name from non-existent ASCII to en_US.US-ASCII 2004-03-06 06:10:16 +00:00
Poul-Henning Kamp
6a3d33ac5e Teach dd(1) about parity bits. 2004-03-05 19:35:51 +00:00
Poul-Henning Kamp
3d36fd4271 Add a test-target and reference vectors for the character converions. 2004-03-05 19:30:13 +00:00
Mark Murray
16fc3635f7 Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
Mike Makonnen
662713f2a8 Rev. 1.32 moved a comment to the wrong line. The hack refered to
in the comment applies to a decision that needs to be made in relation
to the year 2000.

In fact, that statement probably should be changed to be
more generic (getting the year from the current time perhaps). Otherwise,
starting in 2069 two digit year conversions in date(1) will start assuming
1900 instead of 2000. hehe.
2004-03-04 15:46:14 +00:00
Colin Percival
310924af3d Fixes to output of ls -lh for certain file sizes:
1. Sizes in the range 1000 -- 1023 units require four characters width
   for the integer; increase the field width to accomodate this.
2. Sizes in the range 9.95 -- 10 units were being displayed as "10.0"
   units; adjust the logic to fix this, and now that we've got an extra
   character of field width, print fractional units if the size is less
   than 99.95 units.
3. Don't display sub-byte precision.

This should mean that the following sizes are displayed:
    0B .. 1023B
  1.0U ..  9.9U
 10.0U .. 99.9U
  100U .. 1023U
for values of U in "KMGTPE".

PR:		bin/63547
Pointy hat to:	cperciva
Approved by:	rwatson (mentor)
2004-03-01 19:25:27 +00:00
Johan Karlsson
c8edef9f48 style.Makefile:
Use WARNS?= instead of WARNS=
2004-02-23 20:05:14 +00:00
Daniel Eischen
d75c1d8381 Allow the -H option to show threads when selecting by uid, tty,
and pid.
2004-02-22 17:59:31 +00:00
Ceri Davies
3004d1ed4d Only call chflags() on directories once.
Approved by:	ru
MFC after:	1 week
2004-02-18 18:45:11 +00:00
Nate Lawson
aa0b7126ba style(9): wrap at 80 columns. 2004-02-12 05:05:56 +00:00
Nate Lawson
97054a769f Handle proper formatting and a buffer overrun when running an old sh on
a system that has sys_nsig > NSIG (i.e. when libc is upgraded.)

Submitted by:	Matt Dillon
Reviewed by:	bde
2004-02-12 05:03:37 +00:00
Juli Mallett
7cb9663b27 MFp4 @46705:
Support "uprocp" exactly like "paddr" with the former having been
documented in the manual but not implemented.

PR:		42484
2004-02-08 23:57:19 +00:00
Ian Dowse
0bd9f15133 Use int rather than size_t storage for printf field widths to avoid
many casts.

Reviewed by:	bde
2004-02-08 23:42:09 +00:00
Ruslan Ermilov
47d7e8a96f Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00
Martin Cracauer
e637898ea8 Commit fix sent by Tor Egge <Tor.Egge@cvsup.no.freebsd.org>
Only use return value from system call if system call succeeded.

Tested with `make world` and some of my own scripts.

This should be MFCed soon.  While /bin/sh is hard to test the fix is
obviously correct and can be assumed not to break something else
(famous last words...).
2004-02-05 22:34:05 +00:00
Nate Lawson
205bc8633e Use sys_nsig instead of the static NSIG. DragonflyBSD kill.c:1.3
Obtained from:	DragonflyBSD
2004-01-28 19:04:14 +00:00
Nate Lawson
1b13752a03 Use sys_nsig instead of NSIG for the length of the signal arrays. This
is important if we add new signals later.  From DragonflyBSD:
jobs.c:1.4, trap.c:1.3.

Obtained from:	DragonflyBSD
2004-01-28 19:01:10 +00:00
Martin Cracauer
6c6fd020de The PR diff I committed recently had one bug noticed by
Joe Marcus Clarke <marcus@FreeBSD.ORG>, subshells could lose a
non-zero exit status.

This commit is Joe's proposed patch.  Thanks!

I verified that the problem Joe found is fixed and I ran a full world
with this patch.

I don't plan to ever commit language patches to /bin/sh again.  It is
a minefield too big to navigate without a full-time committment, which
I am not willing to do on our /bin/sh.

Under normal circumstances I would recommend using NetBSD's sh which
has a lot of language fixes (like the ones what these patches were
about) but unfortunately they had implemented broken signal behaviour
for shellscript containing interactive programs.  Similar issues apply
to pdksh which is OpenBSD's sh.

From my perspective bash2 is the only really working bourne sh out
there and that one is GPLed.  Oh well.
2004-01-28 18:22:19 +00:00
Colin Percival
d3b68bf14c Fix alignment of size field in ls -lh -- the width was being computed
from log[10](largest file size), but when outputting in human-friendly
format the width is always at most 4. (eg. "123K", " 12K", "1.2K".)

PR: bin/59320
Approved by: rwatson (mentor)
2004-01-22 04:33:00 +00:00
Colin Percival
bcf85d6737 Bring ps.1 up to date with changes in the past seven years:
* Remove mention of '>', 'A', and 'S' states
* Mention 'W' state.
* List 'J' state in the correct location.
* Sync with flags in sys/proc.h

Approved by: rwatson (mentor)
MFC after: 7 days
2004-01-21 16:25:36 +00:00
Dag-Erling Smørgrav
7e1c72660f Replace home-grown dup2() implementation with actual dup2() calls. This
should slightly reduce the number of system calls in critical portions of
the shell, and select a more efficient path through the fdalloc code.

Reviewed by:	bde
2004-01-21 12:50:01 +00:00
Ruslan Ermilov
d0123622bb Removed duplicate y.tab.h from SRCS and CLEANFILES. 2004-01-20 13:13:40 +00:00
Ruslan Ermilov
d10a8d6cb4 - Build things in pure dictionary order (see sort(1)).
- Unify the conditional assignments section so that architectural
  exclusions come first, then options and !options, sorted by the
  option name, also in directory order, then architecture specific
  sections, sorted by the architecture name, with i386 being a
  traditional exception.

Prodded by:	bde
2004-01-16 15:23:19 +00:00
David E. O'Brien
ab579b9e93 Note the Linux required format. 2004-01-06 19:01:34 +00:00
Jun Kuriyama
b800f53d91 o Fix a style bug and poor wording in comment.
o When fts_read() cannot stat the file, it can't be unlinked.  At
  that case, don't display error message when -f flag is used.

Obtained from:	bde
PR:		kern/16815, bin/35842
Reported by:	kuriyama, Aleksandr A. Babaylov <.@babolo.ru>
2004-01-01 10:26:43 +00:00
Maxim Konovalov
8aa55d8126 o Spell 'diretories' correctly.
PR:		misc/60730
Submitted by:	Eugene Grosbein
MFC after:	3 days
2003-12-30 15:39:33 +00:00
Martin Cracauer
bd80d26f3b PR 28852
sh -e behaviour was incorrect when && and || statements where used in
"if" clauses.

This is the patch submitted by MORI Kouji <mori@tri.asanuma.co.jp>.

It fixes the issue at hand, but sh fixes like this are super-hard to
verify that they don't break anything else.  I ran some of my old test
cases and a few big GNU configure scripts that detected mistakes
before, with the previous sh, patched sh and bash.  No differences in
behaviour found.  MFC recommended after longer than usual time.

Compiles on i386 and sledge.
2003-12-28 02:05:12 +00:00
Ruslan Ermilov
887cb17fac Print unambiguous paths with -R -v. 2003-12-16 15:17:30 +00:00
Maxime Henrion
ec912781bb The uuidgen(1) program is WARNS=6 clean, so flag it as such.
Tested on:	i386, sparc64
2003-12-07 21:34:56 +00:00
David E. O'Brien
d5f9f41c7b Do something sensible if both -h and -k are given.
Approved by:	re(scottl)
2003-12-01 19:10:29 +00:00
Marcel Moolenaar
bd8477d623 Force a staticly linked /bin and /sbin for ia64. The necessary changes
to gcc have not been made for ia64, which means that executables still
have /usr/libexec/ld-elf.so.1 as the dynamic linker. This simply does
not work if /usr is a seperate filesystem not mounted when the kernel
tries to execute init(8).

Note that this is a temporary fix until a new gcc has been imported
that does have the required changes.

Approved: re@
2003-11-19 16:59:00 +00:00
Gordon Tetlow
7e83e0de77 Change the default for binaries in /bin and /sbin from statically to
dynamically linked. This has been a long time coming with the move of
critical libraries from /usr/lib to /lib. If you don't feel comfortable
with dynamically linked binaries in your root partition, now is the
time to define NO_DYNAMICROOT in your make.conf.

Approved by:	re
2003-11-16 04:57:28 +00:00
Alan Cox
b9e25f436b Don't mmap(2) and munmap(2) zero-length files.
Submitted by:	Wiktor Niesiobedzki <bsd@w.evip.pl>
2003-11-13 05:26:55 +00:00
Kris Kennaway
ea64ad7727 Fix format strings (intmax_t is %jd, not %qd)
Reviewed by:	tjr
2003-11-12 21:47:42 +00:00
Kirk McKusick
fde81c7d8e Update the statfs structure with 64-bit fields to allow
accurate reporting of multi-terabyte filesystem sizes.

You should build and boot a new kernel BEFORE doing a `make world'
as the new kernel will know about binaries using the old statfs
structure, but an old kernel will not know about the new system
calls that support the new statfs structure. Running an old kernel
after a `make world' will cause programs such as `df' that do a
statfs system call to fail with a bad system call.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Tim Robbins <tjr@freebsd.org>
Reviewed by:	Julian Elischer <julian@elischer.org>
Reviewed by:	the hoards of <arch@freebsd.org>
Sponsored by:   DARPA & NAI Labs.
2003-11-12 08:01:40 +00:00
Guido van Rooij
f3761deee3 When the P flag is set (i.e. Overwrite regular files before deleting them),
do only unlink the file if we could indeed overwrite the file.
Old behaviour: rm -P /tmp/foo (foo mode 0444) would NOT overwrite foo,
but still delete it (with a warning: rm: foo: Permission denied)
New behaviour: Just the EPERM warning, but no deletion

Reviewed by:	bde
2003-11-10 09:40:18 +00:00
Bruce Evans
8f1f433834 1. Fixed leakage of a file descriptor for every non-fatal failure in
rm_overwrite() (for rm -P).

2. Print the file name in the error message for (fatal) malloc() failures
   in rm_overwrite().  I first thought that malloc() failures should be
   non-fatal since they don't prevent proceeding the the next file, but
   making them non-fatal would normally give too much output for rm -Pr
   on a large tree in the unlikely event that even one occurs, since the
   malloc()ed amounts are usually the same.  Just print the file name since
   the malloc()ed amounts are not always the same and it doesn't hurt to
   know where rm was when it quit.

Submitted by:	guido ((1) and original version of (2))
2003-11-08 09:55:16 +00:00
Ruslan Ermilov
3565c6a8e3 Style. 2003-11-02 06:47:39 +00:00
Anton Berezin
ad6a34de1d Remove the code for parsing octal modes, since setmode(3) already
handles them.

Reviewed by:	audit
MFC after:	2 weeks
2003-10-31 13:20:09 +00:00
Tim J. Robbins
c5bc87095b Handle realloc() failure correctly. 2003-10-16 07:07:20 +00:00
Mark Murray
0f66784721 Turn malloc+snprintf into asnprintf.
Submitted by:	David Hill <hill at phobia dot em ess>
2003-10-14 20:42:13 +00:00
Diomidis Spinellis
91b7d6dc58 - Check and report write(2) errors.
- Issue a single writev(2) call instead of multiple write(2)s.
  This change improves the inefficiencies introduced when echo
  went on an stdio diet.

The following figures are for echoing 1000 arguments.
original stdio-based echo:
        0.01 real         0.01 user         0.00 sys
before:
        0.05 real         0.00 user         0.04 sys
after:
        0.01 real         0.00 user         0.00 sys
2003-10-11 20:34:43 +00:00
Diomidis Spinellis
4566e7a433 Check for write errors; report and exit with error value. 2003-10-04 07:16:40 +00:00
David E. O'Brien
be2c4e5415 Be a little bit more correct WRT counting numbers vs. integer numbers. 2003-09-13 20:46:58 +00:00
Jens Schweikhardt
9e4656f7e8 Do not assume there is only a space between #define and the macro name
when grepping for JOBS. The recent style cleanup replaced the space with
a tab and broke job control detection. Little edits, disastrous consequences.

Submitted by:	Peter Edwards <pmedwards@eircom.net>
X-MFC when:	    in about 5 weeks with the other sh arithmetic fixes.
2003-09-13 06:59:22 +00:00
Tim J. Robbins
bc458f6637 Add the -m, -w and -x options to ls's usage message.
PR:		51493
Submitted by:	Walter Belgers
MFC after:	1 month
2003-09-09 12:02:52 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Ruslan Ermilov
7b0ac2826b Don't escape names in MLINKS: this won't work with bsd.man.mk,v 1.53. 2003-09-07 12:52:17 +00:00