Commit Graph

2355 Commits

Author SHA1 Message Date
Christian S.J. Peron
f9655da0fb Add hard sentence breaks.
Pointed out by:	rwatson
MFC after:	1 week
2008-07-06 22:47:10 +00:00
Christian S.J. Peron
bc068d93d1 Document default ACLs and how to use them.
MFC after:	1 week
2008-07-06 20:29:35 +00:00
Ralf S. Engelschall
a65d88d15d use 'const' for the parameters of the two static functions unalias() and hashalias() 2008-06-07 16:28:20 +00:00
Ralf S. Engelschall
401b3c20cc remove an unnecessary include 2008-06-07 16:19:28 +00:00
Giorgos Keramidas
d605a06c6e Unbreak last commit to ln for amd64.
Cast string precision to `int'.  amd64 systems warn about the
field precision being `long int' if we don't, and pathnames are
normally short enough to fit in an `int'.

Noticed by:	pav
2008-06-07 09:37:30 +00:00
Giorgos Keramidas
3595f21aae Add a -w warning flag to ln(1). When the -w option is enabled,
ln(1) checks to see if the source of a symlink, i.e. the file it
should point to actually exists.  The default is the old ln
behavior, that does not check, to avoid surprising people who may
be using ln(1) in scripts or other non-interactive places.

PR:		bin/7265
Submitted by:	Joel Ray Holveck, detlev!joelh at mail.camalott.com
MFC after:	2 weeks
2008-06-06 08:27:59 +00:00
Stefan Farfeleder
4f30f2993f Fix checking if a variable name is LINENO. As STPUTC changes the pointer if it
needs to enlarge the buffer, we must not keep a pointer to the beginning.

PR:	ports/123879
2008-05-28 21:44:32 +00:00
Stefan Farfeleder
b71085aacf Expand $LINENO to the current line number. This is required by SUSv3's "User
Portability Utilities" option.

Often configure scripts generated by the autotools test if $LINENO works and
refuse to use /bin/sh if not.

Package test run by:	pav
2008-05-15 19:55:27 +00:00
Stefan Farfeleder
d9d588d495 Sigh, when reapplying the patch to HEAD, I somehow forgot to commit this file.
Reported by:	Jaakko Heinonen
2008-04-28 07:26:34 +00:00
Stefan Farfeleder
39376f45e2 - Fix bugs where the value of arithmetic expansion$((...)) was trucated
to type int.
- Change the type used for arithmetic expansion to intmax_t (ie. 64 bit on all
  currently supported FreeBSD architectures).  SUSv3 requires at least type
  long but allows for larger types.  Other shells (eg. bash, zsh, NetBSD's sh)
  do that too.

PR:		122659
Submitted by:	Jaakko Heinonen (minor modifications by me)
2008-04-27 20:46:45 +00:00
Warner Losh
2af52e0724 Turn a tab into a space. This fixes a misalignment for ls -l.
Tabs Noticed by: Antoine Brodin
2008-04-05 21:26:25 +00:00
Ruslan Ermilov
5ffbd51eb0 - Add -D to usage().
- Bump document date for the addition of the -D option.
- Reformat a sentence to look like a real sentence.
2008-04-04 05:55:42 +00:00
Greg Lehey
2269fa5765 Add -D option to specify exact format of date and time output with ls -l. 2008-04-04 03:57:46 +00:00
Stefan Farfeleder
f9ec075e88 Reset the internal state used for the 'getopts' built-in when 'shift' or 'set'
are used to modify the arguments.  Not doing so caused random memory reads or
null pointer dereferences when 'getopts' was called again later (SUSv3 says
getopts produces unspecified results in this case).

PR:	48318
2008-03-22 14:06:01 +00:00
David E. O'Brien
8757b00e1e uuidgen has been repo-copied from usr.bin/ to bin/ to match its "new"
(2007/04/09) installation location.
2008-03-13 17:38:06 +00:00
Jeff Roberson
7f77f84497 - P_SA has been removed. 2008-03-12 10:01:34 +00:00
John Baldwin
d140946cf3 Add an '-a' option which is identical to specifying '-RpP' for
compatibility with other implementations.

MFC after:	1 month
2008-03-10 19:58:41 +00:00
Robert Watson
08995e292e Enhance realpath(1) in a number of ways:
- Allow realpath to accept multiple paths on the command line.
- Add -q to suppress warnings if some paths can't be processed, and use
  getopt(3) to process flags.
- Print the path being requested rather than a possibly partially
  processed path when a failure occurs so that you can tell which of
  several passed paths did fail.

MFC after:	1 week
PR:		112920
Submitted by:	Ighighi <ighighi@gmail.com>
2008-03-09 12:46:39 +00:00
Robert Watson
1b21ffa615 Make chflags(1) more chmod(1)-like (and more feature complete):
- Add -v to print file names as they are processed; -vv prints the flags
  change as well.
- Add -f to ignore failures with the same semantics as chflags(1), neither
  printing an error nor affecting the return code.
- Don't try to set the flags if they won't change.

I made minor cosmetic tweaks to the code in the patch.

MFC after:	1 week
PR:		112827
Submitted by:	Ighighi <ighighi at gmail.com>
2008-03-09 12:10:24 +00:00
Stefan Farfeleder
55d2c5b573 Split updatepwd() into two smaller functions. The first one, findpwd(),
computes the new path and the second one, updatepwd(), updates the variables
PWD, OLDPWD and the path used for the pwd builtin according to the new
directory.  For a logical directory change, chdir() is now called between
those two functions, no longer causing wrong values to be stored in PWD etc. if
it fails.

PR:	64990, 101316, 120571
2008-02-24 16:50:55 +00:00
Marcel Moolenaar
2912059a85 Fix "warning: comparison is always false due to limited range of data type"
on platforms with unsigned chars. The comparison in question is there to
determine whether chars are unsigned or not and is based on comparing a
char, initialized to -1, for less than 0. Change the comparison to check
for geater than 0 instead...
2008-02-18 20:01:33 +00:00
Ruslan Ermilov
a65550812a Don't reset DST computed by strptime() (when e.g. setting the
date via -f %s).

Reported by:	Eugene Grosbein
Diagnosed by:	Miguel Lopes Santos Ramos
2008-02-07 16:04:24 +00:00
Diomidis Spinellis
961fdc4fac - Roll-back attempts to mimic rename(2) atomicity introduced in 1.47,
and follow the letter of the POSIX specification.

- Moving a directory to an existing non-empty directory will now fail,
  as required.

- Improve consistency and remove some style bugs of earlier versions.

This version passes all tests of tools/regression/bin/mv/regress.sh 1.6

Reviewed by:	bde
MFC after:	1 month
2007-12-27 11:33:42 +00:00
Edwin Groothuis
a76b9b6973 As suggested, replace earlier changed warnx() / exit() with an errx()
Submitted by:	Peter Jeremy <peterjeremy@optushome.com.au>
2007-12-26 08:32:20 +00:00
Edwin Groothuis
0d5ee457ad When copying multiple files to a directory, make sure that a proper
warning is given when the directory doesn't exist.

PR:		bin/50656
Submitted by:	Edwin Groothuis <edwin@mavetju.org>
Approved by:	grog@
Not reviewed by: grog@
2007-12-25 00:40:32 +00:00
Diomidis Spinellis
3db8241bb4 Calling any function from vfork other than exec* and _exit yields
undefined behavior.

Noted by:	alfred
2007-12-17 09:02:42 +00:00
Diomidis Spinellis
2ec43f35f4 Eliminate gcc "variable clobbered" warnings by declaring the variables
living across the vfork as volatile.

Noted by:	kan
2007-12-16 17:47:34 +00:00
Diomidis Spinellis
3a44a28835 When moving a directory across devices to a place where a directory
with the same name exists, delete that directory first, before performing
the copy.  This ensures that mv(1) across devices follows the semantics
of rename(2), as required by POSIX.

This change could introduce the potential of data loss, even if the
copy fails, violating the atomicity properties of rename(2).  This is
(mostly) mitigated by first renaming the destination and obliterating
it only after a succesfull copy.

The above logic also led to the introduction of code that will cleanup
the results of a partial copy, if a cross-device copy fails.

PR:		bin/118367
MFC after:	1 month
2007-12-16 14:14:31 +00:00
Marius Strobl
ea7f7bdef3 Move WARNS as ed(1) also is only WARNS = 2 clean in the !DES case.
This fixes its compilation if MK_OPENSSL == no and also obsoletes
release/Makefile rev. 1.192. The latter isn't reverted though as
support for the fixit floppy and the rest of the boot floppies is
scheduled to be deorbited anyway.

Discussed with:	kensmith
2007-12-09 00:14:27 +00:00
Ruslan Ermilov
dfe302ab34 Revise the markup. 2007-12-05 12:29:26 +00:00
John Birrell
78a5dd56cd Reduce the WARNS level to avoid a compiler warning about a variable
possibly being clobbered by a longjmp or a fork with gcc4.
2007-11-18 01:53:07 +00:00
Ruslan Ermilov
8090694427 Express in the usage() and SYNOPSIS that -F depends on -s, and
that -f and -i are exclusive.
2007-11-17 21:01:22 +00:00
Ruslan Ermilov
cadf8ad71c Swap "source"/"target" where appropriate, to match documentation. 2007-11-17 20:24:58 +00:00
John Baldwin
8a529f590f Teach ps(1) to parse pts TT values (i.e. '0', '1') for the -t flag.
MFC after:	1 week
Reported by:	kris
2007-11-08 22:31:28 +00:00
Ruslan Ermilov
c930322c40 Bump document date on behalf of previous revision. 2007-11-01 09:49:45 +00:00
Julian Elischer
c36b9f6253 fix sorting of 'tdnam' keyword in keyword list. 2007-10-28 17:10:36 +00:00
Julian Elischer
7ab24ea3b9 Introduce a way to make pure kernal threads.
kthread_add() takes the same parameters as the old kthread_create()
plus a pointer to a process structure, and adds a kernel thread
to that process.

kproc_kthread_add() takes the parameters for kthread_add,
plus a process name and a pointer to a pointer to a process instead of just
a pointer, and if the proc * is NULL, it creates the process to the
specifications required, before adding the thread to it.

All other old kthread_xxx() calls return, but act on (struct thread *)
instead of (struct proc *). One reason to change the name is so that
any old kernel modules that are lying around and expect kthread_create()
to make a process will not just accidentally link.

fix top to show  kernel threads by their thread name in -SH mode
add a tdnam formatting option to ps to show thread names.

make all idle threads actual kthreads and put them into their own idled process.
make all interrupt threads kthreads and put them in an interd process
(mainly for aesthetic and accounting reasons)
rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper'

man page fixes to follow.
2007-10-26 08:00:41 +00:00
Stefan Farfeleder
aafd6a87a6 The exit status of a case statement where none of the patterns is matched
is supposed to be 0, not the status of the previous command.

Reported by:	Eygene Ryabinkin
PR:		116559
Approved by:	re (gnn)
2007-10-04 16:14:48 +00:00
Kevin Lo
c577145195 Use owner name and owning group name instead of uid and gid
for displaying the three-line comment header by default.

Reviewed by: kientzle
Approved by: re (bmah)
2007-09-19 02:04:47 +00:00
Jeff Roberson
b61ce5b0e6 - Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or
   previously the sched_lock.  These bugs have existed for some time.
 - Allow swapout to try each thread in a process individually and then
   swapin the whole process if any of these fail.  This allows us to move
   most scheduler related swap flags into td_flags.
 - Keep ki_sflag for backwards compat but change all in source tools to
   use the new and more correct location of P_INMEM.

Reported by:	pho
Reviewed by:	attilio, kib
Approved by:	re (kensmith)
2007-09-17 05:31:39 +00:00
Sean Farley
5b78c6c247 Take care that the input to setenv() may actually be a pointer straight
from environ; make a copy before manipulating it and passing it to
setenv().

Approved by:	wes
Approved by:	re (kensmith)
2007-07-06 04:04:58 +00:00
Sean Farley
2966d28c32 Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
 - unsetenv returns an int.
 - putenv takes a char * instead of const char *.
 - putenv no longer makes a copy of the input string.
 - errno is set appropriately for POSIX.  Exceptions involve bad environ
   variable and internal initialization code.  These both set errno to
   EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit.  A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions.  It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR:		kern/99826
Approved by:	wes
Approved by:	re (kensmith)
2007-07-04 00:00:41 +00:00
Ken Smith
0c0146f019 Don't include encryption features of ed(1) when building for the
"rescue media" bundled with releases.

Suggested by:	ru
Approved by:	re (hrs)
2007-07-02 14:00:25 +00:00
Remko Lodder
a1f6cb79d9 Correct the referenced securelevel document, it's now securelevel 7.
Pointed out by:	ru
2007-06-02 20:15:59 +00:00
Pawel Jakub Dawidek
2bb428228e Fix probably copy&paste from chmod(1) - we change file flags here, not mode. 2007-05-28 04:23:09 +00:00
Brian Somers
367787a3c6 Remove unnecessary free argument casts.
Don't abuse arcname's constness.
2007-05-25 17:53:38 +00:00
Ralf S. Engelschall
f2703795ca Cleanup pax(1) sources a little bit while I poked around in them:
- remove a superfluous doubled trailing semicolon.
- remove the extra void casts on calls to void-function free(3).
2007-05-24 06:44:37 +00:00
Colin Percival
c28f49d439 In the error handling path, don't call close(fd) if the error we're
handling is that fd = open(foo) is -1.  This bug is harmless since
close(-1) just returns an error (which the code ignores).

Found by:	Coverity Prevent(tm)
CID:		1503 (in userland test run)
2007-05-22 04:21:00 +00:00
Mark Peek
59dfb2db03 Work around a vendor issue that was causing the builtin malloc to be
used instead of the system malloc.

Submitted by:	ume
2007-05-16 21:22:38 +00:00
Pav Lucistnik
a3f58dae59 Replace a fairly opaque sentence with a much clearer wording from NetBSD.
PR:		docs/101330 (inspired by)
Submitted by:	Peter Gildea <peter@gildea.com>
Obtained from:	NetBSD
2007-05-12 22:18:27 +00:00
Andrey A. Chernov
ba174a5e38 Back out all POSIXified *env() changes.
Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.
2007-05-01 16:02:44 +00:00
Andrey A. Chernov
c7368c3569 Simplify previous fix and disallow VTEXTFIXED direct pass for putenv() too,
just use savestr()
2007-04-30 15:01:33 +00:00
Andrey A. Chernov
7071e63df7 Put some safeguards:
1) Under POSIX unsetenv("foo=bar") is explicit error and not equal
to unsetenv("foo")
2) Prepare for upcomig POSIXed putenv() rewrite: make putenv() calls
portable and conforming to standard.
2007-04-30 11:44:42 +00:00
Andrey A. Chernov
7c450364bc Eliminate error with -W* strict flags and make putenv() calls conforming to
standard in the same way as f.e. gcc internal portable code does.
2007-04-30 04:29:17 +00:00
Pawel Jakub Dawidek
0c6b66bd70 Move uuidgen(1) from /usr/bin/ to /bin/. It will be used in rc.d/hostid
script, which will be executed before /usr/ mount.

Reviewed by:	mlaier, rink, brooks, rwatson
2007-04-09 19:16:48 +00:00
Alexander Kabaev
2897dce81d getblocksize expects pointer to long as a second argument, not
a pointer to u_long.
2007-04-06 15:36:43 +00:00
Mark Peek
15aaece8bd Build updates for tcsh-6.15.00 import.
Reviewed by:	ume
Reminded by:	Divacky Roman
MFC after:	1 week
2007-03-11 22:41:19 +00:00
Will Andrews
27f8233569 Fix a bug where the mutual exclusivity of the -l and -t options is not
recognized properly if -l is specified first.

PR:			bin/105721
MFC after:	1 week
2007-03-08 06:10:17 +00:00
Ruslan Ermilov
9f3cef9108 Fix markup. 2007-03-04 19:52:07 +00:00
Ruslan Ermilov
0dc55f7681 Fix markup. 2007-03-04 09:15:12 +00:00
Ruslan Ermilov
975ab35963 Fix markup. 2007-02-28 10:29:48 +00:00
Ruslan Ermilov
6f000336cd Fix markup. 2007-02-27 11:25:58 +00:00
Kirk McKusick
b5ea8f4cbc Implement the -h flag (set an ACL on a symbolic link).
Before this fix the -h flag was ignored (i.e. setfacl
always set the ACL on the file pointed to by the symbolic
link even when the -h flag requested that the ACL be set
on the symbolic link itself).
2007-02-26 00:42:17 +00:00
Ceri Davies
e1854a84ad Correct typos containing my login name (plus one more in expr.y).
Found courtesy of a recursive grep in the wrong directory.
2007-02-18 19:48:59 +00:00
Stefan Farfeleder
d92e35fd5f Use eaccess() instead of access() for the type builtin, like we do for the
test builtin.

Submitted by:	Martin Kammerhofer
2007-01-18 22:31:22 +00:00
Stefan Farfeleder
f30842ba79 Return an error status (127) from the builtins 'type' and 'command' (with
either -v or -V) if a file with a slash in the name doesn't exist (if there is
no slash we already did that).

Additionally, suppress the error message for command -v for files with a slash.

PR:		107674
Submitted by:	Martin Kammerhofer
2007-01-11 00:19:00 +00:00
Ruslan Ermilov
b3c71457fa Fix markup. 2006-12-27 12:14:56 +00:00
Ruslan Ermilov
1ee7aa6068 More markup fixes. 2006-12-27 11:28:00 +00:00
Ruslan Ermilov
c92beb6d39 Fix markup. 2006-12-27 11:19:06 +00:00
Ruslan Ermilov
88b0915eb1 Give a hint to the reader as to what the "whiteout" actually means. 2006-12-26 13:57:40 +00:00
Ruslan Ermilov
ca3f81d885 Fix markup, add the EXIT STATUS section. 2006-12-26 13:44:41 +00:00
Ruslan Ermilov
d2b53efbb9 One more nit. 2006-12-23 09:25:23 +00:00
Ruslan Ermilov
17bba29b9b Fix markup. 2006-12-23 09:22:06 +00:00
Ruslan Ermilov
dd8f42dc83 - Mention umask(2) when first referring to it.
- Add missing markup.

Submitted by:	Eugene Grosbein <eugen@grosbein.pp.ru>
2006-12-22 07:28:38 +00:00
Ruslan Ermilov
b35e435f6e Use a standard section name. 2006-12-18 15:45:01 +00:00
Ruslan Ermilov
7eb5016ab5 Simplify some markup. 2006-12-14 10:42:46 +00:00
Tim Kientzle
8abbcd2910 Style(9) fixes, thanks to Ruslan. 2006-12-08 07:47:08 +00:00
Tim Kientzle
a426a2865c Support the "-f" option by simply ignoring it.
This allows script compatibility with Linux, whose
"hostname" is the same as BSD "hostname -s".
With this change, "hostname -f" is the same on
both systems.

MFC after: 7 days
2006-12-08 07:19:51 +00:00
Ruslan Ermilov
0f0a3e4f82 Once upon a time, the hostname was being set in the /etc/netstart,
which can be called a "network initialization script", now that it
is set in /etc/rc.d/hostname, "network" sounds confusing, so remove
it.
2006-12-05 12:09:50 +00:00
Ruslan Ermilov
c65bb135d9 Fix some of the alignment warnings on ARM. 2006-11-27 22:17:11 +00:00
Stefan Farfeleder
bb4f73cac6 Fix expanding of quoted positional parameters in case patterns.
Obtained from:	NetBSD (expand.c 1.58 and 1.59)
Submitted by:	Paul Jarc
PR:		56147
2006-11-07 22:46:13 +00:00
Stefan Farfeleder
62addaefc9 When parsing an invalid parameter expansion (eg. ${} or ${foo@bar}) do not
issue a syntax error immediately but save the information that it is erroneous
for later when the parameter expansion is actually done.  This means eg. "false
&& ${}" will not generate an error which seems to be required by POSIX.
Include the invalid parameter expansion in the error message (sometimes
abbreviated with ... because recovering it would require a lot of code).

PR:		105078
Submitted by:	emaste
2006-11-05 18:36:05 +00:00
Ceri Davies
b873ae5ca9 Fix typo. 2006-11-02 19:10:05 +00:00
Xin LI
86da4a5eea Correct a security issue introduced in previous commit:
instead of removing the file and issue a warning about
the removal, do not do any operation at all in case -P
is specified when the dinode has hard links.

With -f and -P specified together, we assume that the
user wants rm to overwrite the contents of the file
and remove it (destroy the contents of file but leave
its hard links as is).

The reason of doing it this way is that, in case where
a hard link is created by a malicious user (currently
this is permitted even if the user has no access to the
file).  Losing the link can potentially mean that the
actual owner would lose control completely to the user
who wants to obtain access in a future day.

Discussed with:	Peter Jermey
2006-10-31 02:22:36 +00:00
Xin LI
0b6f55b77c Be more reasonable when overwrite mode is specified while there
is hard links.  Overwritting when links > 1 would cause data
loss, which is usually undesired.

Inspired by:	discussion on -hackers@
Suggested by:	elessar at bsdforen de
Obtained from:	OpenBSD
2006-10-30 03:32:09 +00:00
Tom Rhodes
f3955abb6f Wording nits. 2006-10-27 08:26:24 +00:00
Tom Rhodes
6138defa43 Flesh out the compatibility section a little bit. Bump doc date. 2006-10-24 18:42:42 +00:00
Maxim Konovalov
da29c6560b o Backout rev. 1.55. Don't waste cpu cycles for bzero(), do not
call chflags() for whiteouted files.

Prodded by:	ru
2006-10-18 13:16:06 +00:00
Ruslan Ermilov
b912fe73ee Avoid a spurious warning for each whiteout found during "ls -lW".
# ls -lW
total 2
-rw-r--r--  1 root  wheel  6 Oct 18 14:46 file1
ls: ./file2: No such file or directory
w---------  0 root  wheel  0 Jan  1  1970 file2
2006-10-18 10:58:27 +00:00
Maxim Konovalov
cf1db7b34f o Zero out struct stat before usage. lstat(2) can fail and
leave garbage there which will break -W code path.

PR:		bin/84569
Submitted by:	Igor
MFC after:	2 weeks
2006-10-18 08:22:33 +00:00
Ruslan Ermilov
32fcd4577f - Improve description of the -A option.
- Document how whiteouts look in the long output. [1]
- Sort entry types.
- Fix description of the socket type.

PR:		docs/51921 [1]
2006-10-12 10:08:52 +00:00
Tom Rhodes
43d8847e0b Fix style(9) bugs in previous commit.
Lesson from:	bde
2006-10-11 10:26:34 +00:00
Ruslan Ermilov
cf39c97ba5 Adhere to POSIX: the -m option only applies to the newly created
directories; it should not change the permission bits of already
existing directories.

Submitted by:	Alex Unleashed (modified by me)
2006-10-10 20:18:20 +00:00
Tom Rhodes
ba3fe6d1ab Make -r a synonym for -R, similar to behavior on Linux while being backwards
compatible with old -r behavior with regards to -L.  You can now copy fifos
and other special files with -r.

Reviewed by:	-standards (long ago), das, bde
Approved by:	bde (recently)
2006-10-07 22:14:43 +00:00
Stefan Farfeleder
de37e41c23 Add the POSIX option -p to the jobs builtin command. It prints the PID of the
process leader for each job.  Now the last specified option for the output
format (-l, -p or -s) wins, previously -s trumped -l.

PR:		99926
Submitted by:	Ed Schouten and novel (patches modified by me)
2006-10-07 16:51:16 +00:00
Maxim Konovalov
9bdb7f2e54 o Style(9).
Submitted by:	bde
2006-10-07 12:14:50 +00:00
Maxim Konovalov
eb82e1a1f8 o Avoid division by zero.
o Place error checking code near to the syscall.

Submitted by:	bde
2006-10-07 12:11:21 +00:00
Maxim Konovalov
6a861e9bfb o Hold copied bytes counter in off_t. This prevents statistics
displayed by SIGINFO handler from overflow.

PR:		bin/104039
Submitted by:	Geoffrey Giesemann
MFC after:	2 weeks
2006-10-06 08:30:33 +00:00
Ruslan Ermilov
64941e9d80 Move the -l option processing to where it belongs.
Overall still not kosher but better matches style(9).
2006-09-29 06:06:39 +00:00
Christian S.J. Peron
df464e4361 Based on The Open Group Base Specifications Issue 6 IEEE Std 1003.1, our
current implementation of df(1) is does not properly format the output under
certain conditions. Right now -kP and -Pk are not the same thing. Further,
when we set the BLOCKSIZE environment variable, we use "1k" instead of "1024",
making the header display incorrectly.

To quote the specification:

"When both the -k and -P options are specified, the following header line
 shall be written (in the POSIX locale):

"Filesystem 1024-blocks Used Available Capacity Mounted on\n"

- If -P has been specified, check to make sure that -k has not already been
  specified, if so, simply break instead of clobbering the previous blocksize
- Use 1024 instead of 1k to make the header POSIX compliant

Reported by:	Andriy Gapon
Discussed with:	bde, ru
MFC after:	1 week
2006-09-20 20:55:02 +00:00
Ruslan Ermilov
9badf57f01 Markup fixes. 2006-09-17 17:40:07 +00:00
Ruslan Ermilov
cbae88b901 - Fix options order.
- Touch manpage's document date.
2006-08-25 09:58:13 +00:00
Ruslan Ermilov
d9c7237d04 Remove a stray -a option that probably sneaked in from julian's
attempt to enter append mode twice in vi(1).  :-)
2006-08-25 09:42:16 +00:00
Julian Elischer
6fa363774d Add an option to allow copying of a hierarchy while linking he regular files.
Bikeshedded to death on: hackers
Submitted by:andersonatcenttech.com
MFC in: 1 month
2006-08-24 20:45:38 +00:00
Yaroslav Tykhiy
7c5169efdd For the sake of clarity, explicitly tell that comma and space
characters can be included in a custom column title string --
that's why it may appear at the end of a keyword list argument
only.
2006-08-21 03:09:12 +00:00
Warner Losh
d7c881e895 Prefer strlcpy to strncpy. In one case, this saves us from re-zeroing
data that's alreday 0.  In another, it saves us from zeroing data that
will be overwritten again.
2006-08-20 06:32:40 +00:00
Warner Losh
c608a9a591 Use strlcpy in place of strncpy + setting the last character NUL. To
be safe, memset the entire msg to '0'.
2006-08-20 06:31:24 +00:00
Yaroslav Tykhiy
61b92b9a22 Document a detail in the present syntax of "ps -o foo=bar". Now
the header title string "bar" extends to the end of the argument
even if it contains commas or spaces, unlike in RELENG_4 or earlier.
The modern syntax agrees with SUSv3.

MFC after:	3 days
2006-08-18 14:12:38 +00:00
Warner Losh
bfe1239a78 while(0); -> while (0) in multiline macro 2006-08-17 23:00:33 +00:00
Yaroslav Tykhiy
776fc0e90e Commit the results of the typo hunt by Darren Pilgrim.
This change affects documentation and comments only,
no real code involved.

PR:		misc/101245
Submitted by:	Darren Pilgrim <darren pilgrim bitfreak org>
Tested by:	md5(1)
MFC after:	1 week
2006-08-04 07:56:35 +00:00
Yaroslav Tykhiy
62f9f95382 Do not forget to increment the input line counter
when reading a word spanning multiple lines.

PR:		bin/101094
MFC after:	5 days
2006-07-31 11:32:12 +00:00
Yaroslav Tykhiy
6a215886c0 Granting the amount of misunderstanding the last change received,
extend it with an example to clarify the point.
2006-07-31 09:25:20 +00:00
Yaroslav Tykhiy
9cdd1e3fea Tell more of the sh(1) history.
Acknowledge Kenneth Almquist's contribution in AUTHORS.

MFC after:	5 days
2006-07-29 09:56:29 +00:00
Yaroslav Tykhiy
ec45d51460 Document that both sides of -a or -o are always evaluated. This
"feature" doesn't seem to be in the standards or elsewhere, and
it is against what we are used to in C and sh(1), so put the
paragraph under BUGS.

Pointed out by:	dougb
MFC after:	3 days
2006-07-27 19:08:21 +00:00
Yaroslav Tykhiy
108459221f Make it easier to find that we have test(1) built-in in sh(1).
MFC after:	3 days
2006-07-26 06:48:18 +00:00
Mark Murray
1da811ef16 More inactive maintainers. 2006-07-09 21:47:37 +00:00
Maxim Konovalov
867e6caf17 o Call fts_close() before exit.
Obtained from:	NetBSD, Coverity ID 1754
2006-07-04 20:52:36 +00:00
Yaroslav Tykhiy
a6557dcb04 Document the fact that 'true' and 'false' are among sh(1) built-in commands.
MFC after:	3 days
2006-06-21 12:01:52 +00:00
Stefan Farfeleder
cecd2b6c70 Merge NetBSD's revision 1.86: Don't crash on "<cmd> | { }". 2006-06-15 07:57:05 +00:00
Stefan Farfeleder
120c8e6c34 Implement the PS4 variable which is defined by the POSIX User Portability
Utilities option.  Its value is printed at the beginning of the line if tracing
(-x) is active.  PS4 defaults to the string "+ " which is compatible with the
old behaviour to always print "+ ".

We still need to expand variables in PS1, PS2 and PS4.

PR:		46441 (part of)
Submitted by:	schweikh
Obtained from:	NetBSD
2006-06-15 07:00:49 +00:00
Stefan Farfeleder
ed5c24e27d Don't strip a leading ./ from the path for the cd builtin to avoid interpreting
.//dir as /dir.  Rather strip it only for the purpose of checking if the
directory path should be printed.

PR:		88813
Submitted by:	Josh Elsasser
Patch from:	NetBSD (cd.c rev 1.38)
MFC after:	2 weeks
2006-06-12 21:06:00 +00:00
Maxim Konovalov
1627632858 o Fix grammar, format. 2006-06-09 17:03:24 +00:00
Konstantin Belousov
ba4af6fa0d Document the way to get list of files to process from the stdin.
MFC after:	1 week
Approved by:	kan (mentor)
2006-06-09 16:11:23 +00:00
Konstantin Belousov
410572a159 Copy filename read from the stdin into the private buffer. Otherwise,
next read filename overwrite previous one, resulting in acl being
applied only to the last name in the list.

Submitted by:	Oleg Lomaka <oleg.lomaka at gmail com>
MFC after:	1 week
Approved by:	kan (mentor)
2006-06-09 16:09:26 +00:00
Coleman Kane
6ff45b4e35 Fix the wording about the blocksize (-b) parameter. The existing
wording makes it look like pax archives > 32256 bytes are not
POSIX-compliant! Correct this to state that pax archives with
block sizes > 32256 are not POSIX compliant...and settle our fears.

PR:		docs/97059
Reviewed by:	Giorgos Keramidas <keramida>
2006-05-10 20:32:57 +00:00
Stefan Farfeleder
692f35fd4c POSIX demands that set's output (when invoked without arguments) should be
sorted.  Sort the variables before printing.

PR:	96415
2006-04-29 12:57:53 +00:00
Stefan Farfeleder
896229d920 Check the buffer size when copying the line returned by el_gets() into our
own buffer.  Interactively typing in long lines (>1023 characters)
previously overflowed the buffer.  Unlike the NetBSD people I don't see the
need to subtract 8 from BUFSIZ, so I just used BUFSIZ-1.

Obtained from:	NetBSD
PR:		91110
2006-04-29 10:29:10 +00:00
Jens Schweikhardt
00d02f943b Whitespace nits. 2006-04-17 17:55:11 +00:00
Jens Schweikhardt
0ef05a46fd Correct assorted grammos and typos. 2006-04-16 11:54:01 +00:00
Maxim Konovalov
089418247a o Be pedantic and do fts_close() when done.
PR:		bin/95292
Submitted by:	Charles Hardin
Obtained from:	NetBSD via OpenBSD, PR
2006-04-15 09:26:23 +00:00
Jens Schweikhardt
62463f6768 Output something reasonable for regular and expanded here-documents.
I would have chosen the EOF markers, but they are no longer available
AFAICS, so output "<<HERE" and "<<XHERE" instead.
(NOTE: These changes only affect DEBUG output.)
2006-04-14 13:59:03 +00:00
Stefan Farfeleder
85170a4a2a Implement some of the differences between special built-ins and other builtins
demanded by POSIX.
- A redirection error is only fatal (meaning the execution of a shell script is
  terminated) for special built-ins.  Previously it was fatal for all shell
  builtins, causing problems like the one reported in PR 88845.
- Variable assignments remain in effect for special built-ins.
- Option or operand errors are only fatal for special built-ins.
This change also makes errors from 'fc' non-fatal (I could not find any reasons
for this behaviour).

Somewhat independently from the above down-grade the error handling in the
shift built-in if the operand is bigger than $# from an error() call (which is
now fatal) to a return 1.  I'm not sure if this should be considered a POSIX
"operand error", however this change is needed for now as we trigger that error
while building libncurses.  Comparing with other shells, zsh does the same as
our sh before this change (write a diagnostic, return 1), bash behaves as our
sh after this commit (no diagnostic, return 1) and ksh93 and NetBSD's sh treat
it as a fatal error.
2006-04-09 12:21:20 +00:00
Garance A Drosehn
6331f11eca Re-correct commit 1.73, but this time in a way that does not cause
all column-headers to print in lowercase by default.  I was in too
much of a rush in committing 1.75, and didn't notice that the case
had changed.  This time I did considerably more testing, and used
'diff' instead of just quickly eyeballing the results...

Apologies.  I expect this means the dunce cap is mine for awhile.
If this doesn't work, I'll just drop back to 1.72 and hide under
my desk for awhile.
2006-04-06 03:24:31 +00:00
Garance A Drosehn
a9f48b449a Fix a problem introduced by change 1.73, which causes a seg-fault if
the user specifies a keyword which is an alias to some other keyword.
E.g.: stat (for state) or pcpu (for %cpu)..

Submitted by:	Kostik Belousov
MFC plans:	"soon"
2006-04-05 17:40:46 +00:00
Stefan Farfeleder
e5f1cf0838 Issue an error when . (dot) is invoked without a filename. The synopsis
is just ". file" according to POSIX, however many other shells allow
arguments to be passed after the file.  For compatibility (we even use that
feature in buildworld) additional arguments are not considered to be an
error, even though this shell does not do anything with the arguments at all.
2006-04-02 18:51:32 +00:00
Stefan Farfeleder
905330ab78 Use -s to flag POSIX's "special built-in" utilities in builtins.def. Add a
new member to struct builtincmd and set it to 1 if -s was specified.  This
is done because there are cases where special builtins must be treated
differently from other builtins.

Obtained from:	NetBSD (builtins.def part)
2006-04-02 18:43:33 +00:00
John Baldwin
93a5035fd7 Change the -S and -t options to override each other so that the last one
specified wins to make their interaction less confusing.
2006-03-24 17:09:03 +00:00
John Baldwin
86cca1e75e Fix a bug such that if you enabled sorting by size (-S) and enabled a
flag to use a time other than modtime (-c, -u, or -U), the output would
actually be sorted by the specified time rather than size.  This does
alter the behavior in the case where both -S and -t are specified.  Now,
-S is always preferred.  Previously, -t was preferred if one of -c, -u, or
-U was specified, and -S was preferred otherwise.  Perhaps -S and -t should
override each other (last one specified wins).
2006-03-24 16:47:22 +00:00
John Baldwin
bea12be630 Add a few more references to -U. 2006-03-24 16:43:58 +00:00
John Baldwin
fe79420eb7 Add a new -U flag to instruct ls to use the birthtime for printing or
sorting.

Submitted by:	Andrzej Tobola ato at iem dot pw dot edu dot pl
MFC after:	1 week
2006-03-24 16:38:02 +00:00
Ruslan Ermilov
effd5e7682 Fix spelling. 2006-03-19 19:10:39 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Robert Watson
f9a86e379c Add "-q" argument to getfacl(1), which suppresses the per-file header
comment listing the file name, owner, and group.

MFC after:	1 week
Submitted by:	Jan Srzednicki <w at expro dot pl>
2006-03-13 11:45:29 +00:00
Tom Rhodes
64f9e6ad72 Use .Cm for all key words, not just the ones I added. More in line with
mdoc(7) according to ru.

Requested by:	ru
2006-03-10 12:37:19 +00:00
Garance A Drosehn
88985aedd2 Collapse strncpy/strncat/strncat into a single snprintf, as suggested
by pjd.

MFC after:	3 weeks
2006-03-08 09:15:20 +00:00
Garance A Drosehn
ec71648737 Fix the case where the user specifies an alternate heading for some
output-format keyword, and the keyword they picked is an alias to
some other keyword.                 E.g.:   ps -o stat=Zustand $$
('stat' is defined as an alias for 'state')

PR:		bin/57833
MFC after:	3 weeks
2006-03-08 08:58:44 +00:00
Tom Rhodes
4d5ea49784 Slightly better markup.
Discussed with:	ru
2006-03-06 10:12:14 +00:00
Tom Rhodes
6de681c6e6 Instead of just hinting at available octets, list some.
Mention that the setting of securelevel may affect one's ability to alter flags.
Xref security.7.
Bump doc date.
2006-03-04 02:38:40 +00:00
Olivier Houchard
7bd5296d29 For pts, print the pts number, instead of the full name. As it was, we ended
up always printing "pts".

Submitted by:	Michal Mertl <mime at traveller dot cz>
2006-02-21 13:02:18 +00:00
Hajimu UMEMOTO
f45c0422fc Enable NLS catalog of csh(1).
The tcsh 6.14 uses libiconv to convert catalogs to appropriate charset
dynamically.  However, we don't have libiconv in our tree.  So, I made
some hack to load libiconv dynamically.  If libiconv is available, you
can use catalogs for more locales than the locales which catalog is
actually installed.
To use this feature, you need to symlink catalogs to appropriate
locales.  You can do this by installing ports/shells/tcsh_nls.

Reviewed by:	arch (no objection)
MFC after:	1 week
2006-02-19 06:40:29 +00:00
Gleb Smirnoff
5e09de40c3 Add '-F' option which allows to delete existing empty directories, when
creating symbolic links.

PR:		bin/92149
Submitted by:	Eugene Grosbein <eugen grosbein.pp.ru>
2006-02-14 11:08:05 +00:00
Jens Schweikhardt
81b2ed3edb Initialize PWD early on (don't expect it to be inherited from the
environment or set it only when changing directories with cd).

PR:	standards/92640
2006-02-04 14:47:19 +00:00
Jens Schweikhardt
bbb2cc80aa s/staticly/statically/g 2006-02-04 14:41:27 +00:00
Jens Schweikhardt
b3decf89a2 s/varable/variable/; s/tored/stored/ 2006-02-04 14:38:37 +00:00
Jens Schweikhardt
8dcaad55c2 Remove some white space at EOL. 2006-02-04 14:37:50 +00:00
Stefan Farfeleder
7d1a55fc97 Document that '#' starts a comment.
PR:		85103
Submitted by:	garys
Obtained from:	pdksh manual
Patch from:	Daniel Gerzo (with changes by me)
2006-01-01 16:02:12 +00:00
Maxim Konovalov
19d099fc86 o Now when SIG_IGN signal action for SIGCHLD reap zombies
automatically it is possible wait4(2) returns -1 and sets
errno = ECHILD if there were forked children.  A user can
set such signal handler e.g. via ``trap "" 20'', see a PR
for the test case.  Deal with this case and mark a job as
JOBDONE.

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

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

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

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

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

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

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

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

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

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

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

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

Update the man page to reflect this new behavior.

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

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

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

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

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

	if false; false; then [...]

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

	f() {
		false
		false
	}
	f || true

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

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

1. Remove useless sub-expression:

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

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

2. Remove dead code:

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

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

3. Cleanup Style:

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

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

4. Remove shadowing variable declaration:

   - char *q;

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

5. Just small cosmetics:

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

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

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

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

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

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