summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Recognize "--" as end of options in local builtin.jilles2013-08-141-0/+1
|
* sh: Allow a lone redirection before '|', ';;' or ';&'.jilles2013-08-141-0/+3
| | | | | | | Example: </dev/null | : PR: 181240 MFC after: 1 week
* Add -c flag to pgrep(1) and pkill(1), to match login classes.trasz2013-08-092-8/+42
| | | | MFC after: 1 month
* sh: Remove an incorrect comment.jilles2013-07-251-1/+1
|
* sh: Remove #define MKINIT.jilles2013-07-257-11/+9
| | | | MKINIT only served for the removed mkinit. Many variables can be static now.
* sh: Remove mkinit.jilles2013-07-2514-576/+32
| | | | | | | | | | | | | | Replace the RESET blocks with regular functions and a reset() function that calls them all. This code generation tool is unusual and does not appear to provide much benefit. I do not think isolating the knowledge about which modules need to be reset is worth an almost 500-line build tool and wider scope for variables used by the reset functions. Also, relying on reset functions is often wrong: the cleanup should be done in exception handlers so that no stale state remains after 'command eval' and the like.
* sh: Remove output.c's reset() handler.jilles2013-07-251-19/+0
| | | | | These cleanup operations are not needed because they are already performed after an optimized command substitution (whether there was an error or not).
* sh: Do not read from stdin if an error occurs during -i -c cmd.jilles2013-07-121-1/+1
| | | | | | | | | | | | Although using -i with -c does not seem very useful, it seems inappropriate to read commands from the terminal in this case. Side effect: if the -s -c extension is used and the -s option is turned off using 'set +s' during the interactive part, the shell now exits after an error or interrupt. Note that POSIX only specifies -s as option to sh, not to set. See also Austin Group issue #718.
* Fix a -Wunsequenced warning.kientzle2013-06-291-1/+1
| | | | Submitted by: dt71@gmx.com
* sh: Do not close(-1) if pipe() fails.jilles2013-06-281-1/+2
|
* sh(1): A subshell environment has its own rlimits (ulimit).jilles2013-06-141-1/+4
| | | | | | This has always been the case and is intended (just like cd). This matches Austin group issue #706.
* sleep: Explain in a comment why the [EINTR] check is there.jilles2013-06-051-0/+6
| | | | Suggested by: eadler
* sh(1): Document new features in wait builtin.jilles2013-06-051-4/+9
| | | | PR: 176916
* sh: Return status 127 for unknown jobs in wait builtin.jilles2013-06-051-5/+19
| | | | | | | | | | This is required by POSIX, at least for pids that are not known child processes. Other problems with job specifications still cause wait to abort with exit status 2. PR: 176916
* sh: Allow multiple operands in wait builtin.jilles2013-06-051-6/+18
| | | | | | | | This is only part of the PR; the behaviour for unknown/invalid pids/jobs remains unchanged (aborts the builtin with status 2). PR: 176916 Submitted by: Vadim Goncharov
* Add 'static' where able.eadler2013-06-021-4/+4
|
* test(1): Add information about replacing -nt/-ot.jilles2013-05-311-0/+16
|
* test(1): List non-standard primaries.jilles2013-05-311-1/+12
|
* test: Remove -ntXY and -otXY primaries.jilles2013-05-312-215/+27
| | | | | | | | | | | | | | | This reverts commit r247274. As maintainer of sh, I disapprove of this feature addition. It is too specific and can be done without easily using find(1) or stat(1). I will add some hints to the test(1) man page shortly. In general, FreeBSD sh is not the place to invent new shell language features. This is how it has been maintained and adding features randomly does not work with that. The new syntax (e.g. [ FILE1 -ntca FILE2 ]) looks cryptic to me.
* sleep: Improve nanosleep() error handling:jilles2013-05-281-2/+3
| | | | | | | | | * Work around kernel bugs that cause a spurious [EINTR] return if a debugger (such as truss(1)) is attached. * Write an error message if an error other than [EINTR] occurs. PR: bin/178664
* Complete revision 243104.grog2013-05-171-1/+3
|
* Constify parameters, no functional or binary change.delphij2013-05-151-6/+6
| | | | | Verified with: sha256(1) MFC after: 2 weeks
* mdoc sweep.joel2013-05-121-2/+2
|
* sh: Remove linked list of stack marks.jilles2013-05-112-18/+3
| | | | | | | | | | | | | | | | The linked list of stack marks may cause problems if the allocation stack is used between an exception and a higher-level popstackmark(), as it may then touch a stack mark that is local to a function which has returned. Also, the adjustment compares to a pointer passed to realloc(), which is undefined behaviour. Instead of adjusting stack marks when reallocating stack blocks, ensure that such an adjustment is never necessary by fixing a small piece of memory in place at a stack mark. This also simplifies the code. To avoid the problems reported in bin/175922, it remains necessary to call setstackmark() after popstackmark() if the stack mark remains in use.
* Make dd's signal handler async safe.eadler2013-05-106-20/+22
| | | | | | | | | PR: bin/75258 Submitted by: "Oleg V. Nauman" <oleg@reis.zp.ua> Arrival Date: Sun Dec 19 14:50:21 GMT 2004 Reviewed by: mjg, jhb Reviewed by: jilles (earlier version) MFC after: 1 week
* Fix two typoseadler2013-05-091-2/+2
| | | | Reviewed by: jilles
* sh: Use O_CLOEXEC and F_DUPFD_CLOEXEC instead of separate fcntl() call.jilles2013-05-054-17/+11
|
* sh: Improve error handling in read builtin:jilles2013-05-032-5/+29
| | | | | | | | | | | | * If read -t times out, return status as if interrupted by SIGALRM (formerly 1). * If a trapped signal interrupts read, return status 128+sig (formerly 1). * If [EINTR] occurs but there is no trap, retry the read (for example because of a SIGWINCH in interactive mode). * If a read error occurs, write an error message and return status 2. As before, a variable assignment error returns 2 and discards the remaining data read.
* Mark usage() __dead2eadler2013-04-281-1/+1
|
* Remove cast that was only required for K&R C.eadler2013-04-281-1/+1
| | | | Reviewed by: jilles
* Add missing static qualifierseadler2013-04-271-2/+2
| | | | | Reviewed by: ed, jilles MFC After: 3 days
* sh: Don't consider jobs -s/-p as reporting the status of jobs.jilles2013-04-271-7/+9
| | | | | This ensures that something like j=$(jobs -p) does not prevent any status from being written to the terminal.
* Add two more 'static' qualifierseadler2013-04-261-2/+2
|
* Take some improvements from DragonFlyBSD:eadler2013-04-261-17/+17
| | | | | | | | | | - add const where appropriate - add static where appropriate - fix a whitespace issues Reviewed by: brooks Obtained from: DragonFlyBSD MFC After: 1 week
* Add -x option to avoid crossing mount points when removing a hierarchy.eadler2013-04-262-6/+13
| | | | | | Discussed on: -hackers Inspired by: DragonflyBSD MFC After: 1 week
* Don't appease clang static analyzer after all and roll backuqs2013-04-261-1/+0
| | | | | | | | | the free(3) of mntbuf ... again. There's no point in doing useless extra work when we're about to exit. See also r240565. Not reading file history: uqs
* Literally follow POSIX:kib2013-04-231-1/+1
| | | | | | | | | | | | | If the bs= expr operand is specified and no conversions other than sync, noerror, or notrunc are requested, the data returned from each input block shall be written as a separate output block. In particular, when both bs=size and conv=sparce were specified, the resulted file was fully filled, instead of sparce. PR: standards/177742 Submitted by: Matthew Rezny <mrezny@hexaneinc.com> MFC after: 2 weeks
* - Add the __dead2 attribute since it is a function that never returnseadler2013-04-231-1/+2
| | | | | | | | - Add an empty line in usage() according to style(9) PR: bin/177076 Submitted by: Fernando <fernando.apesteguia@gmail.com> Approved by: cperciva (mentor)
* Point users towards nisdomainname and rc.conf.joel2013-04-221-6/+8
| | | | | | PR: 144630 Submitted by: Stefan Krueger <stadtkind2@gmx.de>, Fel <wtfcrap@mail.ru>
* Document a few expansions for the $PS1 and $PS2 environmental variables.joel2013-04-211-1/+25
| | | | | | PR: 173410 Submitted by: Derek Wood <ddwood@outlook.com> Reviewed by: jilles
* bin/df: Fix unitialized use in prtstatuqs2013-04-201-5/+7
| | | | | | | | | While here: - use NULL in the context of pointers - use memset instead of bzero throughout the file - free memory to appease clang static analyzer Found by: Coverity Scan (the UNINIT one)
* Update chio(1) and ch(4) to support reporting element designators.ken2013-04-191-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato <hrs@> for the explaining UTF-8 printing and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h: Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c: Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong MFC After: 1 week
* Add the Clang specific -Wmissing-variable-declarations to WARNS=6.ed2013-04-191-0/+2
| | | | | | | | | | | | | This compiler flag enforces that that people either mark variables static or use an external declarations for the variable, similar to how -Wmissing-prototypes works for functions. Due to the fact that Yacc/Lex generate code that cannot trivially be changed to not warn because of this (lots of yy* variables), add a NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this specific compiler warning. Announced on: toolchain@
* sh: Don't modify exit status when break/continue/return passes !.jilles2013-04-121-0/+2
| | | | | | | | This matches what would happen if ! P were to be replaced with if P; then false; else true; fi. Example: f() { ! return 0; }; f
* sh: Add const to nodesavestr().jilles2013-04-071-3/+3
|
* IFP4 change 222074.brooks2013-04-031-0/+7
| | | | | | | | | | Introduce an explicit close of the output descriptor so that work done on close is accounted for in the summary output triggered at exit (implicit close()s occur after atexit() hooks). This is useful because some devices such as cfi(4) may perform signficant work after a close occurs (e.g. erasing and rewriting a block of flash).
* sh: Write as much into the heredoc pipe as possible, to avoid forking.jilles2013-04-021-5/+13
| | | | | | Use non-blocking I/O to write as much as the pipe will accept (often 64K, but it can be as little as 4K), avoiding the need for the ugly PIPESIZE constant. If PIPESIZE was set too high, a deadlock would occur.
* sh: Fix various compiler warnings.jilles2013-04-0111-32/+36
| | | | | | | It now passes WARNS=7 with clang on i386. GCC 4.2.1 does not understand setjmp() properly so will always trigger -Wuninitialized. I will not add the volatile keywords to suppress this.
* Mention that read_attributes, write_attributes, read_acl and write_acltrasz2013-04-011-1/+5
| | | | | | | are always permitted for the file owner. PR: kern/174948 MFC after: 1 week
* Minor mdoc fix.joel2013-03-291-1/+1
|
OpenPOWER on IntegriCloud