aboutsummaryrefslogtreecommitdiff
path: root/bin/sh
Commit message (Collapse)AuthorAgeFilesLines
* Update Makefile.depend filesSimon J. Gerraty23 hours1-1/+0
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* manuals: Fix typos in -offset for .Bd and .BlGraham Percival12 days1-2/+2
| | | | | | | | | | | | | | | | | The intended value is: -offset indent If there's any typo such that the value doesn't match the pre-defined strings, then the offset is the same width as the value. So by chance, "-offset -ident" ended up being a standard-width indent (since the default indent is 6 chars, and "-ident" also has 6 chars), whereas "-offset -indent" had a longer indent, and "-offset ident" had a shorter one. Signed-off-by: Graham Percival <gperciva@tarsnap.com> Reviewed by: mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com> MFC after: 3 days Sponsored by: Tarsnap Backup Inc. Pull Request: https://github.com/freebsd/freebsd-src/pull/1436
* bin/sh: support RLIMIT_PIPEBUFKonstantin Belousov2024-09-201-1/+4
| | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46619
* Remove residual blank line at start of MakefileWarner Losh2024-07-1510-10/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* sh(1): Grammar fix in jobs.cFu-Cheng Wang2024-02-131-1/+1
| | | | | Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Pull Request: https://github.com/freebsd/freebsd-src/pull/992
* sh(1): Fix typoPei-Ju Chien2023-12-261-1/+1
| | | | | | | | Remove extra 'ing' from 'bookinging.' Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Reviewed by: imp, Mina Galić Pull Request: https://github.com/freebsd/freebsd-src/pull/934
* sh(1): Fix typoKai-Yang Chen2023-12-261-1/+1
| | | | | | Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Reviewed by: imp, @rilysh on github Pull Request: https://github.com/freebsd/freebsd-src/pull/935
* sh(1): Fix typoWEININGCHIU2023-12-261-1/+1
| | | | | | | | nozero -> non-zero Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Reviewed by: imp, Mina Galić Pull Request: https://github.com/freebsd/freebsd-src/pull/936
* bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2720-60/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-273-27/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* bin: Remove ancient SCCS tags.Warner Losh2023-11-2761-143/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Fix /root permissions after 'make installworld'Thomas Eberhardt2023-11-161-0/+1
| | | | | | | | | | | | | | | | | According to /etc/mtree/BSD.root.dist /root should have 0750 permissions, but the build target 'make installworld' changes these to 0755. This is caused by the installation of the configuration files of sh(1) and csh(1). Correct this by specifying the correct default /root permissions. PR: 273342 Reviewed by: jilles Approved by: jilles MFC after: 2 weeks Differential Revision:https://reviews.freebsd.org/D42395
* sh: implement PS1 \D to print current timePiotr Pawel Stefaniak2023-09-232-0/+54
| | | | | | | | | | \D{format} yields the result of calling strftime(3) with the provided format and the current time. When PS4 can use this, it will enable us to easily generate timestamps when tracing script execution. Differential Revision: https://reviews.freebsd.org/D35840
* sh: also auto-complete functionsPiotr Pawel Stefaniak2023-09-121-0/+12
| | | | Differential Revision: https://reviews.freebsd.org/D40619
* sh: introduce a function to iterate over all hashed commandsPiotr Pawel Stefaniak2023-09-122-7/+41
| | | | | | | | | | | | | While aliases and built-ins are opportunistically stored in cmdtable, each function will be added to it immediately on definition. Factor out the hashing function, write the iterator function and make it use the hashing function. Add the cmdname pointer to struct cmdentry so that the command name can be exposed that way. Differential Revision: https://reviews.freebsd.org/D40619
* sh: tab-complete aliasesPiotr Pawel Stefaniak2023-09-121-0/+9
| | | | Differential Revision: https://reviews.freebsd.org/D40619
* sh: introduce a function to iterate over all aliasesPiotr Pawel Stefaniak2023-09-122-6/+24
| | | | | | | | | | | | | | | | | Currently the data structure holding alias information is opaque for consumers outside alias.c and there is no way to iterate over all aliases, which will become needed by a future commit. The new function "iteralias" takes a null pointer to return the first alias or an existing alias to return the next one, unless there is no alias to return, in which case it returns a null pointer. I slightly changed the static function hashalias so that it returns the index into the array holding link heads, and not the link head directly. In this form it's easier to use by iteralias and the slight adjustment in the three existing callers doesn't look too bad. Differential Revision: https://reviews.freebsd.org/D40619
* sh: reindent a for loop in parser.cPiotr Pawel Stefaniak2023-09-121-119/+123
| | | | | | | Reduce indentation level before a commit that will add new code here. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D37926
* sh tests: Update $LINENO tests after $FreeBSD$ removalMark Johnston2023-08-232-4/+4
| | | | Fixes: d0b2dbfa0ecf ("Remove $FreeBSD$: one-line sh pattern")
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-16537-537/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1626-52/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1623-23/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Separate dependencies on tools built for host.Simon J. Gerraty2023-06-301-3/+6
| | | | | | | | | When generated files depend on tools that need to be built for host, we need to carefully separate them for the DIRDEPS_BUILD so we only build them once. Reviewed by: stevek Sponsored by: Juniper Networks, Inc.
* sh: also auto-complete built-insPiotr Pawel Stefaniak2023-06-191-7/+25
| | | | | | | | Reported in a comment in PR 261728. Reported by: Oleg Reviewed by: jilles (previous version), bapt Differential Revision: https://reviews.freebsd.org/D39839
* sh: make smark a static variable instead of a local in main()Daniel Kolesa2023-06-081-1/+7
| | | | | | | | We are modifying it after setjmp and then accessing it after the jump, so it cannot be a local. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D40415
* sh(1): initialize smark to zero in main()Daniel Kolesa2023-06-031-1/+1
| | | | | | | | | | | As popstackmark may be called on this without pushstackmark having been called, we need to initialize it so that we don't get a bogus comparison inside popstackmark, which would have resulted in a NULL pointer dereference. MFC After: 3 days Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D40413
* sh: improve stylePiotr Pawel Stefaniak2023-05-131-11/+12
|
* Fix building host tools for hostSimon J. Gerraty2023-04-201-2/+5
| | | | | | | | | | | | | | | Several makefile depend on tools built for host. At least when using DIRDEPS_BUILD we can build these for the pseudo machine "host" to facilitate building on older host versions. Ideally we would build these tools in their own directories to avoid building more than needed. For now, setting an appropriate default for BTOOLSPATH will suffice Reviewed by: stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39708
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-2/+2
|
* sh(1): fix history file write checkingDaniel Kolesa2023-03-201-1/+1
| | | | | | | | | | | We cannot just compare histsizeval() against 0, since that returns a string pointer, which is always non-zero (non-null). The logic in sethistsize() initializes the history size to 100 with values that are non-number, and an empty string counts as that. Therefore, the only time we want to not write into history with HISTSIZE val set is when it's explicitly 0. MFC after: 2 weeks
* sh(1): Allow non-printing characters in prompt stringsJuraj Lutter2022-12-223-10/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new prompt format characters: - '\[' starts the sequence of non-printing chatacters - '\]' ends the sequence of non-printing characters Within these sequences, the following characters are now supported: - '\a' emits ASCII BEL (0x07, 007) character - '\e' emits ASCII ESC (0x1b, 033) character - '\r' emits ASCII CR (0x0d, 015) character - '\n' emits ASCII CRLF sequence These can be used to embed ANSI sequences into prompt strings. Example in .shrc: PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ " This tries to maintain some degree of compatibility with GNU bash, that uses GNU readline library (which behaves slightly different from BSD editline): It has two "non-printing boundary" characters: - RL_PROMPT_START_IGNORE (\001) - RL_PROMPT_END_IGNORE (\002) while BSD editline only has one (when using EL_PROMPT_ESC setting), so for this purpose, ASCII \001 was chosen and both \[ and \] emits this character. And while here, enlarge PROMPTLEN from 128 to 192 characters. Reviewed by: jilles Approved by: jilles Differential Revision: https://reviews.freebsd.org/D37701
* sh: install hard link with same mode as targetEd Maste2022-11-231-0/+1
| | | | | | | | | | Previously when using NO_ROOT we recorded a METALOG entry for the /.profile hard link with a different mode than the link target, which is not permitted. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37476
* sh: when loading profile, read only .sh files.Dag-Erling Smørgrav2022-10-221-8/+3
| | | | | | | | Reviewers: jilles, eugen_grosbein.net, cy Subscribers: imp Differential Revision: https://reviews.freebsd.org/D37034
* sh: when loading profile, skip obvious scratch files.Dag-Erling Smørgrav2022-10-031-0/+5
| | | | Differential Revision: https://reviews.freebsd.org/D36856
* sh: read more profile files.Dag-Erling Smørgrav2022-10-011-0/+20
| | | | | Differential Revision: https://reviews.freebsd.org/D36505 MFC after: 1 month
* sh: Fix mismatch in array bounds for vforkexecshell().John Baldwin2022-09-281-1/+1
| | | | | | Reviewed by: imp, jilles, emaste Reported by: GCC -Warray-parameter Differential Revision: https://reviews.freebsd.org/D36760
* sh: nullify ENV in testsPiotr Pawel Stefaniak2022-08-203-3/+3
| | | | | | | | This is to avoid loading .shrc which may contain commands that would result in output different than expected. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D35876
* sh: accept fc options grouped behind one '-'Piotr Pawel Stefaniak2022-08-206-21/+41
| | | | | | | | | | | | | | | As per Utility Syntax Guidelines, accept both forms: -l -n and -ln. To do that, anticipate the source string for the next option that will be parsed by nextopt(). It's not always *argptr, sometimes it is nextopt_optptr. To simplify the check for not_fcnumber, slightly modify nextopt() to always nullify nextopt_optptr in cases where it would have been set to point to a NUL character. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D35836
* For man page references found in ports, indicate the respective port.Jens Schweikhardt2022-08-141-5/+5
|
* sh.1: Fix a mandoc warningGordon Bergling2022-07-311-1/+2
| | | | | | - new sentence, new line MFC after: 3 days
* sh: fix autocompletion for commands that share name with a directoryPiotr Pawel Stefaniak2022-03-281-2/+33
| | | | | | | | | | Provide libedit a special function making it always add a space after the autocompleted command. The default one adds a slash if the word is also a name of a directory in the current working directory, but this is wrong for commands. Reviewed by: bapt, jilles Differential Revision: https://reviews.freebsd.org/D34544
* sh: Don't add something to a null pointerJilles Tjoelker2022-01-261-0/+2
| | | | | | | | | | | Pointer arithmetic on a null pointer is undefined behavior. The bug can be reproduced by running bin/sh/tests/builtins/wait6.0 with UBSAN. Reported by: Mark Millard Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D34011
* sh: Avoid some headers when NO_HISTORY is set.Bryan Drewery2021-11-252-0/+4
| | | | | | This is more simpler compatibility with using this source on older systems before libedit was made to install filecomplete.h in commit b315a7296d2.
* sh: Fix heredoc at certain places in case and forJilles Tjoelker2021-10-275-7/+37
| | | | | | | | After an unescaped newline, there may be a here-document. Some places in case and for did not check for one. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D32628
* sh: Set PATH envvar after setting HOME in dotfileKa Ho Ng2021-10-261-2/+2
| | | | | | | | | | | | In single-user mode, all env vars are absent, so exptilde() would not be able to expand ~ correctly. Place the lines setting PATH below HOME, so exptilde() would work as expected. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jilles, emaste Differential Revision: https://reviews.freebsd.org/D27003
* sh(1): fix home/del key on mobaxterm envBaptiste Daroussin2021-10-201-0/+4
| | | | | | | | | | For $reason mobaxterm default on sending unusual sequence from home/del key, which makes libedit unabel to catch them and bind them correctly. mobaxterm seems popular on the windows environment, so add proper keybinding to default shrc configuration so it works out of box. Reported by: lme
* sh(1): interactive mode improvementBaptiste Daroussin2021-10-201-0/+9
| | | | | | | | | In the default configuration add 2 bindings which has been requested by many during the HEADSUP discussion: * csh like arrow history navigation * ctrl-arrow to jump from word to words Add an alias to make the history command exist as an alias to fc -l.
* src/bin/sh: Fix spelling errorsElyes HAOUAS2021-10-024-4/+4
| | | | | Pull Request: https://github.com/freebsd/freebsd-src/pull/544 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>