summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* sh(1): Improve documentation of shell patterns:jilles2011-06-241-5/+10
| | | | | | | | | | | * Shell patterns are also for ${var#pat} and the like. * An '!' by itself will not trigger pathname generation so do not call it a meta-character, even though it has a special meaning directly after an '['. * Character ranges are locale-dependent. * A '^' will complement a character class like '!' but is non-standard. MFC after: 1 week
* sh(1): Document the case command better.jilles2011-06-241-2/+13
| | | | | Suggested by: netchild Reviewed by: gjb
* Remove duplicated header fileskevlo2011-06-242-2/+0
|
* Make ``realpath'' behave like ``realpath .''.ru2011-06-212-11/+15
|
* sh: Remove special support for background simple commands.jilles2011-06-183-9/+5
| | | | It expands the arguments in the parent shell process, which is incorrect.
* sh: Add do-nothing -h option.jilles2011-06-182-2/+8
| | | | | | | | | | POSIX requires a -h option to sh and set, to locate and remember utilities invoked by functions as they are defined. Given that this locate-and-remember process is optional elsewhere, it seems safe enough to make this option do nothing. POSIX does not specify a long name for this option. Follow ksh in calling it "trackall".
* sh: Add case statement fallthrough (with ';&' instead of ';;').jilles2011-06-175-7/+28
| | | | | | | | | | | | Replacing ;; with the new control operator ;& will cause the next list to be executed as well without checking its pattern, continuing until a list ends with ;; or until the end of the case statement. This is like omitting "break" in a C "switch" statement. The sequence ;& was formerly invalid. This feature is proposed for the next POSIX issue in Austin Group issue #449.
* sh: Skip variables with invalid names in "set", "export -p", "readonly -p".jilles2011-06-171-0/+13
| | | | This ensures the output of these commands is valid shell input.
* sh: Reduce unnecessary forks with eval.jilles2011-06-161-1/+2
| | | | | | | | | | The eval special builtin now runs the code with EV_EXIT if it was run with EV_EXIT itself. In particular, this eliminates one fork when a command substitution contains an eval command that ends with an external program or a subshell. This is similar to what r220978 did for functions.
* sh: Add support for named character classes in bracket expressions.jilles2011-06-152-2/+48
| | | | | Example: case x in [[:alpha:]]) echo yes ;; esac
* Add "gid" and "group" keywords to display the effective group IDtrasz2011-06-144-2/+34
| | | | | | | and effective group name. Also, add "egid", "egroup" and "euid" aliases. PR: bin/146331 Submitted by: Jeremie Le Hen <jeremie at le-hen dot org>
* sh: Fix duplicate prototypes for builtins.jilles2011-06-1323-41/+14
| | | | | | Have mkbuiltins write the prototypes for the *cmd functions to builtins.h instead of builtins.c and include builtins.h in more .c files instead of duplicating prototypes for *cmd functions in other headers.
* sh: Save/restore changed variables in optimized command substitution.jilles2011-06-127-89/+25
| | | | | | | | | | | In optimized command substitution, save and restore any variables changed by expansions (${var=value} and $((var=assigned))), instead of trying to determine if an expansion may cause such changes. If $! is referenced in optimized command substitution, do not cause jobs to be remembered longer. This fixes $(jobs $!) again, simplifies the man page and shortens the code.
* sh: Fix locale-dependent ranges in bracket expressions.jilles2011-06-121-4/+4
| | | | | | | | When I added UTF-8 support in r221646, the LC_COLLATE-based ordering broke because of sign extension of char. Because of libc restrictions, this does not work for UTF-8. For UTF-8 locales, ranges always use character code order.
* sh: Read .profile from the home directory (or / if HOME is not set).jilles2011-06-121-1/+1
| | | | | | | | | | In most cases, login shells are started from the home directory, but not in all, such as xterm -ls. This commit depends on r222957 for read_profile() performing parameter expansion. PR: bin/50569
* sh: Do parameter expansion on ENV before using it.jilles2011-06-102-7/+13
| | | | | | This is required by POSIX, and allows things like ENV=\$HOME/.shrc. Note that tilde expansion is explicitly not performed.
* sh: Do parameter expansion before printing PS4 (set -x).jilles2011-06-095-4/+51
| | | | | | | | | | | | | | | | The function name expandstr() and the general idea of doing this kind of expansion by treating the text as a here document without end marker is from dash. All variants of parameter expansion and arithmetic expansion also work (the latter is not required by POSIX but it does not take extra code and many other shells also allow it). Command substitution is prevented because I think it causes too much code to be re-entered (for example creating an unbounded recursion of trace lines). Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would be quite useful.
* sh: Fix $? in heredocs on simple commands.jilles2011-06-051-1/+2
| | | | PR: bin/41410
* sh: Improve error message if the script cannot be opened.jilles2011-06-041-2/+4
| | | | Avoid "<nosuchfile>: cannot open <nosuchfile>: ...".
* sh: Reduce more needless differences between error messages.jilles2011-06-044-5/+5
|
* sh: Honour -n while processing -c string.jilles2011-06-041-1/+1
|
* sh: Remove the "exp" builtin.jilles2011-05-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The "exp" builtin is undocumented, non-standard and not very useful. If exp's return value is not used, something like VAR=$(exp EXPRESSION) is equivalent to VAR=$((EXPRESSION)) except that errors in the expression are fatal and quoting special characters is not needed in the latter case. If exp's return value is used, something like if exp EXPRESSION >/dev/null can be replaced by if [ $((EXPRESSION)) -ne 0 ] with similar differences. The exp-run showed that "let" is close enough to bash's and ksh's builtin that removing it would break a few ports. Therefore, "let" remains in 9.x. PR: bin/104432 Exp-run done by: pav (with some other sh(1) changes)
* sh: Correct criterion for using CDPATH in cd.jilles2011-05-271-1/+4
| | | | | | | CDPATH should be ignored not only for pathnames starting with '/' but also for pathnames whose first component is '.' or '..'. The man page already describes this behaviour.
* sh: Various updates to the TOUR document.jilles2011-05-271-29/+8
|
* sh: Fix unquoted $@/$* if IFS=''.jilles2011-05-271-2/+5
| | | | | | If IFS is null, unquoted $@/$* should still expand to separate words. This differs from quoted $@ (which does not depend on IFS) in that pathname generation is performed and empty words are removed.
* sh: Show errno messages in cd.jilles2011-05-251-1/+4
|
* sh: Remove obsolete token type TENDBQUOTE.jilles2011-05-221-1/+0
| | | | | This token type was related to Almquist's original version of backquotes that could not nest and fell into disuse fairly soon.
* Fix some typos under bin/uqs2011-05-223-4/+4
| | | | Found by: codespell
* Fix a bunch of typos and a couple of whitespace nits.uqs2011-05-2212-47/+47
| | | | Helped by: codespell and vim's spellchecker
* sh: Fix bss-based buffer overflow in . builtin.jilles2011-05-221-4/+7
| | | | | | | | | | | If the length of a directory in PATH together with the given filename exceeded FILENAME_MAX (which may happen even for pathnames that work), a static buffer was overflown. The static buffer is unnecessary, we can use the stalloc() stack. Obtained from: NetBSD MFC after: 1 week
* sh: Expand aliases after assignments and redirections.jilles2011-05-214-12/+29
|
* sh: Implement the cd -e flag proposed for the next POSIX issue.jilles2011-05-202-10/+28
| | | | | | | | | This reflects failure to determine the pathname of the new directory in the exit status (1). Normally, cd returns successfully if it did chdir() and the call was successful. In POSIX, -e only has meaning with -P; because our -L is not entirely compliant and may fall back to -P mode, -e has some effect with -L as well.
* sh: Allow terminating a heredoc with a terminator at EOF without a newline.jilles2011-05-201-3/+5
| | | | | | | | | | | | | | | | | | | | | | This is sometimes used with eval or old-style command substitution, and most shells other than ash derivatives allow it. It can also be used with scripts that violate POSIX's requirement on the application that they end in a newline (scripts must be text files except that line length is unlimited). Example: v=`cat <<EOF foo EOF` echo $v This commit does not add support for the similar construct with new-style command substitution, like v=$(cat <<EOF foo EOF) This continues to require a newline after the terminator.
* Spelling in P_HADTHREADS.pluknet2011-05-201-1/+1
| | | | MFC after: 1 week
* Fix the description of the "paddr" keyword. It shows a processpluknet2011-05-201-1/+1
| | | | | | pointer just like a dublicating "uprocp". MFC after: 1 week
OpenPOWER on IntegriCloud