summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Update man pages and clarify a number of options.grog2012-11-162-35/+65
| | | | | | Rework block count calculations to work correctly with small "block" sizes. MFC after: 14 days
* Fix section number for pstat and swapinfo cross references.pluknet2012-11-151-3/+3
| | | | MFC after: 3 days
* Follow the behavior as specified in POSIX:eadler2012-11-151-1/+1
| | | | | | | | | | | | | if (exists AND (NOT f_option) AND ((not_writable AND input_is_terminal) OR i_option)) prompt in particular, add the test for input_is_terminal PR: bin/173039 Submitted by: Mark Johnston <markjdb@gmail.com> Approved by: cperciva MFC after: 3 days
* Add , (comma) option to print sizes grouped and separated by thousandsgrog2012-11-152-16/+57
| | | | | | | using the non-monetary separator returned by localeconv(3), typically a comma or period. MFC after: 14 days
* sh: Remove an unused variable.jilles2012-11-142-2/+0
|
* sh: Forward-declare struct alias instead of giving up type safety via void *jilles2012-11-112-4/+5
|
* Undo over-aggressive conversion of spaces to tabs. ie: those withinpeter2012-11-092-6/+6
| | | | format strings, "period, space, space" in comment text, etc.
* Replace spaces with tabs where appropriate.grog2012-11-086-36/+36
| | | | Reminded by: jh@
* sh: Fix two issues when an alias is redefined:jilles2012-11-081-0/+11
| | | | | | | | | | | | | * The last character is not displayed. * If the alias ends with itself (as a word), an infinite memory-eating loop occurs. If an alias is defined initially, a space is appended to avoid recursion but this did not happen when an alias was later modified. PR: bin/173418 Submitted by: Daniel F. MFC after: 1 week
* Add y flag and environment variable LS_SAMESORT to specify the samegrog2012-11-086-21/+110
| | | | | | | | | | | | | | | | | sorting order for time and name with the -t option. IEEE Std 1003.2 (POSIX.2) mandates that the -t option sort in descending order, and that if two files have the same timestamp, they should be sorted in ascending order of their names. The -r flag reverses both of these sort orders, so they're never the same. This creates significant problems for sequentially named files stored on FAT file systems, where it can be impossible to list them in the order in which they were created. Add , (comma) option to print file sizes grouped and separated by thousands using the non-monetary separator returned by localeconv(3), typically a comma or period. MFC after: 14 days
* Sort option parsing as far as practical.grog2012-11-071-41/+42
|
* sh: Change cmdtype in tblentry from short to signed char.jilles2012-11-051-1/+1
| | | | | If this is a smaller type than int anyway, we can make it the smallest possible.
* sh: Use C99 flexible array instead of accessing array beyond bounds.jilles2012-11-031-3/+2
| | | | | | | | Although sufficient memory is available for a longer string in cmdname, this is undefined behaviour anyway. Side effect: for alignment reasons, an additional byte of memory is allocated per hashed command.
* Add a couple of examples.joel2012-11-021-1/+65
| | | | Obtained from: OpenBSD
* More -Wmissing-variable-declarations fixes.ed2012-10-201-0/+5
| | | | | | | | | | In addition to adding missing `static' keywords: - bin/dd: Pull in `extern.h' to guarantee consistency with source file. - libexec/rpc.rusersd: Move shared globals into an extern.h. - libexec/talkd: Move `debug' and `hostname' into extern.h. - usr.bin/cksum: Put counters in extern.h, as they are used by ckdist/mtree. - usr.bin/m4: Move `end_result' into extern.h. - usr.sbin/services_mkdb: Move shared globals into an extern.h.
* More -Wmissing-variable-declarations fixes.ed2012-10-196-17/+8
| | | | | | | | | | | | | | | | In addition to adding `static' where possible: - bin/date: Move `retval' into extern.h to make it visible to date.c. - bin/ed: Move globally used variables into ed.h. - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings. - usr.bin/calendar: Remove unneeded variables. - usr.bin/chat: Make `line' local instead of global. - usr.bin/elfdump: Comment out unneeded function. - usr.bin/rlogin: Use _Noreturn instead of __dead2. - usr.bin/tset: Pull `Ospeed' into extern.h. - usr.sbin/mfiutil: Put global variables in mfiutil.h. - usr.sbin/pkg: Remove unused `os_corres'. - usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
* Fix warnings found by -Wmising-variable-declarations.ed2012-10-1915-87/+90
| | | | | | | | | | | This self-written compiler warning, which is hopefully going to be committed into LLVM sources soon, warns about potentially missing `static' keywords, similar to -Wmissing-prototypes. - bin/pax: Move external declaration of chdname and s_mask into extern.h. - bin/setfacl: Move setfacl.c-specific stuff out of setfacl.h. - sbin/mount_fusefs: Remove char *progname; use getprogname(). - others: add `static' where possible.
* mdoc: don't nest displays. The markup here isn't adding anything anyway.joel2012-10-141-2/+2
| | | | | | Fixes a mandoc lint warning. Discussed with: brueffer, Jason McIntyre <jmc@kerhand.co.uk>
* Fix bin/ build with a 64-bit ino_t.mdf2012-09-273-9/+14
| | | | Original code by: Gleb Kurtsou
* - Bump date.zont2012-09-181-1/+1
| | | | | | Submitted by: pluknet Approved by: kib (mentor) X-MFC-With: r240645
* - Add 'dsiz' and 'ssiz' keywords to show data and stack size respectively.zont2012-09-182-0/+6
| | | | | Approved by: kib (mentor) MFC after: 1 week
* Revert 240527:eadler2012-09-161-1/+0
| | | | | | | mntbuf can poit to memory allocated by getmntinfo(3) which can't be freed PR: bin/171634 Approved by: cperciva (implicit)
* sh: Prefer internal nextopt() to libc getopt().jilles2012-09-155-83/+37
| | | | | | | | | This reduces code duplication and code size. /usr/bin/printf is not affected. Side effect: different error messages when certain builtins are passed invalid options.
* Free memory before exiting in order toeadler2012-09-141-0/+1
| | | | | | | | | help tools understand that we're not leaking it. PR: bin/171634 Submitted by: Erik Cederstrand <erik@cederstrand.dk> Approved by: cperciva MFC after: 3 days
* sh: Reduce code duplication: use setinputfile instead of open/setinputfdjilles2012-09-141-8/+1
| | | | | | combination. MFC after: 2 weeks
* Minor mdoc fix.joel2012-09-111-1/+2
|
* sh: Remove XXX comment about removing nextopt().jilles2012-09-081-4/+0
| | | | | Using nextopt() avoids depending on the BSD-specific optreset feature in getopt() and reduces code size (both source and binary).
* Use "e.g.", not "i.e.", to introduce an example.kevlo2012-09-071-1/+1
| | | | Obtained from: NetBSD
* Explicitly mention that "cp -p" copies ACLs.trasz2012-09-041-2/+2
| | | | | PR: docs/168962 MFC after: 1 month
* Fix an error in setfacl(1) that manifested like this:trasz2012-09-041-3/+4
| | | | | | | | | | | | | | | | | | | | | | | # setfacl -m u:trasz:rwx x # setfacl -m u:root:rwx x # getfacl x # file: x # owner: root # group: wheel user::rw- user:root:rwx user:trasz:rwx group::r-- mask::rwx other::r-- # setfacl -m u:root:rwx x setfacl: x: acl_calc_mask() failed: Invalid argument setfacl: x: failed to set ACL mask For NFSv4 ACLs, this sort of situation would result in duplicated entries. MFC after: 1 month
* In getfacl(1) manual page, mention where to read about the ACL syntax.trasz2012-09-041-0/+4
| | | | | | | | PR submitter suggested adding it to acl(3) instead, but I don't think pointing ordinary users at section 3 is a good idea. PR: docs/162380 MFC after: 1 month
* Make "setfacl -bd" an alias for "setfacl -k". Previously it would crashtrasz2012-09-041-0/+11
| | | | | | | on assert. PR: bin/165807 MFC after: 1 month
* Make setfacl(1) behave properly in situations like "setfacl -kd".trasz2012-09-041-0/+15
| | | | MFC after: 1 month
* Fix compact form of "synchronize" permission in setfacl(1) manual page - ittrasz2012-09-031-2/+2
| | | | | | | should be "s", not "S". PR: docs/162380 MFC after: 2 weeks
* Rework all non-contributed files that use `struct timezone'.ed2012-09-013-7/+7
| | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead.
* Add a -h flag similar to the -h flag for ln to force mv(1) to treat ajhb2012-08-312-6/+36
| | | | | | | | | symbolic link to a directory for the target as a symbolic link instead of a directory. This makes it possible to atomically update a symbolic link using rename(). Reviewed by: gj MFC after: 2 weeks
* Avoid passing uninitialized stack to addelem() if called with an empty arg.emaste2012-08-291-2/+2
| | | | PR: bin/171174
* sh: Fix EINTR race condition in "wait" and "set -T" using sigsuspend().jilles2012-07-293-4/+49
| | | | | | | | | | | | | | | | | When waiting for child processes using "wait" or if "set -T" is in effect, a signal interrupts the wait. Make sure there is no window where the signal handler may be invoked (setting a flag) just before going to sleep. There is a similar race condition in the shell language, but scripts can avoid it by exiting from the trap handler or enforcing synchronization using a fifo. If SIGCHLD is not trapped, a signal handler must be installed for it. Only install this handler for the duration of the wait to avoid triggering unexpected [EINTR] errors elsewhere. Note that for some reason only SIGINT and SIGQUIT interrupt a "wait" command. This remains the case.
* sh: Do not ask for stopped/continued processes if we do not need themjilles2012-07-281-6/+5
| | | | rather than retrying wait3 if they happen.
* sh: Inline waitproc() into its only caller.jilles2012-07-281-22/+9
|
* sh: Track continued jobs (even if not continued by bg or fg).jilles2012-07-281-3/+8
| | | | | | | This uses wait3's WCONTINUED flag. There is no message for this. The change is visible in "jobs" or if the job stops again.
* Use proper error message when fstat(2) fails on stdout.jh2012-07-201-1/+1
| | | | | PR: bin/159746 Submitted by: Alex K.
* style(9).jh2012-07-201-16/+19
|
* stty: Mark usage() __dead2.jilles2012-07-151-1/+1
| | | | This reduces code size a little and should fix a scan-build warning.
* ps: Fix memory leak when showing start/lstart for swapped-out process.jilles2012-07-151-4/+6
| | | | Spotted by: scan-build (uqs)
* sh: Reset pendingsigs before checking pending traps, not after.jilles2012-07-151-1/+1
| | | | | Otherwise, a signal arriving at exactly the right moment might not be processed until another signal arrived.
* sh: Remove unused variable in_dowait.jilles2012-07-152-4/+0
|
* sh: Expand assignment-like words specially for export/readonly/local.jilles2012-07-154-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | Examples: export x=~ now expands the tilde local y=$1 is now safe, even if $1 contains IFS characters or metacharacters. For a word to "look like an assignment", it must start with a name followed by an equals sign, none of which may be quoted. The special treatment applies when the first word (potentially after "command") is "export", "readonly" or "local". There may be quoting characters but no expansions. If "local" is overridden with a function there is no special treatment ("export" and "readonly" cannot be overridden with a function). If things like local arr=(1 2 3) are ever allowed in the future, they cannot call a "local" function. This would either be a run-time error or it would call the builtin. This matches Austin Group bug #351, planned for the next issue of POSIX.1. PR: bin/166771
* Merge libedit adjustment from NetBSD.pfg2012-07-111-1/+1
| | | | | | | | | | | | | On recent versions of NetBSD's libedit, el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with newer versions of libedit now allowing EINTR to return. Obtained from: NetBSD Reviewed by: jilles MFC after: 3 weeks
* Polish previous revision: if the fts_* routines have lstat()'ed thedelphij2012-06-201-2/+8
| | | | | | | | | directory entry then use the struct stat from that instead of doing it again, and skip the rm_overwrite() call if fts_read() indicated that the entry couldn't be a regular file. Obtained from: OpenBSD MFC after: 1 week
OpenPOWER on IntegriCloud