Commit Graph

42 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 4aadc182a6 Fix broken manual references. 2023-12-19 00:05:42 +01:00
Jonas 'Sortie' Termansen 47e1cc439a Add glob(3).
Switch sh(1) to use glob(3).

Remove compatibility for no glob(3) from the ports.
2023-03-16 00:20:43 +01:00
Jonas 'Sortie' Termansen 4d8cf6514e Color the default root shell prompt red and gold. 2023-02-26 21:59:44 +01:00
Jonas 'Sortie' Termansen 2ace33176c Add sh(1) prompt variable expansion. 2022-11-20 22:15:51 +01:00
Jonas 'Sortie' Termansen 159415c3b1 Implement profile(5) and shrc(5) in sh(1). 2022-11-19 18:01:30 +01:00
Jonas 'Sortie' Termansen c6af3bc074 Add sh(1) history builtin. 2022-11-19 18:01:30 +01:00
Jonas 'Sortie' Termansen 3c69791078 Save sh(1) history in ~/.sh_history. 2022-11-19 18:01:30 +01:00
Jonas 'Sortie' Termansen f4152b3863 Document sh(1). 2022-11-16 21:10:46 +01:00
Jonas 'Sortie' Termansen 6bab3819e2 Replace /etc/proper-shells with /etc/proper-sh defaulting to dash. 2022-11-16 21:10:46 +01:00
Jonas 'Sortie' Termansen 07dd21146b Fix sh(1) changing foreground group when non-interactive. 2022-11-16 20:16:34 +01:00
Jonas 'Sortie' Termansen f2d50bbf9c Add daemon support to init(8).
This change implements a dependency tracking daemon(7) system in init with
overridable init(5) configuration, parallel startup, readiness signaling,
rotating logs, reliable stopping, and handling of leaked processes.

The /etc/init/target file is replaced by the new /etc/init/default per the
new init(5) format. The old configuration is migrated upon upgrade using an
upgrade hook.

extfs(8) now signals readiness using READYFD for fast mounting.

Filesystems that fail to be repaired are now mounted read-only.

The mounting and filesystem checking code is synchronized with sysinstall.

The duplicated array_add utility function now protects against overflows.

tix-iso-bootconfig(8) gains the --init-target option.

tix-iso-liveconfig(8) gains the --daemons option.
2022-10-20 23:26:03 +02:00
Jonas 'Sortie' Termansen c2088ae3ee Fix shell double quoting escaping non-special characters.
This bug was reported by Ricardo Grant.
2021-09-13 20:37:56 +02:00
Jonas 'Sortie' Termansen 6bca83b399 Add sh(1) exec builtin. 2021-06-27 15:29:26 +02:00
Jonas 'Sortie' Termansen e8a9d3dc04 Fix code assuming struct winsize fields are size_t. 2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen 48e41b36a3 Support the ^[[1~ for Home and ^[[4~ for End escape sequences in sh(1). 2017-12-04 23:56:47 +01:00
Jonas 'Sortie' Termansen 7de1942803 Only the tty1 login session powers off. 2017-02-12 13:26:26 +01:00
Jonas 'Sortie' Termansen 0bb608b09e Support 8-bit/24-bit color and more escape codes in the graphical console.
The console has gained these escape codes:
 - Set color to any of 256 entries in the palette.
 - Set color to any 24-bit RGB value.
 - Inverse mode.
 - Bold mode.
 - Underline mode.
 - Move cursor to line N.
 - \a is now ignored.

The effectively unused ATTR_CHAR has been removed. Parsing of escape codes
has been improved. The graphical palette has been changed to the tango
colors, which makes Sortix look a bit differently. Some user-space programs
have been changed to use different colors that look better under the new
palette.

Remove const from methods that weren't really const and remove mutable
keyword workaround.
2016-11-27 11:19:03 +01:00
Jonas 'Sortie' Termansen 8d7d364037 Switch sh(1) to termios.
sh(1) now restores reasonable terminal attributes. This is not really its
problem, but as long as common Sortix programs don't always restore the
terminal attributes on exit, this will work around the issue in practice.
2016-11-22 21:36:43 +01:00
Jonas 'Sortie' Termansen 6841715274 Fix sh(1) prompt for non-root users. 2016-11-19 16:49:48 +01:00
Jonas 'Sortie' Termansen a77fb74fd9 Fix sh crash if show_state->current_line is NULL. 2016-11-03 22:10:45 +01:00
Ralph Holmes 5d774cce1d Fix execl(3) sentinel undefined behaviour.
execl(3) and its variants use a sentinel to terminate the variadic
argument list, in the form of a null pointer constant of type pointer to
char. POSIX mandates that NULL is a null pointer constant of type
pointer to void, which is not of an equivalent type to that required by
execl(3) and its variants, resulting in undefined behaviour.

This commit casts all such instances of NULL to pointer to char type.
For consistency, it also adds const-qualification to any such instances
which had already been casted, and were not const-qualified.
2016-09-30 23:36:49 +02:00
Jonas 'Sortie' Termansen 63146072a4 Fix getline(3) and getdelim(3) usage. 2016-05-15 19:32:04 +02:00
Jonas 'Sortie' Termansen 2b72262b4f Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.

All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.

All imported code from other projects is compatible with this license.

All GPL licensed code from other projects had previously been removed.

Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-05 22:21:50 +01:00
Jonas 'Sortie' Termansen 423285b855 Convert sh to C. 2016-03-03 23:02:24 +01:00
Jonas 'Sortie' Termansen aff8f4d89c Fix files with incorrect copyright headers. 2016-02-03 01:01:20 +01:00
Jonas 'Sortie' Termansen 0c5eff4475 Add export builtin to sh(1). 2016-01-26 21:55:40 +01:00
Jonas 'Sortie' Termansen bff1265d62 Add termios(2). 2016-01-25 15:47:40 +01:00
Jonas 'Sortie' Termansen 1080ffa5fb Refactor and improve shell greatly. 2015-10-28 20:13:37 +01:00
Jonas 'Sortie' Termansen 5cee2e9bc7 Fix shell line rendering use of after free. 2015-10-04 02:16:53 +02:00
Jonas 'Sortie' Termansen 6a177d4d79 Split shell into multiple files. 2015-10-04 02:16:53 +02:00
Jonas 'Sortie' Termansen ae1ed0c13c Replace strtok_r uses with strsep. 2015-08-26 17:49:28 +02:00
Jonas 'Sortie' Termansen 158716f96a Fix ctype invocations with wrong domain. 2015-08-11 15:57:56 +02:00
Jonas 'Sortie' Termansen 6371e33d71 Fix shadowed variable in shell. 2015-04-05 01:18:25 +02:00
Jonas 'Sortie' Termansen 3bef590a0f Fix shell tab-completion PATH parsing. 2015-03-11 14:27:43 +01:00
Jonas 'Sortie' Termansen 8eae7f359a Fix shell lexical chdir slash appending and fd leaks. 2015-03-11 14:27:43 +01:00
Jonas 'Sortie' Termansen 2d6481a5e7 Lexically change working directory in shell. 2014-12-07 18:55:12 +01:00
Jonas 'Sortie' Termansen 9d106004fa Use shell tokenization to recognize complete lines. 2014-12-07 18:55:12 +01:00
Jonas 'Sortie' Termansen 2bed2f7ce2 Improve shell line reading. 2014-12-07 18:55:12 +01:00
Jonas 'Sortie' Termansen 186ed27576 Add option parsing to the shell. 2014-12-07 18:55:12 +01:00
Jonas 'Sortie' Termansen 46d16f9e4c Use SHLVL to determine if a shell is outermost. 2014-12-07 18:55:12 +01:00
Jonas 'Sortie' Termansen 242cfcca12 Add line editing, history and tab completion to shell. 2014-12-07 18:55:12 +01:00
Jonas 'Sortie' Termansen d8df769692 Move sh to its own directory. 2014-12-07 18:25:09 +01:00