summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Add prototypes, ANSIfy functions definitions to reduce WARNS=6 output.charnier2012-01-255-5/+6
|
* sh: Fix $? in the first command of a 'for'.jilles2012-01-221-1/+4
| | | | | | In the first command of a 'for', $? should be the exit status of the last pipeline (command substitution in the word list or command before 'for'), not always 0.
* sh: Remove "kill" example function, which is superseded by the kill builtinjilles2012-01-211-49/+0
| | | | MFC after: 1 week
* Remove unused variables.ed2012-01-171-96/+30
| | | | | Simply annotate the function parameters with __unused, instead of adding the ve-variables. This makes the code build with GCC 4.7 and -Werror.
* sh: Fix execution of multiple statements in a trap when evalskip is setdumbbell2012-01-163-2/+34
| | | | | | | | | | | Before this fix, only the first statement of the trap was executed if evalskip was set. This is for example the case when: o "-e" is set for this shell o a trap is set on EXIT o a function returns 1 and causes the script to abort Reviewed by: jilles MFC after: 2 weeks
* sh: Fix some bugs with exit status from case containing ;&.jilles2012-01-151-9/+24
| | | | | | | | | | | | | Also, rework evalcase() to not evaluate any tree. Instead, return the NCLISTFALLTHRU node and handle it in evaltree(). Fixed bugs: * If a ;& list with non-zero exit status is followed by an empty ;; or final list, the exit status of the case command should be equal to the exit status of the ;& list, not 0. * An empty ;& case should not reset $?.
* sh: Fix two bugs with case and exit status:jilles2012-01-151-1/+3
| | | | | | | * If no pattern is matched, POSIX says the exit status shall be 0 (even if there are command substitutions). * If a pattern is matched and there are no command substitutions, the first command should see the $? from before the case command, not always 0.
* sh: Change input buffer size from 1023 to 1024.jilles2012-01-141-6/+6
| | | | PR: bin/161756
* sh: Fix out of bounds array access when trap is used with an invalid signal.jilles2012-01-141-2/+2
| | | | MFC after: 1 week
* sh: Properly show "Not a directory" error in cd builtin.jilles2012-01-131-1/+6
| | | | | | | | The errno message display added in r222292 did not take attempting to cd to a non-directory or something that cannot be stat()ed into account. PR: bin/164070 MFC after: 10 days
* Spelling fixes for bin/uqs2012-01-071-1/+1
|
* sh: Make various functions static.jilles2012-01-0110-12/+12
|
* sh: Remove unused function scopyn().jilles2012-01-012-20/+0
|
* sh: Make patmatch() non-recursive.jilles2012-01-011-37/+58
|
* sh: Allow quoting ^ and ] in bracket expressions.jilles2011-12-281-4/+4
|
* sh: Use dirent.d_type in pathname generation.jilles2011-12-281-0/+4
| | | | | | This improves performance for globs where a slash or another component follows a component with metacharacters by eliminating unnecessary attempts to open directories that are not.
* sh: Cache de->d_namlen in a local variable.jilles2011-12-281-6/+8
|
* sh: Do not force special builtins non-special in optimized command subst.jilles2011-12-281-2/+1
| | | | | | | | | This is not necessary: errors are already caught in evalbackcmd() and forcelocal handles changes to variables. Note that this depends on r223024. MFC after: 4 weeks
* Fix some obtuse fprintf tricks in bin/ed.dim2011-12-162-18/+20
| | | | MFC after: 1 week
* Add static keywords to chio(1).ed2011-12-111-3/+3
| | | | | All other global variables are already marked static, so for consistency sake, add them to these three arrays as well.
* Move 3.5 KB from the data segment to the text segment.ed2011-12-111-5/+5
| | | | | The `struct modes' are only used by the getter-functions in the same file, so we can safely mark them static and const.
* sh: Remove impossible evalskip check in 'for'.jilles2011-11-271-3/+0
|
* sh: Reduce one level of evaltree() recursion when executing 'case'.jilles2011-11-261-11/+9
| | | | | | | Free expanded case text before executing commands. Remove impossible evalskip checks (expanding an argument cannot set evalskip anymore since $(break) and the like are properly executed in a subshell environment).
* test: Reduce code size of ops table.jilles2011-11-251-5/+5
|
* Remove yet another outdated note about procfs(5) being required.trociny2011-11-221-6/+0
| | | | Spotted by: arundel
* No need in procfs(5).trociny2011-11-222-25/+1
| | | | MFC after: 2 weeks
* sh: Allow unsetting OPTIND.jilles2011-11-201-2/+3
| | | | Note that only assigning the decimal value 1 resets getopts, as before.
* sh: Remove undefined behaviour due to overflow in +/-/* in arithmetic.jilles2011-11-081-3/+3
| | | | With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged.
* sh(1): Improve documentation of field splitting.jilles2011-11-051-11/+55
|
* Put some static keywords in the source code.ed2011-10-316-23/+23
| | | | | | For these simple utilities, it doesn't harm to make all global variables static. In fact, this allows the compiler to perform better forms of optimisation and analysis.
* For processes with no controlling terminal, display "-" in the TTY columntrasz2011-10-302-4/+8
| | | | | | instead of "?". Submitted by: arundel
* If ls was invoked with -i but neither -l nor -s, blocksize was used indes2011-10-191-2/+2
| | | | | | | display() to calculate column widths, but was not initialized in main(). This resulted in a division by zero. Noticed by: Michael Butler <imb@protected-networks.net>
* When calculating the width of the blocksize column, ls(1) used 512-bytedes2011-10-181-2/+2
| | | | | | | units (as returned by stat(2)) instead of BLOCKSIZE units. Submitted by: Paul Schenkeveld MFC after: 3 weeks
* Minor clarificationdes2011-10-181-1/+2
| | | | MFC after: 3 weeks
* Simplify df(1) by factoring out most of the common code:des2011-10-181-26/+27
| | | | | | | | | | | | | | | | | | | | | - In the argc == 0 case, just populate the mount list as before, but do not calculate widths, update totals or print anything. - In the argv > 0 case, collect information about the requested file systems and store it in the mount list, but do not calculate widths, update totals or print anything. - In either case, once all the information has been collected, iterate once through the mount list to calculate widths and totals, then once more to print everything. This also fixes two bugs: firstly, column widths were not calculated correctly if more than one file system was specified on the command line; and secondly, file systems with MNT_IGNORE were included in the totals even if -a was not specified. Noticed by: Paul Schenkeveld MFC after: 3 weeks
* Don't chop IO into small pieces, follow cp(1) and just use MAXPHYS.ivoras2011-10-031-15/+9
|
* Correct a typo that was introduced in 225912gjb2011-10-021-1/+1
| | | | | | Submitted by: Valentin Nechayev (netch % netch!kiev!ua), arundel MFC after: 1 week With-MFC: 225908
* Tweaks to ps(1):gjb2011-10-011-9/+16
| | | | | | | | | | | | | | | | - there's no reason the semantics of the -x flag are being explained in the -a flag description - be more precise regarding the relation between the -a flag and the security.bsd.see_other_uids sysctl - describe the format of the -t flag's argument - 'con' no longer is a possible entry in the 'TT' column - explain that the 'TT' column refers to pseudo-terminals via mere numbers - add a hint in the 'tt' keyword description that a keyword 'tty' exists, which will give the full terminal pathname Submitted by: arundel (via docs@) (original) MFC after: 1 week With-MFC: 225908
* Reorder default ps(1) output according to reality.gjb2011-10-011-2/+2
| | | | | Submitted by: arundel (via docs@) MFC after: 1 week
* Make ps(1) automatically size its column widths.trasz2011-09-295-603/+451
|
* Get rid of major/minor number distinction.ed2011-09-285-45/+22
| | | | | | | | | | | | | | | | | | | | | | As of FreeBSD 6, devices can only be opened through devfs. These device nodes don't have major and minor numbers anymore. The st_rdev field in struct stat is simply based a copy of st_ino. Simply display device numbers as hexadecimal, using "%#jx". This is allowed by POSIX, since it explicitly states things like the following (example taken from ls(1)): "If the file is a character special or block special file, the size of the file may be replaced with implementation-defined information associated with the device in question." This makes the output of these commands more compact. For example, ls(1) now uses approximately four columns less. While there, simplify the column length calculation from ls(1) by calling snprintf() with a NULL buffer. Don't be afraid; if needed one can still obtain individual major/minor numbers using stat(1).
* Fix memory leaks in error cases.brueffer2011-08-271-0/+3
| | | | | | | PR: 159011 Submitted by: Henning Petersen <henning.petersen@t-online.de> Approved by: re (kib) MFC after: 1 week
* Rename ki_ocomm to ki_tdname and OCOMMLEN to TDNAMLEN.bz2011-07-182-9/+9
| | | | | | | | | Provide backward compatibility defines under BURN_BRIDGES. Suggested by: jhb Reviewed by: emaste Sponsored by: Sandvine Incorporated Approved by: re (kib)
* sh(1): Extend documentation about subshells.jilles2011-07-101-8/+46
| | | | | | | | | | | Because sh executes commands in subshell environments without forking in more and more cases (particularly from 8.0 on), it makes sense to describe subshell environments more precisely using ideas from POSIX, together with some FreeBSD-specific items. In particular, the hash and times builtins may not behave as if their state is copied for a subshell environment while leaving the parent shell environment unchanged.
* Fix style, since this file has just been touched in a major way.se2011-07-091-96/+75
| | | | No actual code changes.
* Some refactoring for easier maintenance of the code. This is a follow-upse2011-07-091-146/+69
| | | | | | to re-establishment of 64bit arithmetic, but is committed separately, to not obscure that conversion. This commit does not change the observed behaviour of expr in any way. Style will be fixed in a follow-up commit.
* Make /bin/expr support 64bit numeric range and range checks by default,se2011-07-092-140/+152
| | | | | | | | | | | | | | | | | | | | | | | | again. This brings back the behaviour of expr in FreeBSD-4, which had been reverted due to an assumed incompatbility with POSIX.1 for FreeBSD-5. This issue has been discussed in the freebsd-standards list, and the consensus was, that POSIX.1 is in fact not violated by this extension, since it affects only cases of POSIX undefined behaviour (overflow of signed long). Other operating systems did upgrade their versions of expr to support 64bit range, after it had been initially brought to FreeBSD. They have used it for a decade without problems, meanwhile. The -e option is retained, but it will only select less strict checking of numeric parameters (leading white-space, leading "+" are allowed and skipped, an empty string is considered to represent 0 in numeric context.) The call of check_utility_compat() as a means of establishing backwards compatibility with FreeBSD-4 is considered obsolete, but preserved in this commit. It is expected to be removed in a later revision of this file. Reviewed by: bde, das, jilles MFC after: 2 month (those parts that do not violate POLA)
* Bump date after the previous commit.pluknet2011-07-011-1/+1
|
* Update and sort the list of the available keywords.pluknet2011-07-011-6/+8
|
* sh: Include <limits.h> instead of non-standard <sys/limits.h>.jilles2011-06-261-1/+1
|
OpenPOWER on IntegriCloud